Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 921407

Summary: virsh update-device with option "--config" should not be affect before boot
Product: Red Hat Enterprise Linux 6 Reporter: Xuesong Zhang <xuzhang>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.4CC: acathrow, cevich, cwei, dyuan, jmiao, mzhan
Target Milestone: rcKeywords: Upstream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 921398 Environment:
Last Closed: 2014-04-04 20:58:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 921398, 1049529, 1125194    
Bug Blocks:    

Description Xuesong Zhang 2013-03-14 07:10:20 UTC
+++ This bug was initially created as a clone of Bug #921398 +++

Description of problem:
virsh update-device with option "--config" should not be affect before next boot

Version-Release number of selected component (if applicable):
libvirt-0.10.2-18.el6.x86_64
qemu-img-rhev-0.12.1.2-2.356.el6_4.2.x86_64
kernel-2.6.32-358.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
 1. prepare one running health guest, make sure it contains the CDROM device:
 #virsh list --all
 Id    Name                           State
 ----------------------------------------------------
 3     mig2                           running

 #virsh dumpxml mig2
 ......
    <disk type='file' device='cdrom'
      <driver name='qemu' type='raw'/
      <source file='/var/lib/libvirt/images/temp1.iso'/
      <target dev='hdc' bus='ide'/
      <readonly/
      <alias name='ide0-1-0'/
      <address type='drive' controller='0' bus='1' target='0' unit='0'/
    </disk

 ......

 2. prepare one xml file like the following one, which the source file is changed:
 #cat cdrom2.xml
   <disk type='file' device='cdrom'
      <driver name='qemu' type='raw'/
      <source file='/var/lib/libvirt/images/temp2.iso'/
      <target dev='hdc' bus='ide'/
      <readonly/
      <alias name='ide0-1-0'/
    </disk
 3.virsh update-device mig2 cdrom2.xml --config
 Device updated successfully

 4. check the dumpxml before boot, the source file is changed before boot.
 #virsh dumpxml mig2
 ......
    <disk type='file' device='cdrom'
      <driver name='qemu' type='raw'/
      <source file='/var/lib/libvirt/images/temp2.iso'/
      <target dev='hdc' bus='ide'/
      <readonly/
      <alias name='ide0-1-0'/
      <address type='drive' controller='0' bus='1' target='0' unit='0'/
    </disk

 ......

 5. check the help of update-device command, it said the domain should be affect next boot if run command with option "--config".
 #virsh help update-device
  NAME
    update-device - update device from an XML file

  SYNOPSIS
    update-device <domain <file [--config] [--force]

  DESCRIPTION
    Update device from an XML <file.

  OPTIONS
    [--domain] <stringdomain name, id or uuid
    [--file] <stringXML file
    --config         affect next boot
    --force          force device update
  
Actual results:
domain is affected before boot

Expected results:
domain should be affected after boot

Additional info:

Comment 1 Peter Krempa 2013-04-02 14:34:00 UTC
Fixed upstream with:

commit 69ce3ffa8d431e9810607c6e00b7cfcc481b491d
Author: Peter Krempa <pkrempa>
Date:   Fri Mar 15 17:11:28 2013 +0100

    virsh: Fix semantics of --config for "update-device" command
    
    The man page states that with --config the next boot is affected. This
    can be understood as if _only_ the next boot was affected. This isn't
    true if the machine is running.
    
    This patch adds the full --live, --config, --current infrastructure and
    tweaks stuff to correctly support the obsolete --persistent flag.
    
    Note that this patch changes the the behavior of the --config flag to match the
    use of this flag in rest of libvirt. This flag was mistakenly renamed from
    --persistent that originaly had different semantics.

and a few cleanup commits before.

v1.0.4-16-gb685a73

Comment 5 Jiri Denemark 2014-03-31 14:46:42 UTC
*** Bug 961443 has been marked as a duplicate of this bug. ***

Comment 7 RHEL Program Management 2014-04-04 20:58:24 UTC
Development Management has reviewed and declined this request.
You may appeal this decision by reopening this request.

Comment 8 Xuesong Zhang 2014-06-04 13:56:57 UTC
FYI: The --config is also not working well with attach-disk/detach-disk.

Package version:
libvirt-0.10.2-37.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.427.el6.x86_64
kernel-2.6.32-472.el6.x86_64

Steps:
1. Start a domain: 
# virsh start demo

2. Create a image to attach
# qemu-img create  foo.img 10M

3. Attach a virtio disk with --config
# virsh attach-disk demo /var/lib/libvirt/images/foo.img vdb --config

4. Check the dumpxml, the new disk is added to the dumpxml
# virsh dumpxml demo
......
 <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/foo.img'/>
      <target dev='vdb' bus='virtio'/>
      <alias name='virtio-disk1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </disk>
......

5. Restart domain and then check domain's dumpxml, the disk is still in the dumpxml.
# virsh destroy demo
# virsh start demo
# virsh dumpxml demo
......
 <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/foo.img'/>
      <target dev='vdb' bus='virtio'/>
      <alias name='virtio-disk1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </disk>
......


6. Dettach a virtio disk with --config 
# virsh detach-disk demo vdb --config
7. Check the dumpxml, the disk is removed from the dumpxml, can't find the disk.
# virsh dumpxml demo
......

Actual results:
As step 4 and 7

Expected results:
As step 4 and 7, if use --config, the disk should be added/removed after guest restart.

Addtional info:
Do not meet this issue in the latest rhel7 env.