178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
-
+
|
if options.cdrom:
arg = " -cdrom " + os.path.abspath(options.cdrom[0])
if options.snapshot:
arg = arg+" -snapshot"
if options.args:
arg = arg + " " + "".join(options.args)
if options.password:
os.environ["SPICE_PASSWORD"]=options.password
os.environ["SPICE_PASSWORD"]=options.password[0]
print arg
cwd = os.getcwd()
os.chdir(options.dir)
# Check for snapshot
nxt = 0
snapshot_id = None
with os.popen("qemu-img info \"%s\"" %
|
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
|
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
|
+
-
+
|
sock.close()
continue
start_opts = Namespace(machine = name,
command = 'start',
dir = machine_dir,
snapshot = False,
stopped = True,
password = None,
args = "",
gui = False,
cdrom = None)
try:
cmd_start(start_opts)
print name," ",
finally:
# pylint: disable=no-member
if start_opts.sock:
if hasattr(start_opts,"sock") and start_opts.sock:
start_opts.sock.shutdown(socket.SHUT_RDWR)
print ""
def cmd_shutdown(options):
""" Search for all running machines and stops all of them """
dirlist=[config.get("directories","AutostartVMs"),
config.get("directories","SharedVms")]
|