Commit db27ebe1 authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis

deploy: Fix vcluster wrt disk images

Remove the `os` setting from vcluster.conf and keep only one
image URL (which will also be removed in following patches
and replaced by either a debootstrap process or an official
debian base image from snf-image repo).

Use truncate instead of dd to create the local file
used for extra disk in the cluster's VMs.
Signed-off-by: default avatarDimitris Aragiorgis <dimara@grnet.gr>
parent 259636bc
......@@ -3,8 +3,7 @@
# root password and installed rsa/dsa keys. Plus a NetworkManager hook that
# changes the VM's name based on info provided by dhcp response.
# To create it run: snf-deploy image
squeeze_image_url = https://pithos.okeanos.grnet.gr/public/832xv
ubuntu_image_url =
image_url = https://pithos.okeanos.grnet.gr/public/832xv
# in order ganeti nodes to support lvm storage (plain disk template) it will
# be needed an extra disk to eventually be able to create a VG. Ganeti requires
......@@ -21,9 +20,6 @@ create_extra_disk = False
# lvg is the name of the local VG if any
lvg =
# OS istalled in the virtual cluster
os = squeeze
# the bridge to use for the virtual cluster
# on this bridge we will launch a dnsnmasq and provide
# fqdns needed to the cluster.
......
......@@ -3,8 +3,7 @@
# root password and installed rsa/dsa keys. Plus a NetworkManager hook that
# changes the VM's name based on info provided by dhcp response.
# To create it run: snf-deploy image
squeeze_image_url = https://pithos.okeanos.grnet.gr/public/832xv
ubuntu_image_url =
image_url = https://pithos.okeanos.grnet.gr/public/832xv
# in order ganeti nodes to support lvm storage (plain disk template) it will
# be needed an extra disk to eventually be able to create a VG. Ganeti requires
......@@ -21,9 +20,6 @@ create_extra_disk = False
# lvg is the name of the local VG if any
lvg =
# OS istalled in the virtual cluster
os = squeeze
# the bridge to use for the virtual cluster
# on this bridge we will launch a dnsnmasq and provide
# fqdns needed to the cluster.
......
......@@ -149,14 +149,11 @@ def network():
def image():
# FIXME: Create a clean wheezy image and use it for vcluster
if config.os == "ubuntu":
url = config.ubuntu_image_url
else:
url = config.squeeze_image_url
# FIXME: Create a wheezy image with debootstrap and use it for vcluster
url = config.image_url
disk0 = "{0}/{1}.disk0".format(config.vcluster_dir, config.os)
disk1 = "{0}/{1}.disk1".format(config.vcluster_dir, config.os)
disk0 = "{0}/vcluster.disk0".format(config.vcluster_dir)
disk1 = "{0}/vcluster.disk1".format(config.vcluster_dir)
create_dir(config.vcluster_dir, False)
......@@ -165,17 +162,18 @@ def image():
os.system(cmd)
if config.create_extra_disk and not os.path.exists(disk1):
disk1_base = os.path.basename(disk1)
if config.lvg:
cmd = """
lvcreate -L30G -n{0}.disk1 {1}
""".format(config.os, config.lvg)
lvcreate -L30G -n{0} {1}
""".format(disk1_base, config.lvg)
os.system(cmd)
cmd = """
ln -s /dev/{0}/{1}.disk1 {2}
""".format(config.lvg, config.os, disk1)
ln -s /dev/{0}/{1} {2}
""".format(config.lvg, disk1_base, disk1)
os.system(cmd)
else:
cmd = "dd if=/dev/zero of={0} bs=10M count=3000".format(disk1)
cmd = "truncate -s 30G {0}".format(disk1)
os.system(cmd)
......@@ -200,15 +198,15 @@ def _launch_vm(name, mac):
graphics = "-nographic"
disks = """ \
-drive file={0}/{1}.disk0,format=raw,if=none,id=drive0,snapshot=on \
-drive file={0}/vcluster.disk0,format=raw,if=none,id=drive0,snapshot=on \
-device virtio-blk-pci,drive=drive0,id=virtio-blk-pci.0 \
""".format(config.vcluster_dir, config.os)
""".format(config.vcluster_dir)
if config.create_extra_disk:
disks += """ \
-drive file={0}/{1}.disk1,format=raw,if=none,id=drive1,snapshot=on \
-drive file={0}/vcluster.disk1,format=raw,if=none,id=drive1,snapshot=on \
-device virtio-blk-pci,drive=drive1,id=virtio-blk-pci.1 \
""".format(config.vcluster_dir, config.os)
""".format(config.vcluster_dir)
ifup = config.lib_dir + "/ifup"
nics = """ \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment