Commit 39ade0fa authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis

deploy: Do create a VG if not extra disk found

If an extra disk found (node_info.extra_disk) then use it.
Otherwise create a raw file under / and losetup it.

Add a new option `vg_size` to reflect the size of the volume group
(the physical group actually) of a Ganeti node. Use it to
create the raw file if the extra disk is not found.
Signed-off-by: default avatarDimitris Aragiorgis <dimara@grnet.gr>
parent db27ebe1
[DEFAULT]
vg = ganeti
vg_size = 10G
[ganeti1]
name = ganeti1
......
[DEFAULT]
vg = ganeti
vg_size = 10G
[ganeti1]
name = ganeti1
......
......@@ -582,15 +582,23 @@ class Ganeti(base.Component):
]
def _prepare_lvm(self):
ret = []
disk = self.node.extra_disk
if disk:
ret = [
"test -e %s" % disk,
"pvcreate %s" % disk,
"vgcreate %s %s" % (self.cluster.vg, disk)
]
return ret
extra_disk_dev = self.node.extra_disk
extra_disk_file = "/disk"
# If extra disk found use it
# else create a raw file and losetup it
cmd = """
if [ -b "{0}" ]; then
pvcreate {0} && vgcreate {0} {2}
else
truncate -s {3} {1}
loop_dev=$(losetup -f --show {1})
pvcreate $loop_dev
vgcreate {2} $loop_dev
fi
""".format(extra_disk_dev, extra_disk_file,
self.cluster.vg, self.cluster.vg_size)
return [cmd]
def _prepare_net_infra(self):
br = config.common_bridge
......
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