detach-interface success but domiflist still saw interface

Jiatong Shen yshxxsjt715 at gmail.com
Tue Nov 29 05:51:26 UTC 2022


Hello community,

   Sorry to bring this up again. I have found qemu monitor command qom-list
returned and compare it with live configuration under /var/run (attached at
the end).
qom-list returns only one disk while current xml got two. I tried to
restart libvirt container because I hope reconnect which
calls qemuProcessUpdateDevices
could fix current xml. But it does not.

  So my question is 1) should qemuProcessUpdateDevices remove gone devices
from current configuration? 2) what could I do without reboot virtual
machine?

Thank you,

Best,
Jiatong Shen

virsh # qemu-monitor-command instance-00000138 '{"execute": "qom-list",
"arguments": {"path": "/machine/peripheral"}}' --pretty
{
  "return": [
    {
      "name": "virtio-serial0",
      "type": "child<virtio-serial-pci>"
    },
    {
      "name": "type",
      "type": "string"
    },
    {
      "name": "input0",
      "type": "child<usb-tablet>"
    },
    {
      "name": "virtio-disk0",
      "type": "child<virtio-blk-pci>"
    },
    {
      "name": "balloon0",
      "type": "child<virtio-balloon-pci>"
    },
    {
      "name": "net1",
      "type": "child<virtio-net-pci>"
    },
    {
      "name": "net0",
      "type": "child<virtio-net-pci>"
    },
    {
      "name": "usb",
      "type": "child<piix3-usb-uhci>"
    },
    {
      "name": "serial0",
      "type": "child<isa-serial>"
    },
    {
      "name": "channel0",
      "type": "child<virtserialport>"
    },
    {
      "name": "video0",
      "type": "child<cirrus-vga>"
    }
  ],
  "id": "libvirt-255"
}



<domstatus state='running' reason='booted' pid='2613967'>
  <taint flag='custom-monitor'/>
  <taint flag='custom-ga-command'/>
  <monitor
