Bug 716826 - [libvirt] Cannot insert CD (update device) to VM when LIVE constant is not used in updateDeviceFlags command
Summary: [libvirt] Cannot insert CD (update device) to VM when LIVE constant is not us...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.1
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: rc
: ---
Assignee: Jiri Denemark
QA Contact: Virtualization Bugs
URL:
Whiteboard:
: 720183 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-06-27 08:27 UTC by Jakub Libosvar
Modified: 2011-12-06 11:15 UTC (History)
8 users (show)

Fixed In Version: libvirt-0.9.3-1.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-12-06 11:15:51 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1513 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2011-12-06 01:23:30 UTC

Description Jakub Libosvar 2011-06-27 08:27:04 UTC
Description of problem:
When attempting to change CD and updateDeviceFlags command is called without libvirt.VIR_DOMAIN_DEVICE_MODIFY_LIVE flag, device is not updated but finishes successfully.

Example script:

import libvirt

xml = '''<disk device="cdrom" type="file">
<source file=""/>
<target dev="hdc"/>
</disk>
'''

conn = libvirt.open('qemu:///system')
dom = conn.lookupByName('win7-32')
dom.updateDeviceFlags(xml, libvirt.VIR_DOMAIN_DEVICE_MODIFY_FORCE | libvirt.VIR_DOMAIN_DEVICE_MODIFY_LIVE) # Only this one succeeds
dom.updateDeviceFlags(xml, libvirt.VIR_DOMAIN_DEVICE_MODIFY_FORCE | libvirt.VIR_DOMAIN_DEVICE_MODIFY_CURRENT) # This one fails
dom.updateDeviceFlags(xml, libvirt.VIR_DOMAIN_DEVICE_MODIFY_FORCE) # This one fails too


Version-Release number of selected component (if applicable):
libvirt-0.9.2-1.el6.x86_64
qemu-kvm-0.12.1.2-2.165.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Attempt to change CD in VM using libvirt.VIR_DOMAIN_DEVICE_MODIFY_CURRENT flag (script above)

Actual results:
device is not updated

Expected results:
device is updated

Additional info:

Comment 2 Jiri Denemark 2011-06-27 09:28:36 UTC
Patch sent upstream: https://www.redhat.com/archives/libvir-list/2011-June/msg01332.html

Comment 3 Jiri Denemark 2011-06-27 10:14:39 UTC
The regression was introduced in 0.9.1 by

commit da1eba6bc8f58bfce34136710d1979a3a44adb17
Author: KAMEZAWA Hiroyuki <kamezawa.hiroyu.com>
Date:   Fri Apr 22 12:07:56 2011 +0900

    libvirt/qemu - support persistent modification of devices
    
    This patch adds functions for modify domain's persistent definition.
    To do error recovery in easy way, we use a copy of vmdef and update it.
    
    The whole sequence will be:
    
      make a copy of domain definition.
    
      if (flags & MODIFY_CONFIG)
          update copied domain definition
      if (flags & MODIF_LIVE)
          do hotplug.
      if (no error)
          save copied one to the file and update cached definition.
      else
          discard copied definition.

Comment 4 Jiri Denemark 2011-06-28 13:34:39 UTC
Fixed upstream by v0.9.3-rc1-9-gad7b327:

commit ad7b327690a85d9cf802d53f2c9f4f61db0171ee
Author: Jiri Denemark <jdenemar>
Date:   Mon Jun 27 11:25:19 2011 +0200

    qemu: Fix update device for CURRENT + FORCE flags
    
    When CURRENT and FORCE flags were used together, UpdateDeviceFlags did
    nothing because it failed to transform CURRENT into either LIVE or
    CONFIG.

Comment 7 Jiri Denemark 2011-07-11 08:58:05 UTC
*** Bug 720183 has been marked as a duplicate of this bug. ***

Comment 8 errata-xmlrpc 2011-12-06 11:15:51 UTC
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.