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 1598087 - Improve documentation description for 'virsh detach-device-alias' cmd
Summary: Improve documentation description for 'virsh detach-device-alias' cmd
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.6
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: jiyan
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-04 10:11 UTC by jiyan
Modified: 2018-10-30 09:58 UTC (History)
8 users (show)

Fixed In Version: libvirt-4.5.0-2.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-30 09:57:31 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2018:3113 0 None None None 2018-10-30 09:58:30 UTC

Description jiyan 2018-07-04 10:11:46 UTC
Description of problem:
'virsh detach-device-alias' should report failure when detaching memory failed

Version-Release number of selected component (if applicable):
kernel-3.10.0-918.el7.x86_64
qemu-kvm-rhev-2.12.0-6.el7.x86_64
libvirt-4.5.0-1.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Prepare a running VM with the following configuration and the XML file
# virsh domstate b1
running

# virsh dumpxml b1
  <maxMemory slots='16' unit='KiB'>2124800</maxMemory>
  <memory unit='KiB'>1155072</memory>
  <currentMemory unit='KiB'>917504</currentMemory>
  <cpu mode='custom' match='exact' check='full'>
    <numa>
      <cell id='0' cpus='0-7' memory='512000' unit='KiB'/>
      <cell id='1' cpus='8-15' memory='512000' unit='KiB'/>
    </numa>
  </cpu>
  <device>
    <memory model='dimm'>
      <source>
        <nodemask>0</nodemask>
        <pagesize unit='KiB'>2048</pagesize>
      </source>
      <target>
        <size unit='KiB'>131072</size>
        <node>1</node>
      </target>
      <alias name='ua-9874229d-d867-4932-ad28-279e9a777f42'/>
      <address type='dimm' slot='1' base='0x100000000'/>
    </memory>
  </device>

# cat memory.xml 
    <memory model='dimm'>
      <source>
        <nodemask>0</nodemask>
        <pagesize unit='KiB'>2048</pagesize>
      </source>
      <target>
        <size unit='KiB'>131072</size>
        <node>1</node>
      </target>
      <alias name='ua-9874229d-d867-4932-ad28-279e9a777f42'/>
      <address type='dimm' slot='1' base='0x100000000'/>
    </memory>

2. Detach memory device through 'virsh detach-device'
# virsh detach-device b1 memory.xml 
error: Failed to detach device from memory.xml
error: operation failed: unplug of device was rejected by the guest

# virsh dumpxml b1 |grep "<memory m" -A11
    <memory model='dimm'>
      <source>
        <nodemask>0</nodemask>
        <pagesize unit='KiB'>2048</pagesize>
      </source>
      <target>
        <size unit='KiB'>131072</size>
        <node>1</node>
      </target>
      <alias name='ua-9874229d-d867-4932-ad28-279e9a777f42'/>
      <address type='dimm' slot='1' base='0x100000000'/>
    </memory>

3. Detach memory device through 'virsh detach-device-alias'
# virsh detach-device-alias b1 ua-9874229d-d867-4932-ad28-279e9a777f42
Device detach request sent successfully

# virsh dumpxml b1 |grep "<memory m" -A11
    <memory model='dimm'>
      <source>
        <nodemask>0</nodemask>
        <pagesize unit='KiB'>2048</pagesize>
      </source>
      <target>
        <size unit='KiB'>131072</size>
        <node>1</node>
      </target>
      <alias name='ua-9874229d-d867-4932-ad28-279e9a777f42'/>
      <address type='dimm' slot='1' base='0x100000000'/>
    </memory>

Actual results:
As step-3 shows

Expected results:
As step-2 shows

Additional info:
Bug 1320447 - [RFE] Report memory hotunplug failure​

Comment 2 Michal Privoznik 2018-07-04 10:19:21 UTC
I don't think this is a bug. The documentation states:

 * In contrast to virDomainDetachDeviceFlags() this API is
 * asynchronous - it returns immediately after sending the detach
 * request to the hypervisor. It's caller's responsibility to
 * wait for VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED event to signal
 * actual device removal.

Comment 3 Jiri Denemark 2018-07-04 10:29:17 UTC
Right, the caller should get VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED event
in this case. I think we should improve the documentation to mention this
event too.

Comment 4 Michal Privoznik 2018-07-04 11:55:19 UTC
Okay. Patch proposed upstream:

https://www.redhat.com/archives/libvir-list/2018-July/msg00271.html

Comment 6 jiyan 2018-07-05 01:32:28 UTC
Hi Michal, got it.
And there is another doc problem. Could you please modify it? 

# man virsh
       detach-device-alias domain alias [[[--live] [--config] | [--current]] | [--persistent]]
           Detach a device with given alias from the domain.

           If --live is specified, affect a running domain.  If --config is specified, affect the next startup of a persistent domain.  If
           --current is specified, affect the current domain state.  Both --live and --config flags may be given, but --current is exclusive.

# virsh detach-device-alias b1 ua-9874229d-d867-4932-ad28-279e9a777f37 --persistent
error: command 'detach-device-alias' doesn't support option --persistent

Comment 9 jiyan 2018-07-10 01:31:03 UTC
Verified in libvirt-4.5.0-2.el7.x86_64.
The two problems have already been fixed, move this bug to be verified.

Comment 11 errata-xmlrpc 2018-10-30 09:57:31 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.

https://access.redhat.com/errata/RHSA-2018:3113


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