path='/var/lib/libvirt/qemu/domain-111-instance-00000138/monitor.sock'
type='unix'/>
  <vcpus>
    <vcpu id='0' pid='2614006'/>
    <vcpu id='1' pid='2614008'/>
    <vcpu id='2' pid='2614009'/>
    <vcpu id='3' pid='2614010'/>
    <vcpu id='4' pid='2614011'/>
    <vcpu id='5' pid='2614012'/>
    <vcpu id='6' pid='2614013'/>
    <vcpu id='7' pid='2614014'/>
    <vcpu id='8' pid='2614015'/>
    <vcpu id='9' pid='2614016'/>
    <vcpu id='10' pid='2614017'/>
    <vcpu id='11' pid='2614018'/>
  </vcpus>
  <qemuCaps>
    <flag name='kvm'/>
    <flag name='mem-path'/>
    <flag name='drive-serial'/>
    <flag name='monitor-json'/>
    <flag name='sdl'/>
    <flag name='netdev'/>
    <flag name='rtc'/>
    <flag name='vhost-net'/>
    <flag name='no-hpet'/>
    <flag name='no-kvm-pit'/>
    <flag name='nodefconfig'/>
    <flag name='boot-menu'/>
    <flag name='fsdev'/>
    <flag name='name-process'/>
    <flag name='smbios-type'/>
    <flag name='spice'/>
    <flag name='vga-none'/>
    <flag name='boot-index'/>
    <flag name='hda-duplex'/>
    <flag name='drive-aio'/>
    <flag name='ccid-emulated'/>
    <flag name='ccid-passthru'/>
    <flag name='chardev-spicevmc'/>
    <flag name='virtio-tx-alg'/>
    <flag name='pci-multifunction'/>
    <flag name='virtio-blk-pci.ioeventfd'/>
    <flag name='sga'/>
    <flag name='virtio-blk-pci.event_idx'/>
    <flag name='virtio-net-pci.event_idx'/>
    <flag name='cache-directsync'/>
    <flag name='piix3-usb-uhci'/>
    <flag name='piix4-usb-uhci'/>
    <flag name='usb-ehci'/>
    <flag name='ich9-usb-ehci1'/>
    <flag name='vt82c686b-usb-uhci'/>
    <flag name='pci-ohci'/>
    <flag name='usb-redir'/>
    <flag name='usb-hub'/>
    <flag name='no-shutdown'/>
    <flag name='cache-unsafe'/>
    <flag name='ich9-ahci'/>
    <flag name='no-acpi'/>
    <flag name='fsdev-readonly'/>
    <flag name='virtio-blk-pci.scsi'/>
    <flag name='drive-copy-on-read'/>
    <flag name='fsdev-writeout'/>
    <flag name='drive-iotune'/>
    <flag name='system_wakeup'/>
    <flag name='scsi-disk.channel'/>
    <flag name='scsi-block'/>
    <flag name='transaction'/>
    <flag name='block-job-async'/>
    <flag name='scsi-cd'/>
    <flag name='ide-cd'/>
    <flag name='no-user-config'/>
    <flag name='hda-micro'/>
    <flag name='dump-guest-memory'/>
    <flag name='nec-usb-xhci'/>
    <flag name='balloon-event'/>
    <flag name='bridge'/>
    <flag name='lsi'/>
    <flag name='virtio-scsi-pci'/>
    <flag name='blockio'/>
    <flag name='disable-s3'/>
    <flag name='disable-s4'/>
    <flag name='usb-redir.filter'/>
    <flag name='ide-drive.wwn'/>
    <flag name='scsi-disk.wwn'/>
    <flag name='seccomp-sandbox'/>
    <flag name='reboot-timeout'/>
    <flag name='dump-guest-core'/>
    <flag name='seamless-migration'/>
    <flag name='block-commit'/>
    <flag name='vnc'/>
    <flag name='drive-mirror'/>
    <flag name='usb-redir.bootindex'/>
    <flag name='usb-host.bootindex'/>
    <flag name='blockdev-snapshot-sync'/>
    <flag name='qxl'/>
    <flag name='VGA'/>
    <flag name='cirrus-vga'/>
    <flag name='vmware-svga'/>
    <flag name='device-video-primary'/>
    <flag name='usb-serial'/>
    <flag name='usb-net'/>
    <flag name='add-fd'/>
    <flag name='nbd-server'/>
    <flag name='virtio-rng'/>
    <flag name='rng-random'/>
    <flag name='rng-egd'/>
    <flag name='dtb'/>
    <flag name='megasas'/>
    <flag name='ipv6-migration'/>
    <flag name='machine-opt'/>
    <flag name='machine-usb-opt'/>
    <flag name='tpm-passthrough'/>
    <flag name='tpm-tis'/>
    <flag name='pci-bridge'/>
    <flag name='vfio-pci'/>
    <flag name='vfio-pci.bootindex'/>
    <flag name='scsi-generic'/>
    <flag name='scsi-generic.bootindex'/>
    <flag name='mem-merge'/>
    <flag name='vnc-websocket'/>
    <flag name='drive-discard'/>
    <flag name='mlock'/>
    <flag name='vnc-share-policy'/>
    <flag name='device-del-event'/>
    <flag name='dmi-to-pci-bridge'/>
    <flag name='i440fx-pci-hole64-size'/>
    <flag name='q35-pci-hole64-size'/>
    <flag name='usb-storage'/>
    <flag name='usb-storage.removable'/>
    <flag name='virtio-mmio'/>
    <flag name='ich9-intel-hda'/>
    <flag name='kvm-pit-lost-tick-policy'/>
    <flag name='boot-strict'/>
    <flag name='pvpanic'/>
    <flag name='spice-file-xfer-disable'/>
    <flag name='spiceport'/>
    <flag name='usb-kbd'/>
    <flag name='host-pci-multidomain'/>
    <flag name='msg-timestamp'/>
    <flag name='active-commit'/>
    <flag name='change-backing-file'/>
    <flag name='memory-backend-ram'/>
    <flag name='numa'/>
    <flag name='memory-backend-file'/>
    <flag name='usb-audio'/>
    <flag name='rtc-reset-reinjection'/>
    <flag name='splash-timeout'/>
    <flag name='iothread'/>
    <flag name='migrate-rdma'/>
    <flag name='ivshmem'/>
    <flag name='drive-iotune-max'/>
    <flag name='VGA.vgamem_mb'/>
    <flag name='vmware-svga.vgamem_mb'/>
    <flag name='qxl.vgamem_mb'/>
    <flag name='pc-dimm'/>
    <flag name='machine-vmport-opt'/>
    <flag name='aes-key-wrap'/>
    <flag name='dea-key-wrap'/>
    <flag name='pci-serial'/>
    <flag name='vhost-user-multiqueue'/>
    <flag name='migration-event'/>
    <flag name='ioh3420'/>
    <flag name='x3130-upstream'/>
    <flag name='xio3130-downstream'/>
    <flag name='rtl8139'/>
    <flag name='e1000'/>
    <flag name='virtio-net'/>
    <flag name='gic-version'/>
    <flag name='incoming-defer'/>
    <flag name='virtio-gpu'/>
    <flag name='virtio-keyboard'/>
    <flag name='virtio-mouse'/>
    <flag name='virtio-tablet'/>
    <flag name='virtio-input-host'/>
    <flag name='chardev-file-append'/>
    <flag name='ich9-disable-s3'/>
    <flag name='ich9-disable-s4'/>
    <flag name='vserport-change-event'/>
    <flag name='virtio-balloon-pci.deflate-on-oom'/>
    <flag name='mptsas1068'/>
    <flag name='qxl.vram64_size_mb'/>
    <flag name='chardev-logfile'/>
    <flag name='debug-threads'/>
    <flag name='secret'/>
    <flag name='pxb'/>
    <flag name='pxb-pcie'/>
    <flag name='device-tray-moved-event'/>
    <flag name='nec-usb-xhci-ports'/>
    <flag name='virtio-scsi-pci.iothread'/>
    <flag name='name-guest'/>
    <flag name='qxl.max_outputs'/>
    <flag name='spice-unix'/>
    <flag name='drive-detect-zeroes'/>
    <flag name='tls-creds-x509'/>
    <flag name='display'/>
    <flag name='intel-iommu'/>
    <flag name='smm'/>
    <flag name='virtio-pci-disable-legacy'/>
    <flag name='query-hotpluggable-cpus'/>
    <flag name='virtio-net.rx_queue_size'/>
    <flag name='virtio-vga'/>
    <flag name='drive-iotune-max-length'/>
    <flag name='ivshmem-plain'/>
    <flag name='ivshmem-doorbell'/>
    <flag name='query-qmp-schema'/>
    <flag name='gluster.debug_level'/>
    <flag name='vhost-scsi'/>
    <flag name='drive-iotune-group'/>
    <flag name='query-cpu-model-expansion'/>
    <flag name='virtio-net.host_mtu'/>
    <flag name='nvdimm'/>
    <flag name='pcie-root-port'/>
    <flag name='query-cpu-definitions'/>
    <flag name='block-write-threshold'/>
    <flag name='query-named-block-nodes'/>
    <flag name='cpu-cache'/>
    <flag name='qemu-xhci'/>
    <flag name='kernel-irqchip'/>
    <flag name='kernel-irqchip.split'/>
    <flag name='intel-iommu.intremap'/>
    <flag name='intel-iommu.caching-mode'/>
    <flag name='intel-iommu.eim'/>
    <flag name='intel-iommu.device-iotlb'/>
    <flag name='virtio.iommu_platform'/>
    <flag name='virtio.ats'/>
    <flag name='loadparm'/>
    <flag name='vnc-multi-servers'/>
    <flag name='virtio-net.tx_queue_size'/>
    <flag name='chardev-reconnect'/>
    <flag name='virtio-gpu.max_outputs'/>
    <flag name='vxhs'/>
    <flag name='virtio-blk.num-queues'/>
    <flag name='vmcoreinfo'/>
    <flag name='numa.dist'/>
    <flag name='disk-share-rw'/>
    <flag name='iscsi.password-secret'/>
    <flag name='isa-serial'/>
  </qemuCaps>
  <devices>
    <device alias='virtio-serial0'/>
    <device alias='input0'/>
    <device alias='virtio-disk0'/>
    <device alias='balloon0'/>
    <device alias='net1'/>
    <device alias='net0'/>
    <device alias='usb'/>
    <device alias='serial0'/>
    <device alias='channel0'/>
    <device alias='video0'/>
  </devices>
  <libDir path='/var/lib/libvirt/qemu/domain-111-instance-00000138'/>
  <channelTargetDir
