[virt-tools-list] [PATCH 2/2] virt-install: allow to specify "startupPolicy" for --disk

Giuseppe Scrivano gscrivan at redhat.com
Thu Oct 3 14:01:03 UTC 2013


Signed-off-by: Giuseppe Scrivano <gscrivan at redhat.com>
---
 man/virt-install.pod | 5 +++++
 tests/clitest.py     | 2 ++
 virtinst/cli.py      | 1 +
 3 files changed, 8 insertions(+)

diff --git a/man/virt-install.pod b/man/virt-install.pod
index 74caf02..930623e 100644
--- a/man/virt-install.pod
+++ b/man/virt-install.pod
@@ -517,6 +517,11 @@ Serial number of the emulated disk device. This is used in linux guests
 to set /dev/disk/by-id symlinks. An example serial number might be:
 WD-WMAP9A966149
 
+=item B<startup_policy>
+
+It defines what to do with the disk if the source file is not accessible.  See
+possible values in L<http://www.libvirt.org/formatdomain.html#elementsDisks>
+
 =back
 
 See the examples section for some uses. This option deprecates C<--file>,
diff --git a/tests/clitest.py b/tests/clitest.py
index fbd8e20..0abd8d1 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -655,6 +655,8 @@ c.add_invalid("--disk %(COLLIDE)s")  # Colliding storage without --force
 c.add_invalid("--disk /dev/default-pool/backing.img")  # Colliding storage via backing store
 c.add_invalid("--disk %(DIR)s,device=cdrom")  # Dir without floppy
 c.add_invalid("--disk %(EXISTIMG1)s,driver_name=foobar,driver_type=foobaz")  # Unknown driver name and type options (as of 1.0.0)
+c.add_valid("--disk path=%(EXISTIMG1)s,startup_policy=optional")  # Existing disk, startupPolicy
+c.add_invalid("--disk path=%(EXISTIMG1)s,startup_policy=Foo")  # Existing disk, invalid startupPolicy
 
 
 c = vinst.add_category("redirdev", "--noautoconsole --nographics --nodisks --pxe")
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 86b1942..0926713 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -1461,6 +1461,7 @@ def parse_disk(guest, optstr, dev=None, validate=True):
     set_param("driver_io", "io")
     set_param("error_policy", "error_policy")
     set_param("serial", "serial")
+    set_param("sourceStartupPolicy", "startup_policy")
 
     _check_leftover_opts(opts)
     if validate:
-- 
1.8.3.1




More information about the virt-tools-list mailing list