568
569
570
571
572
573
574
575
576
577
578
579
580
581
|
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
|
+
+
+
|
else:
print >> sys.stderr, ("Cannot create VW directory, " +
"something on the way")
sys.exit(1)
# Creating directory for VM
os.makedirs(machinedir, dirmode)
driveopts = {"interface":parsed_args.diskif, "image":drivename}
if parsed_args.install:
install_image = os.path.abspath(parsed_args.install)
if parsed_args.image:
# Copying image file
print >>sys.stderr, ("Copying %s to %s" %
(parsed_args.image,
os.path.join(machinedir, drivename)))
os.system("qemu-img convert -O qcow2 -p %s %s" %
(parsed_args.image,
|
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
|
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
|
-
+
|
print repr(options)
with open("start", "w") as script:
script.write(TEMPLATE.format(**options))
os.chmod('start', dirmode)
# If installation media is specified vws start for new vm
if parsed_args.install:
start_opts = Namespace(machine=parsed_args.machine,
command='start', cdrom=[parsed_args.install],
command='start', cdrom=[install_image],
dir=machinedir, stopped=True, snapshot=False,
args="", gui=True)
try:
cmd_start(start_opts)
finally:
# pylint: disable=no-member
start_opts.sock.shutdown(socket.SHUT_RDWR)
|