path='/var/lib/libvirt/qemu/channel/target/domain-111-instance-00000138'/>
  <allowReboot value='yes'/>
  <blockjobs active='no'/>
  <agentTimeout>-2</agentTimeout>
  <domain type='kvm' id='111'>
    <name>instance-00000138</name>
    <uuid>0b985bed-ebdd-4334-9477-19a5dab70eb1</uuid>
    <metadata>
      <nova:instance xmlns:nova="http://openstack.org/xmlns/libvirt/nova/1.0
">
        <nova:package version="18.2.3"/>
        <nova:name>VSA</nova:name>
        <nova:creationTime>2020-09-08 01:12:58</nova:creationTime>
        <nova:flavor name="ecs_12C64G200G">
          <nova:memory>65536</nova:memory>
          <nova:disk>200</nova:disk>
          <nova:swap>0</nova:swap>
          <nova:ephemeral>0</nova:ephemeral>
          <nova:vcpus>12</nova:vcpus>
        </nova:flavor>
        <nova:owner>
          <nova:user
uuid="9ec899ea3a4144dcbc6dccacc1e36645">admin</nova:user>
          <nova:project
uuid="f689fa41de3641cb8e4a98046268aa48">HBS</nova:project>
        </nova:owner>
      </nova:instance>
    </metadata>
    <memory unit='KiB'>67108864</memory>
    <currentMemory unit='KiB'>67108864</currentMemory>
    <vcpu placement='static'>12</vcpu>
    <cputune>
      <shares>12288</shares>
    </cputune>
    <resource>
      <partition>/machine</partition>
    </resource>
    <sysinfo type='smbios'>
      <system>
        <entry name='manufacturer'>OpenStack Foundation</entry>
        <entry name='product'>OpenStack Nova</entry>
        <entry name='version'>18.2.3</entry>
        <entry name='uuid'>0b985bed-ebdd-4334-9477-19a5dab70eb1</entry>
        <entry name='family'>Virtual Machine</entry>
      </system>
    </sysinfo>
    <os>
      <type arch='x86_64' machine='pc-i440fx-bionic'>hvm</type>
      <boot dev='hd'/>
      <smbios mode='sysinfo'/>
    </os>
    <features>
      <acpi/>
      <apic/>
      <hyperv>
        <relaxed state='on'/>
        <vapic state='on'/>
        <spinlocks state='on' retries='8191'/>
      </hyperv>
    </features>
    <cpu mode='custom' match='exact' check='full'>
      <model fallback='forbid'>Skylake-Client-IBRS</model>
      <vendor>Intel</vendor>
      <topology sockets='12' cores='1' threads='1'/>
      <feature policy='require' name='ss'/>
      <feature policy='require' name='hypervisor'/>
      <feature policy='require' name='tsc_adjust'/>
      <feature policy='require' name='md-clear'/>
      <feature policy='require' name='ssbd'/>
      <feature policy='require' name='pdpe1gb'/>
      <feature policy='disable' name='mpx'/>
      <feature policy='disable' name='xsavec'/>
      <feature policy='disable' name='xgetbv1'/>
    </cpu>
    <clock offset='localtime'>
      <timer name='pit' tickpolicy='delay'/>
      <timer name='rtc' tickpolicy='catchup'/>
      <timer name='hpet' present='no'/>
      <timer name='hypervclock' present='yes'/>
    </clock>
    <on_poweroff>destroy</on_poweroff>
    <on_reboot>restart</on_reboot>
    <on_crash>destroy</on_crash>
    <devices>
      <emulator>/usr/bin/qemu-system-x86_64</emulator>
      <disk type='network' device='disk'>
        <driver name='qemu' type='raw' cache='writeback' discard='unmap'/>
        <auth username='cinder_eafdd9d8-8fe3-40d1-8fbe-fc81f96f1fd6'>
          <secret type='ceph' uuid='eafdd9d8-8fe3-40d1-8fbe-fc81f96f1fd6'/>
        </auth>
        <source protocol='rbd' name='' tlsFromConfig='0'>
          <privateData>
            <nodenames>
              <nodename type='storage' name='#block034'/>
              <nodename type='format' name='#block104'/>
            </nodenames>
            <objects>
              <secret type='auth' alias='virtio-disk0-secret0'/>
            </objects>
          </privateData>
        </source>
        <target dev='vda' bus='virtio'/>
        <alias name='virtio-disk0'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x06'
