Bug 730909 - setting disk with error_policy=enospace will cause error when install guest
setting disk with error_policy=enospace will cause error when install guest
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt (Show other bugs)
6.2
Unspecified Unspecified
low Severity medium
: rc
: ---
Assigned To: Laine Stump
Virtualization Bugs
:
Depends On:
Blocks: 747120
  Show dependency treegraph
 
Reported: 2011-08-16 04:03 EDT by zhe peng
Modified: 2011-12-06 06:26 EST (History)
7 users (show)

See Also:
Fixed In Version: libvirt-0.9.4-16.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-12-06 06:26:55 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
virt-install --debug full output (6.12 KB, text/plain)
2011-08-23 22:43 EDT, zhe peng
no flags Details

  None (edit)
Description zhe peng 2011-08-16 04:03:45 EDT
Description of problem:
set error_policy to enospace, will cause error and block installation.

Version-Release number of selected component (if applicable):
python-virtinst-0.600.0-2.el6
qemu-kvm-0.12.1.2-2.177.el6
libvirt-0.9.4-2.el6

How reproducible:
always

Steps to Reproduce:
1.according to virt-install man page
run command line:
# virt-install -n demo -r 1024 --disk path=/tmp/demo.img,size=4 --disk path=/dev/sda2,error_policy=enospace -c /tmp/RHEL6.1-20110510.1-Server-x86_64-DVD1.iso --vnc

  
Actual results:
.........
Tue, 16 Aug 2011 04:00:44 ERROR    internal error Process exited while reading console log output: char device redirected to /dev/pts/5
qemu-kvm: -drive file=/dev/sda2,if=none,id=drive-ide0-0-1,format=raw,cache=none,werror=enospace,rerror=enospace,aio=native: 'enospace' invalid write error action

Tue, 16 Aug 2011 04:00:44 DEBUG    Traceback (most recent call last):
  File "/usr/sbin/virt-install", line 620, in start_install
    noboot=options.noreboot)
  File "/usr/lib/python2.6/site-packages/virtinst/Guest.py", line 1223, in start_install
    noboot)
  File "/usr/lib/python2.6/site-packages/virtinst/Guest.py", line 1291, in _create_guest
    dom = self.conn.createLinux(start_xml or final_xml, 0)
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 1963, in createLinux
    if ret is None:raise libvirtError('virDomainCreateLinux() failed', conn=self)
libvirtError: internal error Process exited while reading console log output: char device redirected to /dev/pts/5
qemu-kvm: -drive file=/dev/sda2,if=none,id=drive-ide0-0-1,format=raw,cache=none,werror=enospace,rerror=enospace,aio=native: 'enospace' invalid write error action
Tue, 16 Aug 2011 04:00:44 DEBUG    Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
  virsh --connect qemu:///system start demo
otherwise, please restart your installation.
Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
  virsh --connect qemu:///system start demo
otherwise, please restart your installation.

set error_policy to none will same with enospace

Expected results:
if support this option, install will successful

Additional info:
if set error_policy to 'stop',installation will successful.
Comment 1 Cole Robinson 2011-08-23 14:35:40 EDT
Can you please provide the full output of running virt-install with --debug?

I don't think this is a virtinst issue, either libvirt or qemu. Reassigning to libvirt.
Comment 2 zhe peng 2011-08-23 22:43:01 EDT
Created attachment 519546 [details]
virt-install --debug full output
Comment 3 zhe peng 2011-08-23 22:45:17 EDT
# tail -f /var/log/libvirt/libvirtd.log
22:24:11.889: 1594: error : qemuProcessReadLogOutput:939 : internal error Process exited while reading console log output: char device redirected to /dev/pts/7
qemu-kvm: -drive file=/dev/sda2,if=none,id=drive-ide0-0-1,format=raw,cache=none,werror=enospace,rerror=enospace,aio=native: 'enospace' invalid write error action
Comment 4 Laine Stump 2011-10-04 01:52:52 EDT
According to blockdev.c in the qemu source, the proper name for this option is "enospc", not "enospace". Additionally, it is only valid for werror, not for rerror.

