update qemu module
This commit is contained in:
parent
07de84e764
commit
19e4c10f4f
1 changed files with 9 additions and 1 deletions
|
@ -123,7 +123,7 @@ class QEMU:
|
||||||
|
|
||||||
return True
|
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)
|
os.popen("cp /etc/vmbuilder/qemu/* /var/lib/qemu/images/%s/templates/qemu" % hostname)
|
||||||
|
|
||||||
# generate partition file
|
# 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/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")
|
os.popen("cp vm/firstboot.sh /var/lib/qemu/images/%s/boot.sh" % hostname, "r")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue