[virt-tools-list] [virt-manager PATCH 1/3] virt-install: add support for '--panic option'
Chen Hanxiao
chenhanxiao at cn.fujitsu.com
Wed Jan 22 09:44:38 UTC 2014
From: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
---
virt-install | 1 +
virtinst/cli.py | 31 +++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/virt-install b/virt-install
index b003e95..a7f23f2 100755
--- a/virt-install
+++ b/virt-install
@@ -530,6 +530,7 @@ def build_guest_instance(conn, options):
cli.get_smartcards(guest, options.smartcard)
cli.get_tpms(guest, options.tpm)
cli.get_rngs(guest, options.rng)
+ cli.get_panic(guest, options.panic)
guest.add_default_input_device()
guest.add_default_console_device()
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 1fa558b..c7469ff 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -896,6 +896,9 @@ def add_device_options(devg):
help=_("Configure a guest RNG device. Ex:\n"
"--rng /dev/random\n"
"--rng egd,backend_host=localhost,backend_service=708,backend_type=tcp"))
+ devg.add_argument("--panic", dest="panic", action="append",
+ help=_("Configure a guest panic device. Ex:\n"
+ "--panic default"))
def add_gfx_option(devg):
@@ -1726,6 +1729,34 @@ def parse_memballoon(guest, optstr, dev):
get_memballoons = _make_handler(virtinst.VirtualMemballoon, parse_memballoon)
+###################
+# --panic parsing #
+###################
+
+def parse_panic(guest, optstr, dev):
+ ignore = guest
+
+ opts = parse_optstr(optstr, remove_first="io")
+ set_param = _build_set_param(dev, opts)
+
+ # Allow --panic io=0x506
+ if opts.get("io").startswith("0x") \
+ or opts.get("io").isdigit():
+ dev.type = "isa"
+ set_param("iobase", "io")
+
+ # Allow --panic default
+ elif opts.get("io").lower() == "default":
+ opts.pop("io")
+ set_param("iobase",
+ virtinst.VirtualPanicDevice.IOBASE_DEFAULT)
+
+ _check_leftover_opts(opts)
+ return dev
+
+get_panic = _make_handler(virtinst.VirtualPanicDevice, parse_panic)
+
+
######################################################
# --serial, --parallel, --channel, --console parsing #
######################################################
--
1.8.2.1
More information about the virt-tools-list
mailing list