[CentOS-virt] virsh doesn't support vtpm using XEN?

Fri Sep 14 13:28:44 UTC 2018
Dag Nygren <dag at newtech.fi>

Hi again!

More TPM + XEN stuff.

have look at the following:

================= "xl list -l centos7.0" ==============
[
    {
        "domid": 31,
        "config": {
            "c_info": {
                "type": "hvm",
                "name": "centos7.0",
                "uuid": "feef6cac-8148-4040-a7cb-ad1f82d8d68a",
                "run_hotplug_scripts": "True"
            },
            "b_info": {
                "max_vcpus": 4,
                "avail_vcpus": [
                    0,
                    1,
                    2,
                    3
                ],
                "max_memkb": 4194304,
                "target_memkb": 4194304,
                "video_memkb": 8192,
                "shadow_memkb": 36864,
                "localtime": "False",
                "sched_params": {

                },
                "claim_mode": "True",
                "acpi": "True",
                "type.hvm": {
                    "pae": "True",
                    "apic": "True",
                    "viridian": "False",
                    "vga": {

                    },
                    "vnc": {
                        "enable": "True",
                        "listen": "127.0.0.1",
                        "findunused": "True"
                    },
                    "keymap": "en-us",
                    "sdl": {
                        "enable": "False"
                    },
                    "spice": {

                    },
                    "serial": "pty",
                    "boot": "c",
                    "usb": "True",
                    "usbdevice": "tablet",
                    "rdm": {

                    }
                },
                "arch_arm": {

                }
            },
            "disks": [
                {
                    "pdev_path": "/dev/node_b_vg/testimage",
                    "vdev": "hda",
                    "format": "raw",
                    "readwrite": 1,
                    "colo_restore_enable": "False"
                }
            ],
            "nics": [
                {
                    "devid": 0,
                    "mac": "00:16:3e:7c:04:3a",
                    "bridge": "bc_br0",
                    "script": "vif-bridge",
                    "nictype": "vif_ioemu"
                },
                {
                    "devid": 1,
                    "mac": "00:16:3e:b4:c1:c6",
                    "bridge": "mgmt_br0",
                    "script": "vif-bridge",
                    "nictype": "vif_ioemu"
                },
                {
                    "devid": 2,
                    "mac": "00:16:3e:3a:78:01",
                    "bridge": "dsip_int_br0",
                    "script": "vif-bridge",
                    "nictype": "vif_ioemu"
                },
                {
                    "devid": 3,
                    "mac": "00:16:3e:fd:44:a6",
                    "bridge": "dsip_ext_br0",
                    "script": "vif-bridge",
                    "nictype": "vif_ioemu"
                }
            ],
            "vtpms": [
                {
                    "backend_domname": "vtpm01",
                    "devid": 0,
                    "uuid": "163088d1-1565-49a0-8e0b-64dfc62460bc"
                }
            ],
            "on_reboot": "restart",
            "on_soft_reset": "soft_reset"
        }
    }
]
=======================================================

And then:
============== "virsh dumpxml centos7.0" ==============
<domain type='xen' id='3'>
  <name>centos7.0</name>
  <uuid>feef6cac-8148-4040-a7cb-ad1f82d8d68a</uuid>
  <memory unit='KiB'>4194304</memory>
  <currentMemory unit='KiB'>4194304</currentMemory>
  <vcpu placement='static'>4</vcpu>
  <os>
    <type arch='x86_64' machine='xenfv'>hvm</type>
    <loader type='rom'>/usr/lib64/xen/boot/hvmloader</loader>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/lib64/xen/bin/qemu-system-i386</emulator>
    <disk type='block' device='disk'>
      <driver name='phy' type='raw'/>
      <source dev='/dev/node_b_vg/testimage'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='ide' index='0'/>
    <interface type='bridge'>
      <mac address='00:16:3e:7c:04:3a'/>
      <source network='back_channel' bridge='bc_br0'/>
      <target dev='vif3.0-emu'/>
    </interface>
    <interface type='bridge'>
      <mac address='00:16:3e:b4:c1:c6'/>
      <source network='management' bridge='mgmt_br0'/>
      <target dev='vif3.1-emu'/>
    </interface>
    <interface type='bridge'>
      <mac address='00:16:3e:3a:78:01'/>
      <source network='dsip_int' bridge='dsip_int_br0'/>
      <target dev='vif3.2-emu'/>
    </interface>
    <interface type='bridge'>
      <mac address='00:16:3e:fd:44:a6'/>
      <source network='dsip_ext' bridge='dsip_ext_br0'/>
      <target dev='vif3.3-emu'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/5'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/5'>
      <source path='/dev/pts/5'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='tablet' bus='usb'/>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='5901' autoport='yes' listen='127.0.0.1' keymap='en-us'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>
    <video>
      <model type='cirrus' vram='8192' heads='1' primary='yes'/>
    </video>
  </devices>
</domain>
=======================================================

A closer look at this will reveal the correct vtpm specification
for the native xl command, but it is completely missing from
the XML when running virsh.

Do we need a more current version of libvirt?

Best
Dag