Bug 816849

Summary: virtinst will get error when use error_policy=ignore
Product: [Community] Virtualization Tools Reporter: zhe peng <zpeng>
Component: virt-managerAssignee: Cole Robinson <crobinso>
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: acathrow, ajia, berrange, crobinso, cwei, dallan, hyao, jwu, mjenner, mzhan
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-17 10:36:20 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description zhe peng 2012-04-27 03:45:22 EDT
Description of problem:
setting disk with error_policy=none and error_policy=ignore will cause error when install guest

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1: run command:
#virt-install -n demo2 -r 1024 --disk path=/tmp/demo2.img,size=4 --disk path=/dev/sda2,error_policy=none --vnc --debug --force
virt-install -n demo2 -r 1024 --disk path=/tmp/demo2.img,size=4 --disk path=/dev/sda2,error_policy=ignore --vnc --debug --force

Actual results:
error_policy = none:
Fri, 27 Apr 2012 03:40:16 DEBUG    Traceback (most recent call last):
  File "/usr/sbin/virt-install", line 629, in start_install
  File "/usr/lib/python2.6/site-packages/virtinst/Guest.py", line 1223, in start_install
  File "/usr/lib/python2.6/site-packages/virtinst/Guest.py", line 1291, in _create_guest
    dom = self.conn.createLinustart_xml or final_xml, 0)
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 2463, in createLinux
    if ret is None:raise libvirtError('virDomainCreateLinu) failed', conn=self)
libvirtError: internal error unknown disk error policy 'none'
Fri, 27 Apr 2012 03:40:16 DEBUG    Domain installation does not appear to have been successful.

error_policy = ignore:
Fri, 27 Apr 2012 03:43:04 DEBUG    Traceback (most recent call last):
  File "/usr/sbin/virt-install", line 137, in get_disk
    dev, size = cli.parse_disk(guest, diskopts)
  File "/usr/lib/python2.6/site-packages/virtinst/cli.py", line 1578, in parse_disk
    set_param("error_policy", "error_policy")
  File "/usr/lib/python2.6/site-packages/virtinst/cli.py", line 1124, in _set_param
    setattr(inst, paramname, val)
  File "/usr/lib/python2.6/site-packages/virtinst/XMLBuilderDomain.py", line 309, in new_setter
    fset(self, val, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/virtinst/VirtualDisk.py", line 875, in _set_error_policy
    raise ValueError(_("Unknown error policy '%s'" % val))
ValueError: Unknown error policy 'ignore'

Expected results:
the guest can install successful

Additional info:
libvirt already support this two options
Comment 4 Alex Jia 2012-04-28 02:38:30 EDT
In fact, the issue has been fixed on upstream:

commit 8a8ea12db239f5b40986ef65d857b2cb09bffffb
Author: Cole Robinson <crobinso@redhat.com>
Date:   Tue Jan 31 17:28:16 2012 -0500

    virt-install: --error_policy s/none/ignore/

diff --git a/man/en/virt-install.pod.in b/man/en/virt-install.pod.in
index 5c09443..ee991ab 100644
--- a/man/en/virt-install.pod.in
+++ b/man/en/virt-install.pod.in
@@ -480,7 +480,7 @@ Disk IO backend. Can be either "threads" or "native".
 =item B<error_policy>
 How guest should react if a write error is encountered. Can be one of
-"stop", "none", or "enospace"
+"stop", "ignore", or "enospace"
 =item B<serial>
diff --git a/virtinst/VirtualDisk.py b/virtinst/VirtualDisk.py
index d681a17..1b8bd39 100644
--- a/virtinst/VirtualDisk.py
+++ b/virtinst/VirtualDisk.py
@@ -348,7 +348,7 @@ class VirtualDisk(VirtualDevice):
             return "dir"
         return "file"
-    error_policies = ["none", "stop", "enospace"]
+    error_policies = ["ignore", "stop", "enospace"]
     def path_exists(conn, path):

Cole, need also to add 'report' error policy in here, right?
Comment 5 Cole Robinson 2012-04-30 12:52:12 EDT
Yeah I'd take a patch to add 'report' type
Comment 6 Cole Robinson 2012-05-02 16:09:31 EDT
Not take 6.3 material anyways, moving to 6.4
Comment 8 Cole Robinson 2013-04-21 15:12:18 EDT
virtinst has been merged into virt-manager.git. Moving all virtinst bugs to the virt-manager component.
Comment 9 Cole Robinson 2013-08-17 10:36:20 EDT
This is upstream now, including error_policy='report'