Re: A issue of virt-Manager, ​looking forward to your reply,thanks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Hi Qi Chen,

(CCing virt-tools-list@xxxxxxxxxx in case I say something wrong)

On 7/6/22 01:14, 陈奇 wrote:
Dear Developer:
     How does Virt-Manager persistently attach and detach the virtio disks when
a VM is started and shutdown ?  Which interface of libvirt does virt-Manager call?

I'm not following whether you asked about attach/detach live (when the VM is
running) or offline (with the VM shutdown). For the latter it's trivial:
virt-manager will simply edit the domain XML with any extra virtio disks
you want.

For the live case, in virtManager/

            if controller is not None:

attach_device() is defined here, in virtManager/object/

    def attach_device(self, devobj):
        Hotplug device to running guest
        if not self.is_active():

        devxml = devobj.get_xml()
        log.debug("attach_device with xml=\n%s", devxml)

attachDevice() is a libvirt python binding to virDomainAttachDevice, which
is defined here:

The behavior is hypervisor dependent. For QEMU, this function is implemented
in libvirt at src/qemu/qemu_driver.c, qemuDomainAttachDevice(). Note that,
for the QEMU driver, since virt-manager does not use the API that passes
the CONFIG flag, hotplugged devices will not persist when the VM is

If you're working with any other hypervisor, grep libvirt code for
'domainAttachDevice' and see the matches with the files that belongs to the
hypervisor driver you're using.

Hope this answers your question. I also encourage you to subscribe to the
virt-manager mailing list in case you have more questions about
virt-manager APIs and so on:

You'll have more success in getting answers by asking the mailing list than
asking individual developers.



      Looking forward to your reply,thanks.
                                                                                                     Qi Chen

[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux