diff options
Diffstat (limited to 'scripts/qemucommand.py')
-rw-r--r-- | scripts/qemucommand.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/scripts/qemucommand.py b/scripts/qemucommand.py index 3045b45..a869d4d 100644 --- a/scripts/qemucommand.py +++ b/scripts/qemucommand.py | |||
@@ -1,4 +1,4 @@ | |||
1 | from os.path import exists, join, realpath, abspath | 1 | from os.path import exists, isdir, join, realpath, abspath |
2 | from os import listdir | 2 | from os import listdir |
3 | import random | 3 | import random |
4 | import socket | 4 | import socket |
@@ -42,6 +42,8 @@ class QemuCommand(object): | |||
42 | if args.machine: | 42 | if args.machine: |
43 | self.machine = args.machine | 43 | self.machine = args.machine |
44 | else: | 44 | else: |
45 | if not isdir(args.dir): | ||
46 | raise ValueError("Directory %s does not exist, please specify a --machine or a valid images directory" % args.dir) | ||
45 | machines = listdir(args.dir) | 47 | machines = listdir(args.dir) |
46 | if len(machines) == 1: | 48 | if len(machines) == 1: |
47 | self.machine = machines[0] | 49 | self.machine = machines[0] |
@@ -100,12 +102,8 @@ class QemuCommand(object): | |||
100 | cmdline += [ | 102 | cmdline += [ |
101 | "-serial", "tcp:127.0.0.1:%d,server,nowait" % self.serial_port, | 103 | "-serial", "tcp:127.0.0.1:%d,server,nowait" % self.serial_port, |
102 | "-m", self.mem, | 104 | "-m", self.mem, |
103 | "-usb", | ||
104 | "-object", "rng-random,id=rng0,filename=/dev/urandom", | 105 | "-object", "rng-random,id=rng0,filename=/dev/urandom", |
105 | "-device", "virtio-rng-pci,rng=rng0", | 106 | "-device", "virtio-rng-pci,rng=rng0", |
106 | "-device", "usb-tablet", | ||
107 | "-show-cursor", | ||
108 | "-vga", "std", | ||
109 | "-net", netuser, | 107 | "-net", netuser, |
110 | "-net", "nic,macaddr=%s" % self.mac_address | 108 | "-net", "nic,macaddr=%s" % self.mac_address |
111 | ] | 109 | ] |
@@ -117,9 +115,17 @@ class QemuCommand(object): | |||
117 | '-device', 'e1000,netdev=vlan1,mac='+random_mac(), | 115 | '-device', 'e1000,netdev=vlan1,mac='+random_mac(), |
118 | ] | 116 | ] |
119 | if self.gui: | 117 | if self.gui: |
120 | cmdline += ["-serial", "stdio"] | 118 | cmdline += [ |
119 | "-usb", | ||
120 | "-device", "usb-tablet", | ||
121 | "-show-cursor", | ||
122 | "-vga", "std" | ||
123 | ] | ||
121 | else: | 124 | else: |
122 | cmdline.append('-nographic') | 125 | cmdline += [ |
126 | "-nographic", | ||
127 | "-monitor", "null", | ||
128 | ] | ||
123 | if self.kvm: | 129 | if self.kvm: |
124 | cmdline += ['-enable-kvm', '-cpu', 'host'] | 130 | cmdline += ['-enable-kvm', '-cpu', 'host'] |
125 | else: | 131 | else: |