diff options
| author | Patrick Vacek <patrickvacek@gmail.com> | 2019-08-20 16:19:18 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-08-20 16:19:18 +0200 |
| commit | 5e7ab2790cf4bfc6964254f0ccf696c1ad02b946 (patch) | |
| tree | 2d27fc4d09bb394b6a8775f36b824d3a2efae541 /scripts/qemucommand.py | |
| parent | 66a90135c7621d1337822bdee751e85ac0520e75 (diff) | |
| parent | 90eddc039a145e965b5d77e71e8132ec58a62da5 (diff) | |
| download | meta-updater-5e7ab2790cf4bfc6964254f0ccf696c1ad02b946.tar.gz | |
Merge pull request #581 from advancedtelematic/backport/thud-19-08-14
Backport/thud 19 08 14
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: |