function='0x0'/>
      </disk>
      <disk type='network' device='disk'>
        <driver name='qemu' type='raw' cache='writeback' discard='unmap'/>
        <auth username='cinder_eafdd9d8-8fe3-40d1-8fbe-fc81f96f1fd6'>
          <secret type='ceph' uuid='eafdd9d8-8fe3-40d1-8fbe-fc81f96f1fd6'/>
        </auth>
        <source protocol='rbd' name='cinder.volumes' tlsFromConfig='0'>
          <privateData>
            <objects>
              <secret type='auth' alias='virtio-disk7-secret0'/>
            </objects>
          </privateData>
        </source>
        <target dev='vdh' bus='virtio'/>
        <alias name='virtio-disk7'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x0e'
function='0x0'/>
      </disk>
      <controller type='usb' index='0' model='piix3-uhci'>
        <alias name='usb'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x01'
function='0x2'/>
      </controller>
      <controller type='pci' index='0' model='pci-root'>
        <alias name='pci.0'/>
      </controller>
      <controller type='virtio-serial' index='0'>
        <alias name='virtio-serial0'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x05'
function='0x0'/>
      </controller>
      <interface type='bridge'>
        <mac address='fa:16:3e:40:1a:19'/>
        <source bridge='qbrfbca49dd-ad'/>
        <target dev='tapfbca49dd-ad'/>
        <model type='virtio'/>
        <mtu size='1550'/>
        <alias name='net0'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x03'
