[libvirt] [PATCH 2/3] qemu: Separate calls based on controller bus type

Ján Tomko jtomko at redhat.com
Thu Nov 21 09:41:04 UTC 2013


On 11/21/2013 04:36 AM, Eric Farman wrote:
> For systems without a PCI bus, attaching a SCSI controller fails:
> 
>   [root at xxxxxxxx ~]# cat controller.xml
>   <controller type='scsi' model='virtio-scsi' index='0' />
>   [root at xxxxxxxx ~]# virsh attach-device guest01 controller.xml
>   error: Failed to attach device from controller.xml
>   error: XML error: No PCI buses available
> 
> A similar problem occurs with the detach of a controller:
> 
>   [root at xxxxxxxx ~]# virsh detach-device guest01 controller.xml
>   error: Failed to detach device from controller.xml
>   error: operation failed: controller scsi:0 not found
> 
> The qemuDomainXXtachPciControllerDevice routines made assumptions
> that any caller had a PCI bus.  These routines now selectively calls
> PCI functions where necessary, and assigns the device information
> type to one appropriate for the bus in use.
> 
> Signed-off-by: Eric Farman <farman at linux.vnet.ibm.com>
> ---
>  src/qemu/qemu_hotplug.c |   41 +++++++++++++++++++++++++++++++++--------
>  1 file changed, 33 insertions(+), 8 deletions(-)
> 

ACK and I've pushed the series with the following changes:

> +
> +        if (controller->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE ||
> +            controller->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
> +            if (qemuDomainPCIAddressEnsureAddr(priv->pciaddrs, &controller->info) < 0)
> +                goto cleanup;
> +        } else if (controller->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {

> +            if (qemuDomainCCWAddressAssign(&controller->info, priv->ccwaddrs, true) < 0)

I have changed this to:
 if (qemuDomainCCWAddressAssign(&controller->info, priv->ccwaddrs,
                                !controller->info.addr.ccw.assigned) < 0)
to prevent overwriting the user-requested address and match the other
CCWAddressAssign calls


> +                goto cleanup;
> +        }
>          releaseaddr = true;
>          if (qemuAssignDeviceControllerAlias(controller) < 0)
>              goto cleanup;



> +    }
> +
> +    if (detach->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&

s/!=/==/

> +        qemuIsMultiFunctionDevice(vm->def, &detach->info)) {
>          virReportError(VIR_ERR_OPERATION_FAILED,
>                         _("cannot hot unplug multifunction PCI device: %s"),
>                         dev->data.disk->dst);
> 

Jan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20131121/696ecb4e/attachment-0001.sig>


More information about the libvir-list mailing list