update qemu module

This commit is contained in:
Vyacheslav Anzhiganov 2016-05-13 16:41:18 +03:00
parent 07de84e764
commit 19e4c10f4f

View file

@ -123,7 +123,7 @@ class QEMU:
return True
def create(self, cores, memory, storage, hostname, ip, dns1, dns2, password, os_name, os_suite):
def create(self, cores, memory, storage, swap, hostname, ip, dns1, dns2, password, os_name, os_suite):
"""
функция создания виртуальной машины
"""
@ -144,6 +144,14 @@ class QEMU:
os.popen("cp /etc/vmbuilder/qemu/* /var/lib/qemu/images/%s/templates/qemu" % hostname)
# generate partition file
#Open new data file
f = open("/var/lib/qemu/images/%s/partition" % hostname, "w")
f.write("root %s\n" % storage)
if swap > 0:
f.write("---\n" % swap)
f.write("swap %s\n" % swap)
f.close()
os.popen("cp vm/storage/%s.partition /var/lib/qemu/images/%s/partition" % (storage, hostname), "r")
os.popen("cp vm/firstboot.sh /var/lib/qemu/images/%s/boot.sh" % hostname, "r")