function='0x0'/>
      </interface>
      <interface type='bridge'>
        <mac address='fa:16:3e:11:ee:66'/>
        <source bridge='qbrdb246b9f-79'/>
        <target dev='tapdb246b9f-79'/>
        <model type='virtio'/>
        <mtu size='1500'/>
        <alias name='net1'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x04'
function='0x0'/>
      </interface>
      <serial type='pty'>
        <source path='/dev/pts/11'/>
        <log
file='/var/lib/nova/instances/0b985bed-ebdd-4334-9477-19a5dab70eb1/console.log'
append='off'/>
        <target type='isa-serial' port='0'>
          <model name='isa-serial'/>
        </target>
        <alias name='serial0'/>
      </serial>
      <console type='pty' tty='/dev/pts/11'>
        <source path='/dev/pts/11'/>
        <log
file='/var/lib/nova/instances/0b985bed-ebdd-4334-9477-19a5dab70eb1/console.log'
append='off'/>
        <target type='serial' port='0'/>
        <alias name='serial0'/>
      </console>
      <channel type='unix'>
        <source mode='bind'
path='/var/lib/libvirt/qemu/org.qemu.guest_agent.0.instance-00000138.sock'/>
        <target type='virtio' name='org.qemu.guest_agent.0'
state='disconnected'/>
        <alias name='channel0'/>
        <address type='virtio-serial' controller='0' bus='0' port='1'/>
      </channel>
      <input type='tablet' bus='usb'>
        <alias name='input0'/>
        <address type='usb' bus='0' port='1'/>
      </input>
      <input type='mouse' bus='ps2'>
        <alias name='input1'/>
      </input>
      <input type='keyboard' bus='ps2'>
        <alias name='input2'/>
      </input>
      <graphics type='vnc' port='5911' autoport='yes'
