hi, ALL:
my question description as follow:


virsh dumpxml root-vsys_v2  > v2.xml ,  
 in the v2.xml has the following information:
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/home/root-vsys_v2.qcow2'/>
      <backingStore/>
      <target dev='hda' bus='ide'/>  // i want change the 'ide' to 'virtio', but fail
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

so i create a new xml name v2-new.xml ,it content is:
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/home/root-vsys_v2.qcow2'/>
      <target dev='vda' bus='virtio'/>
    </disk>

then run:
virsh update-device root-vsys_v2 /root/v2-new.xml  --live
the result is:
[root@NSG ~]# virsh update-device root-vsys_v2 /root/v2-new.xml  --live
error: Failed to update device from /root/v2-new.xml
error: internal error: No device with bus 'virtio' and target 'vda'

i read the source code for libvirt ,the log outprint at funcion:
static int
qemuDomainChangeDiskLive(virDomainObjPtr vm,
                         virDomainDeviceDefPtr dev,
                         virQEMUDriverPtr driver,
                         bool force)
{
    virDomainDiskDefPtr disk = dev->data.disk;
    virDomainDiskDefPtr orig_disk = NULL;
    virDomainDeviceDef oldDev = { .type = dev->type };
    int ret = -1;

    if (!(orig_disk = virDomainDiskFindByBusAndDst(vm->def,
                                                   disk->bus, disk->dst))) {
        virReportError(VIR_ERR_INTERNAL_ERROR,
                       _("No device with bus '%s' and target '%s'"),
                       virDomainDiskBusTypeToString(disk->bus),
                       disk->dst); //the failure log is here, the vm->def has disk item :dev = hda, bus=ide ,and disk->bus = virtio disk->dst=vda,
        goto cleanup;
    }
//the disk->bus and disk->dst can't in the vm->def ,so the api virDomainDiskFindByBusAndDst failed
    oldDev.data.disk = orig_disk;
    if (virDomainDefCompatibleDevice(vm->def, dev, &oldDev,
                                     VIR_DOMAIN_DEVICE_ACTION_UPDATE,
                                     true) < 0)
        goto cleanup;

    if (!qemuDomainDiskChangeSupported(disk, orig_disk))
        goto cleanup;

    if (!virStorageSourceIsSameLocation(disk->src, orig_disk->src)) {
        /* Disk source can be changed only for removable devices */
        if (disk->device != VIR_DOMAIN_DISK_DEVICE_CDROM &&
            disk->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                           _("disk source can be changed only in removable "
                             "drives"));
            goto cleanup;
        }

        if (qemuDomainAttachDeviceDiskLive(driver, vm, dev, force) < 0)
            goto cleanup;
    }

    orig_disk->startupPolicy = dev->data.disk->startupPolicy;
    orig_disk->snapshot = dev->data.disk->snapshot;

    ret = 0;
 cleanup:
    return ret;
}

what  reason lead the faiure ? is my v2-new.xml write error ? how to write the xml for virsh update-device ?



i refer the link
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/virtualization_host_configuration_and_guest_installation_guide/form-virtualization_host_configuration_and_guest_installation_guide-para_virtualized_drivers-using_kvm_para_virtualized_drivers_for_existing_devices

--------------------------
thanks !
thosmas.kuang