<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>hi, ALL:<br></div><div>my question description as follow:<br><h1 class="word" style="box-sizing: border-box; margin: 0px; padding: 0px; font-size: 14px; font-family: AvertaStd-semibold, tahoma, 'Microsoft YaHei', '\\5FAEÈíÑźÚ', '\\5B8BÌå', 'Malgun Gothic', sans-serif; color: rgb(51, 51, 51); height: auto; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: 14px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><span class="basic-word" style="box-sizing: border-box; margin-right: 8px; display: inline-block; max-width: 80%; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; font-size: 30px; line-height: 35px;"><br></span></h1></div><div>virsh dumpxml root-vsys_v2  > v2.xml ,   <br></div><div> in the v2.xml has the following information:<br></div><div>    <disk type='file' device='disk'><br>      <driver name='qemu' type='qcow2'/><br>      <source file='/home/root-vsys_v2.qcow2'/><br>      <backingStore/><br>      <target dev='<span style="color: rgb(221, 64, 50);">hda</span>' bus='<span style="color: rgb(221, 64, 50);">ide</span>'/>  <span style="color: rgb(221, 64, 50);"><b>// i want change the 'ide' to 'virtio', but fail</b></span><br>      <alias name='ide0-0-0'/><br>      <address type='drive' controller='0' bus='0' target='0' unit='0'/><br>    </disk><br></div><div><br></div><div>so i create a new xml name v2-new.xml ,it content is:<br></div>    <disk type='file' device='disk'><br>      <driver name='qemu' type='qcow2'/><br>      <source file='/home/root-vsys_v2.qcow2'/><br>      <target dev='<span style="color: rgb(221, 64, 50);">vda</span>' bus='<span style="color: rgb(221, 64, 50);">virtio</span>'/><br>    </disk><br><div><br></div><div>then run:</div><div>virsh update-device root-vsys_v2 /root/v2-new.xml  --live <br></div><div>the result is:</div><div>[root@NSG ~]# virsh update-device root-vsys_v2 /root/v2-new.xml  --live<br>error: Failed to update device from /root/v2-new.xml<br>error: internal error: No device with bus 'virtio' and target 'vda'</div><div><br></div><div>i read the source code for libvirt ,the log outprint at funcion:</div><div>static int<br>qemuDomainChangeDiskLive(virDomainObjPtr vm,<br>                         virDomainDeviceDefPtr dev,<br>                         virQEMUDriverPtr driver,<br>                         bool force)<br>{<br>    virDomainDiskDefPtr disk = dev->data.disk;<br>    virDomainDiskDefPtr orig_disk = NULL;<br>    virDomainDeviceDef oldDev = { .type = dev->type };<br>    int ret = -1;<br><br>    if (!(orig_disk = virDomainDiskFindByBusAndDst(vm->def,<br>                                                   disk->bus, disk->dst))) {<br>        virReportError(VIR_ERR_INTERNAL_ERROR,<br>                       _("No device with bus '%s' and target '%s'"),<br>                       virDomainDiskBusTypeToString(disk->bus),<br>                       disk->dst); <span style="color: rgb(221, 64, 50);"><b>//the failure log is here, the vm->def has disk item :dev = hda, bus=ide ,and disk->bus = virtio disk->dst=vda,</b> </span><br>        goto cleanup;<br>    }<br></div><div><span style="color: rgb(221, 64, 50);"><b>//the disk->bus and disk->dst can't in the vm->def ,so the api virDomainDiskFindByBusAndDst failed</b></span><br>    oldDev.data.disk = orig_disk;<br>    if (virDomainDefCompatibleDevice(vm->def, dev, &oldDev,<br>                                     VIR_DOMAIN_DEVICE_ACTION_UPDATE,<br>                                     true) < 0)<br>        goto cleanup;<br><br>    if (!qemuDomainDiskChangeSupported(disk, orig_disk))<br>        goto cleanup;<br><br>    if (!virStorageSourceIsSameLocation(disk->src, orig_disk->src)) {<br>        /* Disk source can be changed only for removable devices */<br>        if (disk->device != VIR_DOMAIN_DISK_DEVICE_CDROM &&<br>            disk->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY) {<br>            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",<br>                           _("disk source can be changed only in removable "<br>                             "drives"));<br>            goto cleanup;<br>        }<br><br>        if (qemuDomainAttachDeviceDiskLive(driver, vm, dev, force) < 0)<br>            goto cleanup;<br>    }<br><br>    orig_disk->startupPolicy = dev->data.disk->startupPolicy;<br>    orig_disk->snapshot = dev->data.disk->snapshot;<br><br>    ret = 0;<br> cleanup:<br>    return ret;<br>}<br></div><div><br></div><div>what  reason lead the faiure ? is my v2-new.xml write error ? how to write the xml for virsh update-device ? <br></div><div><br></div><div><br></div><div><br></div><div>i refer the link <br></div><div>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<br></div><br><div style="position:relative;zoom:1">--------------------------</div><div style="position:relative;zoom:1">thanks !</div><div style="position:relative;zoom:1">thosmas.kuang<br><div style="clear:both"></div></div></div><br><br><span title="neteasefooter"><p> </p></span>