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 735909 - RFE: Allow to attach hostdev persistently
Summary: RFE: Allow to attach hostdev persistently
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.0
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: 7.0
Assignee: Libvirt Maintainers
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-09-06 06:44 UTC by yuping zhang
Modified: 2013-03-14 06:02 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-11-06 06:13:41 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description yuping zhang 2011-09-06 06:44:33 UTC
Description of problem:
Run virsh attach-device with --persistent option,it returns error with "persistent attach of device is not supported"

Version-Release number of selected component (if applicable):
libvirt-0.9.4-7.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1.Start a kvm guest
2.Prepare a pci-device xml as following:
# cat host.xml
<hostdev mode='subsystem' type='pci' managed='yes'>
      <source>
              <address domain='0x0000' bus='0x03' slot='0x00' function='0x1'/>
      </source>
</hostdev>

3.# virsh attach-device rhel5u6 host.xml --persistent
error: Failed to attach device from host.xml
error: unsupported configuration: persistent attach of device is not supported

Actual results:
As steps 3,attach-device doesn't support --persistent option

Expected results:
# virsh help attach-device
  NAME
    attach-device - attach device from an XML file

  SYNOPSIS
    attach-device<domain>  <file>  [--persistent]

  DESCRIPTION
    Attach device from an XML<file>.

  OPTIONS
    [--domain]<string>   domain name, id or uuid
    [--file]<string>   XML file
    --persistent     persist device attachment

attach-device with --persistent option works well

Additional info:
There is a bug 599325 about this issue,it closed duplicate of bug 598792 which has been verified with libvirt-0.9.1-1.el6.
So I file a new one only for command attach-device.

Comment 2 Alex Jia 2011-09-06 07:14:27 UTC
In fact, for qemu driver, the function qemuDomainAttachDeviceConfig only supports VIR_DOMAIN_DEVICE_DISK, VIR_DOMAIN_DEVICE_NET and VIR_DOMAIN_DEVICE_LEASE device types, when dev->type is VIR_DOMAIN_DEVICE_HOSTDEV, 'default' branch will be hit.

As document said, if attach-device supports --persistent option, the following codes should add 'VIR_DOMAIN_DEVICE_HOSTDEV' branch and implementation.

* src/qemu/qemu_driver.c:

static int
qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
                             virDomainDeviceDefPtr dev)
{
......
    switch (dev->type) {
    case VIR_DOMAIN_DEVICE_DISK:
        disk = dev->data.disk;
......
    case VIR_DOMAIN_DEVICE_NET:
        net = dev->data.net;
......
    case VIR_DOMAIN_DEVICE_LEASE:
        lease = dev->data.lease;
......
    default:
         qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                         _("persistent attach of device is not supported"));
......
}


Alex

Comment 3 Osier Yang 2011-09-15 09:32:58 UTC
This shouldn't be a bug, but a PFE. I change the title.

Comment 7 Dave Allan 2012-10-29 15:10:53 UTC
Guannan, if this is already implemented, go ahead and close it as CURRENTRELEASE.

Comment 8 Gunannan Ren 2012-11-06 06:13:41 UTC
This feature has been implemented with --config option.

  SYNOPSIS
    attach-device <domain> <file> [--config]


commit edb6fc3a7f0de4a4881862287b412b66b8153768
Author: Laine Stump <laine>
Date:   Wed Mar 7 16:05:34 2012 -0500

    qemu: support persistent hotplug of <hostdev> devices
    
    For some reason, although live hotplug of <hostdev> devices is
    supported, persistent hotplug is not. This patch adds the proper
    VIR_DOMAIN_DEVICE_HOSTDEV cases to the switches in
    qemuDomainAttachDeviceConfig and qemuDomainDetachDeviceConfig.


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