659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
|
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
|
-
+
|
fi
#set umask to make machine group-accessable
umask 002
{qemubinary} -name $NAME {accel} \\
-m {memory} \\
{drive} \\
{cdrom}$CDROM \\
{net} \\
{rtc}{net} \\
{usb} \\
{sound} \\
-chardev socket,server,nowait,path=monitor,id=monitor \\
-mon chardev=monitor,mode=readline \\
-vga {vga} \\
-spice port=$SPICE_PORT,$SPICE_AUTH \\
-device virtio-serial -chardev spicevmc,id=vdagent,name=vdagent \\
|
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
|
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
|
-
+
+
|
"accel":"-enable-kvm",
"memory":"1024M",
"vga":'qxl',
"drive":"-drive media=disk,index=0,if={interface},file={image}",
"cdrom":"-drive media=cdrom,index=2,if=ide",
"sound":"-soundhw hda",
"group":config.get("permissions","vm_group"),
"usb":"-usb"}
"usb":"-usb",
"rtc":""}
macaddr = ":".join(["%02x" % ord(x) for x in chr(0x52) + os.urandom(5)])
if parsed_args.shared:
machinedir = os.path.join(config.get("directories", "SharedVMs"),
parsed_args.machine)
dirmode = 0775
else:
machinedir = os.path.join(pwd.getpwuid(os.getuid()).pw_dir, "VWs",
|
736
737
738
739
740
741
742
743
744
745
746
747
748
749
|
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
|
+
+
|
if not parsed_args.sound:
options["sound"] = ''
else:
options["sound"] = '-soundhw ' + parsed_args.sound
options["memory"] = parsed_args.mem
if parsed_args.localtime:
options["rtc"] = "-rtc base=localtime,clock=host \\\n"
if os.path.exists(machinedir):
if os.path.exists(os.path.join(machinedir, "start")):
print >> sys.stderr, ("Virtual Worstation %s already exists" %
parsed_args.machine)
else:
print >> sys.stderr, ("Cannot create VW directory, " +
|
922
923
924
925
926
927
928
929
930
931
932
933
934
935
|
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
|
+
+
+
|
p.add_argument("--size", metavar='size', help="Size of primary disk images",
dest="size", default=config.get('create options', 'size'))
p.add_argument("--arch", metavar='cputype', help="Emulated architecture",
dest="arch", default=config.get('create options', 'arch'))
p.add_argument("--no-sound", help="Disable sound card", action='store_const',
const=None, default=config.get('create options', 'sound'),
dest="sound")
p.add_argument('--localtime', action='store_const',const=True,default=False,
help="Show system clock as local time, not UTC to guest OS",
dest='localtime')
p.add_argument("--sound", metavar='cardtype', help="Specify sound card type",
dest='sound', default=config.get('create options', 'sound'))
p.add_argument("--vga", metavar='cardtype',
help="specify video card type (cirrus,std,vmware,qxl) default " +
config.get('create options', 'vga',), dest="vga",
default=config.get('create options', 'vga'))
p.add_argument("--net", help="Network - 'user' or bridge name",
|