websocketGenerated='no' listen='0.0.0.0'>
        <listen type='address' address='0.0.0.0' fromConfig='0'
autoGenerated='no'/>
      </graphics>
      <video>
        <model type='cirrus' vram='16384' heads='1' primary='yes'/>
        <alias name='video0'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x02'
function='0x0'/>
      </video>
      <memballoon model='virtio'>
        <stats period='10'/>
        <alias name='balloon0'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x07'
function='0x0'/>
      </memballoon>
    </devices>
    <seclabel type='dynamic' model='dac' relabel='yes'>
      <label>+42424:+104</label>
      <imagelabel>+42424:+104</imagelabel>
    </seclabel>
  </domain>
</domstatus>



On Mon, Nov 28, 2022 at 4:43 PM Jiatong Shen <yshxxsjt715 at gmail.com> wrote:

> Thank you very much for the reply. But the interesting thing is that qemu
> monitoring
> command info blocks returns the specified device has been detached while
> virsh domblklist
> still displays the device. So does this imply qemu does not reply to
> libvirt when the device is
> detached?
>
> Best,
> Jiatong Shen
>
> On Thu, Nov 24, 2022 at 10:58 PM Peter Krempa <pkrempa at redhat.com> wrote:
>
>> On Thu, Nov 24, 2022 at 16:47:48 +0800, Jiatong Shen wrote:
>> > Hello Commnunity,
>> >
>> > I saw an weird situation on a phytium machine (arm64 v8),  after the
>> > following commands, I can still see the interface which should be
>> > successfully detached.
>> >
>> > virsh # detach-interface 4a365b06-2597-4c17-8b44-dbb6953f9ced bridge
>> --mac
>> > fa:16:3e:c5:62:40
>> > Interface detached successfully
>> >
>> > Future qmp commands shows, that a device hostnet23 exists but seems no
>> > front end device exists.
>> >
>> > So what could be the problem? Thank you very much.
>>
>> The man page for virsh states for the 'detach-interface' command:
>>
>>  "Please see documentation for detach-device for known quirks."
>>
>> And the 'quirks' part of 'detach-device':
>>
>>   Quirk:  Device  unplug is asynchronous in most cases and requires guest
>>   cooperation. This means that it's up to the discretion of the guest  to
>>   disallow  or  delay  the unplug arbitrarily. As the libvirt API used in
>>   this command was designed as synchronous it returns success after  some
>>   timeout  even  if the device was not unplugged yet to allow further in‐
>>   teractions with the domain e.g. if the guest is  unresponsive.  Callers
>>   which  need  to make sure that the device was unplugged can use libvirt
>>   events (see virsh event) to be notified when  the  device  is  removed.
>>   Note that the event may arrive before the command returns.
>>
>>
>
> --
>
> Best Regards,
>
> Jiatong Shen
>


-- 

Best Regards,

Jiatong Shen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20221129/1c1a2656/attachment-0001.htm>


More information about the libvirt-users mailing list