353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
|
""" vws usb remove """
address = find_usb(options, get_vm_devices(options.sock))
answer = send_command(options.sock, "usb_del %s" % address)
print answer
def cmd_list(options):
""" vws list """
count = 0
search_path = [("private",os.path.join(pwd.getpwuid(os.getuid()).pw_dir, "VWs")),
("shared",config.get("directories", "SharedVMs")),
("autostart",config.get("directories", "AutostartVMs"))]
maxlen = 0
vms = []
bridges = set()
for (vmtype,dirname) in search_path:
if not os.access(dirname + "/.", os.X_OK):
continue
for vmname in os.listdir(dirname):
if os.access(dirname + "/" + vmname + "/start", os.X_OK):
count += 1
f = {"name":vmname}
if maxlen < len(vmname):
maxlen = len(vmname)
if options.state:
f["type"]=vmtype
sock = connect_vm(dirname + "/" + vmname)
|
>
>
>
>
>
>
>
>
|
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
|
""" vws usb remove """
address = find_usb(options, get_vm_devices(options.sock))
answer = send_command(options.sock, "usb_del %s" % address)
print answer
def cmd_list(options):
""" vws list """
import fnmatch
count = 0
search_path = [("private",os.path.join(pwd.getpwuid(os.getuid()).pw_dir, "VWs")),
("shared",config.get("directories", "SharedVMs")),
("autostart",config.get("directories", "AutostartVMs"))]
maxlen = 0
vms = []
bridges = set()
for (vmtype,dirname) in search_path:
if not os.access(dirname + "/.", os.X_OK):
continue
for vmname in os.listdir(dirname):
if os.access(dirname + "/" + vmname + "/start", os.X_OK):
matches=False
for p in options.pattern:
if fnmatch.fnmatch(vmname,p):
matches=True
break
if not matches:
continue
count += 1
f = {"name":vmname}
if maxlen < len(vmname):
maxlen = len(vmname)
if options.state:
f["type"]=vmtype
sock = connect_vm(dirname + "/" + vmname)
|
837
838
839
840
841
842
843
844
845
846
847
848
849
850
|
cmds = args.add_subparsers(dest='command', help="sub-command help")
p = cmds.add_parser("list", help="List existing VWs",
description="List existing VWs")
p.add_argument("--state", action='store_const', const=True, default=False,
dest='state', help='Show state of the machine')
p.add_argument("--usb", action='store_const', const=True, default=False,
dest='usb', help='Show connected USB devices')
p = cmds.add_parser("version", help="show vws version")
p = cmds.add_parser("autostart",help="Autostart all VMs marked as autostartable")
p = cmds.add_parser("shutdown",help="shut down all running VMs")
p.add_argument("--wait",help="wait until all machines would be shoutdown",
action="store_const", const=True, default=False, dest="wait")
p.add_argument("--timeout",type=int,default=90,
help="how long to way for VMs shutdown before forcing it off")
|
>
|
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
|
cmds = args.add_subparsers(dest='command', help="sub-command help")
p = cmds.add_parser("list", help="List existing VWs",
description="List existing VWs")
p.add_argument("--state", action='store_const', const=True, default=False,
dest='state', help='Show state of the machine')
p.add_argument("--usb", action='store_const', const=True, default=False,
dest='usb', help='Show connected USB devices')
p.add_argument("pattern", nargs='*',default='*',help="Name patterns")
p = cmds.add_parser("version", help="show vws version")
p = cmds.add_parser("autostart",help="Autostart all VMs marked as autostartable")
p = cmds.add_parser("shutdown",help="shut down all running VMs")
p.add_argument("--wait",help="wait until all machines would be shoutdown",
action="store_const", const=True, default=False, dest="wait")
p.add_argument("--timeout",type=int,default=90,
help="how long to way for VMs shutdown before forcing it off")
|