It's simple enough to change enospace to enospc in the generated qemu commandline, but since libvirt's config has a single setting "error_policy" which is applied to both qemu's werror and rerror options, and "enospc" isn't allowed for rerror, what should rerror be set to when we set werror=enospc?
Comment 5 Eric Blake 2011-10-04 13:53:42 EDT
IRC suggestions:
patch 1: map error_policy=enospace to werror=enospc,rerror=ignore
patch 2: add XML attribute read_error_policy='stop|ignore', if not present, then it defaults to the error_policy='stop|ignore|enospace' setting except that enospace maps to ignore, where error_policy controls werror and read_error_policy controls rerror

Then we could backport patch 1 in isolation to fix the problem, while using both patches upstream for maximal flexibility
Comment 6 Laine Stump 2011-10-04 23:44:55 EDT
A patch to fix the spelling problem, and avoid using enospc for rerror, has been pushed to upstream libvirt, and a rebased version posted to rhvirt-patches for inclusion in the next libvirt build for RHEL:

http://post-office.corp.redhat.com/archives/rhvirt-patches/2011-October/msg00161.html

commit 12062abb89fe3684712ed454f090a86e6ce4f185
Author: Laine Stump <laine@laine.org>
Date:   Tue Oct 4 13:26:29 2011 -0400

    qemu: correct misspelled 'enospc' option, and only use for werror
    
    This resolves:
    
         https://bugzilla.redhat.com/show_bug.cgi?id=730909
    
    When support for setting the qemu disk error policy to "enospc" was
    added, it was inadvertently spelled "enospace". This patch corrects
    that on the qemu commandline (while retaining the "enospace" spelling
    for libvirt's XML).
    
    Also, while examining the qemu source, I found that "enospc" is not
    allowed for the read error policy, only for write error policy (makes
    sense). Since libvirt currently only has a single error policy
    setting, when "enospace" is selected, the read error policy is set to
    "ignore".
Comment 7 Eric Blake 2011-10-05 11:05:38 EDT
Paolo pointed out that the default when rerror= is omitted is rerror=report, which makes more sense than rerror=ignore.  We need a further upstream patch to use a nicer default, so I'm moving this back to ASSIGNED to remind us to backport that once it is available.
Comment 8 Laine Stump 2011-10-07 01:13:57 EDT
There's a new patch upstream, and posted to rhvirt-patches, to remedy the issues brought up by Paolo:

http://post-office.corp.redhat.com/archives/rhvirt-patches/2011-October/msg00221.html

commit 91195b4321a1508139e36bcafc98201094af05de
Author: Laine Stump <laine@laine.org>
Date:   Wed Oct 5 11:19:28 2011 -0400

    qemu: leave rerror policy at default when enospace is requested
    
    commit 12062ab set rerror=ignore when error_policy="enospace" was
    selected (since the rerror option in qemu doesn't accept "enospc", as
    the werror option does).
    
    After that patch was already pushed, Paolo Bonzini noticed it and
    commented that leaving rerror at the default ("report") would be a
    better choice. This patch corrects the problem - if error_policy =
    "enospace" is given, rerror is left off the qemu commandline,
    effectively setting it to "report". For other values, rerror is still
    set to match werror.
    
    Additionally, the parsing of error_policy was changed to no longer
    erroneously allow "default" as a choice - as with most other
    attributes, if you want the default setting, just don't specify an
    error_policy.
    
    Finally, two ommissions in the first patch were corrected - a
    long-dormant qemuxml2argv test for enospace was enabled, and fixed to
    pass, and the argv2xml parser in qemu_command.c was updated to
    recognize the different spelling on the qemu commandline.
Comment 10 weizhang 2011-10-08 02:35:29 EDT
verify pass on 
qemu-kvm-0.12.1.2-2.195.el6.x86_64
kernel-2.6.32-206.el6.x86_64
libvirt-0.9.4-16.el6.x86_64


with command
# virt-install -n demo -r 1024 --disk path=/tmp/demo.img,size=4 --disk path=/dev/sda12,error_policy=enospace -c /tmp/RHEL6.0-20100922.1-Server-x86_64-DVD1.iso --vnc

install does not report error like "'enospace' invalid write error action" and installation can succeed
Comment 11 zhe peng 2011-10-08 03:38:48 EDT
verify with:
libvirt-0.9.4-16.el6
qemu-img-0.12.1.2-2.195.el6
kernel-2.6.32-206.el6
python-virtinst-0.600.0-3.el6

step:
 test error_policy=enospace:
1: run command line:
#virt-install -n demo -r 1024 --disk path=/tmp/demo.img,size=4 --disk path=/dev/sda2,error_policy=enospace -c /dev/cdrom --vnc --debug
......
<disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' error_policy='enospace' io='native'/>
      <source dev='/dev/sda2'/>
......
the installation will success without error.
2: #ps -ef | grep demo
qemu      5108     1  4 02:42 ?        00:00:19 /usr/libexec/qemu-kvm -S -M rhel6.2.0 -enable-kvm -m 1024 -smp 1,sockets=1,cores=1,threads=1 -name demo -uuid 2f3c5809-ca3b-82ef-6a7b-c324550d1d5a -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/demo.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -drive file=/tmp/demo.img,if=none,id=drive-ide0-0-0,format=raw,cache=none -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -drive file=/dev/sda2,if=none,id=drive-ide0-0-1,format=raw,cache=none,werror=enospc,aio=native -device ide-drive,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 -drive if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -netdev tap,fd=23,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:30:a3:aa,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -usb -vnc 127.0.0.1:0 -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4


test error_policy=stop
3: #virt-install -n demo2 -r 1024 --disk path=/tmp/demo2.img,size=4 --disk path=/dev/sda2,error_policy=stop -c /dev/cdrom --vnc --debug --force
....
<disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' error_policy='stop' io='native'/>
      <source dev='/dev/sda2'/>
....

#ps -ef | grep demo2qemu      5963     1  3 02:52 ?        00:00:06 /usr/libexec/qemu-kvm -S -M rhel6.2.0 -enable-kvm -m 1024 -smp 1,sockets=1,cores=1,threads=1 -name demo2 -uuid c09c1cc0-43c9-9b58-9372-1e643455ad7e -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/demo2.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-reboot -no-shutdown -drive file=/tmp/demo2.img,if=none,id=drive-ide0-0-0,format=raw,cache=none -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=2 -drive file=/dev/sda2,if=none,id=drive-ide0-0-1,format=raw,cache=none,werror=stop,rerror=stop,aio=native -device ide-drive,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 -drive file=/dev/cdrom,if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0,bootindex=1 -netdev tap,fd=23,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:4b:36:21,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -usb -vnc 127.0.0.1:0 -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4

test error_policy=ignore
for virt-install, both error_policy= none and ignore have error, i will open a virtinst bug for it, so test this manually ,edit xml for existing vm.
#virsh dumpxml demo
.....
<disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' error_policy='ignore' io='native'/>
      <source dev='/dev/sda2'/>
....
#ps -ef | grep demo
qemu      7038     1  9 03:07 ?        00:00:19 /usr/libexec/qemu-kvm -S -M rhel6.2.0 -enable-kvm -m 1024 -smp 1,sockets=1,cores=1,threads=1 -name demo -uuid 2f3c5809-ca3b-82ef-6a7b-c324550d1d5a -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/demo.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -drive file=/tmp/demo.img,if=none,id=drive-ide0-0-0,format=raw,cache=none -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -drive file=/dev/sda2,if=none,id=drive-ide0-0-1,format=raw,cache=none,werror=ignore,rerror=ignore,aio=native -device ide-drive,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 -drive if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -netdev tap,fd=23,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:30:a3:aa,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -usb -vnc 127.0.0.1:1 -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4

verification passed.
.....
Comment 12 errata-xmlrpc 2011-12-06 06:26:55 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2011-1513.html

Note You need to log in before you can comment on or make changes to this bug.