[libvirt] [PATCH] update domain status forcibly even if attach a device failed

Eric Blake eblake at redhat.com
Thu Feb 17 21:09:12 UTC 2011


On 02/16/2011 08:32 PM, Wen Congyang wrote:
> Steps to reproduce this bug:
> 1. virsh attach-disk domain --source diskimage --target sdb --sourcetype file --driver qemu --subdriver qcow2
>    error: Failed to attach disk
>    error: operation failed: adding scsi-disk,bus=scsi0.0,scsi-id=1,drive=drive-scsi0-0-1,id=scsi0-0-1 device failed: Property 'scsi-disk.drive' can't find value 'drive-scsi0-0-1'
> 2. service libvirtd restart
>    Stopping libvirtd daemon:                                  [  OK  ]
>    Starting libvirtd daemon:                                  [  OK  ]
> 3. virsh attach-disk domain --source diskimage --target sdb --sourcetype file --driver qemu --subdriver raw  
>    error: Failed to attach disk
>    error: operation failed: adding lsi,id=scsi0,bus=pci.0,addr=0x6 device failed: Duplicate ID 'scsi0' for device
> 
> The reason is that we create a new scsi controller but we do not update
> /var/run/libvirt/qemu/domain.xml.

I agree that this is a bug, and that this patch is one way to solve
things; however, I'm not convinced it's necessarily the right way.

Should we be instead rolling back and undoing the new controller
creation if adding the device fails?

Should the successful addition of a controller save domain state at that
point, even though that means two saves instead of one if this succeeds
here?

But, if others agree with this approach, then ACK to the code.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

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


More information about the libvir-list mailing list