summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2014-01-26 12:24:52 -0500
committerCole Robinson <crobinso@redhat.com>2014-01-26 13:09:26 -0500
commitb004d11eae372fcd968c8feca1040d8c2f1cf3f8 (patch)
treee828ea7fd982cf67982cba0e714d37f6b3fb4c0c
parent57e89cda8b6ce0b1d2206f9c27fc8231121d1894 (diff)
downloadvirt-manager-b004d11eae372fcd968c8feca1040d8c2f1cf3f8.tar.gz
cli: Fix unsetting --disk path
-rw-r--r--tests/cli-test-xml/compare/virtxml-edit-simple-disk-remove-path.xml13
-rw-r--r--tests/clitest.py1
-rw-r--r--virtinst/cli.py5
3 files changed, 17 insertions, 2 deletions
diff --git a/tests/cli-test-xml/compare/virtxml-edit-simple-disk-remove-path.xml b/tests/cli-test-xml/compare/virtxml-edit-simple-disk-remove-path.xml
new file mode 100644
index 00000000..9b2543f5
--- /dev/null
+++ b/tests/cli-test-xml/compare/virtxml-edit-simple-disk-remove-path.xml
@@ -0,0 +1,13 @@
+--- Original XML
++++ Altered XML
+@@ -55,7 +55,6 @@
+ <devices>
+ <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
+ <disk type="block" device="floppy">
+- <source dev="/dev/null"/>
+ <target dev="fda" bus="fdc"/>
+ <address type="drive" controller="0" bus="0" target="0" unit="0"/>
+ </disk>
+
+Domain 'test-many-devices' defined successfully.
+Changes will take effect after the next domain shutdown. \ No newline at end of file
diff --git a/tests/clitest.py b/tests/clitest.py
index 2ba918e1..46715259 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -787,6 +787,7 @@ c.add_compare("--security label=foo,bar,baz,UNKNOWN=val,relabel=on", "virtxml-ed
c.add_compare("--features eoi=on,hyperv_relaxed=off,acpi=", "virtxml-edit-simple-features")
c.add_compare("--clock offset=localtime,hpet_present=yes,kvmclock_present=no,rtc_tickpolicy=merge", "virtxml-edit-simple-clock")
c.add_compare("--disk /dev/zero,perms=ro,startup_policy=optional", "virtxml-edit-simple-disk")
+c.add_compare("--disk path=", "virtxml-edit-simple-disk-remove-path")
c.add_compare("--network source=br0,type=bridge,model=virtio,mac=", "virtxml-edit-simple-network")
c.add_compare("--graphics tlsport=5902,keymap=ja", "virtxml-edit-simple-graphics")
c.add_compare("--controller index=2,model=lsilogic", "virtxml-edit-simple-controller")
diff --git a/virtinst/cli.py b/virtinst/cli.py
index e02cf196..4adf0d7b 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -1723,6 +1723,7 @@ class ParserDisk(VirtCLIParser):
convert_perms(opts.get_opt_param("perms"))
path = opts.get_opt_param("path")
+ had_path = path is not None
backing_store = opts.get_opt_param("backing_store")
pool = opts.get_opt_param("pool")
vol = opts.get_opt_param("vol")
@@ -1734,8 +1735,8 @@ class ParserDisk(VirtCLIParser):
self.guest, path, pool, vol, size, fmt, sparse)
path = volobj and volobj.path() or abspath
- if path:
- opts.opts["path"] = path
+ if had_path or path:
+ opts.opts["path"] = path or ""
inst = VirtCLIParser._parse(self, opts, inst)