rosi-shapeblue commented on PR #11061: URL: https://github.com/apache/cloudstack/pull/11061#issuecomment-3400756165
## Summary Report - Test Cases Covered **1. Baseline Test (No Metadata): VM deployed on non-patched host.** Verified domain XML → no <metadata> section present. **Status: Pass.** **2. Start VM on Patched Host: VM deployed on patched mgmt + patched agent.** Verified <metadata> section present in domain XML. All expected fields populated (name, internal_name, uuid, zone, cluster, account, service offering, etc.). Empty project field shown as <cloudstack:project uuid=""/>. **Status: Pass.** **3. Special Scenarios** - With/without resource tags → metadata updated correctly. - With/without host tags in service offering → <cloudstack:host_tags> populated or empty as expected. - VM deployed with project → project name and UUID serialized correctly. - VM deployed without project → empty project element as expected. - Live migration patched → patched → metadata preserved. - Live migration patched → non-patched → metadata persisted (as expected due to XML transfer). **Status: Pass.** **4. Compatibility Check** Mgmt patched + agent unpatched → VM started successfully, no metadata generated. **Status: Pass.** **5. Negative / Edge** - Default deploy without tags or project → empty but valid metadata elements. - Stop / start / migrate tested → no crash, no malformed XML. - No fatal errors in logs. **Status: Pass.** **6. Cleanup: VMs destroyed and expunged.** - virsh list --all confirmed no remaining domains. - No leftover XML or disk files on hosts. **Status: Pass.** ## Detailed Test Report ### Baseline Test (No Metadata) - Start a VM before applying the patch - **Expected Result:** No <metadata> section in the domain XML - **Actual Result:** No <metadata> in the domain XML <img width="1905" height="1802" alt="image" src="https://github.com/user-attachments/assets/8504515c-33b5-4364-8e34-f8e491a2626d" /> ### Start VM on Patched Host: Deploy a new VM after patching both mgmt and agent - **Expected Result:** - A <metadata> section in the domain XML; - It contains cloudstack:instance, name, internal_name, uuid, zone, cluster, account, service offering, etc. - No crash or error in the XML structure / Empty fields show unknown or empty <project uuid=""/> (no crash) - **Actual Result:** A <metadata> section is present in the domain XML; It contains all necessary fields; No crash/error <img width="2518" height="1711" alt="image" src="https://github.com/user-attachments/assets/ff9edd00-fccc-4ad1-af87-9e85366e4036" /> ### Without/with Resource Tags: Add resource tag to a VM and deploy/start it on a patched host - **Expected Result:** - Before a tag is created - the <cloudstack:resource_tags/> element present but empty - After a tag is added -> <metadata> section includes <cloudstack:resource_tags> with key–value pairs.; No crash or malformed XML. - **Actual Result:** Section is empty before a tag is created. Once it is added -> the section contains the added tag; XML structure is valid, no crash or errors observed. **Without Resource Tag** <img width="3012" height="340" alt="image" src="https://github.com/user-attachments/assets/1039849d-876c-410f-a0c2-6314383d136d" /> **With Resource Tag** <img width="3111" height="346" alt="image" src="https://github.com/user-attachments/assets/0b15ac2b-5394-48dd-9870-38b5c146b874" /> ### With Service Offering Host Tags: Deploy/start a VM with a service offering that has host tags.** **Steps:** 1. Create a Service Offering with hosttags=abc. 3. Update a Host to have the same tag (abc). 4. Deploy a VM using the tagged Service Offering. 5. Check the VM’s domain XML on the KVM host: **Expected Result:** - <cloudstack:host_tags> section should be present in the VM’s libvirt domain XML. - It should contain the tag from the service offering. - Metadata should reflect the service offering host tag with no errors or malformed XML. **Actual Result:** - <cloudstack:host_tags> section is present in the domain XML. - It contains the expected tag abc. - Service offering, host, and VM all correctly reference the tag. - No crash, errors, or malformed XML. **Before Host Tag** <img width="2943" height="278" alt="image" src="https://github.com/user-attachments/assets/f3ebf87d-0641-478c-9053-65ce5500f7d5" /> **After Host Tag** ``` (localcloud) 🐱 > list serviceofferings id=5b2d77be-4c08-4451-b84f-5343e0290c18 | grep hosttags "hosttags": "abc", (localcloud) 🐱 > (localcloud) 🐱 > list hosts id=05132830-5e67-4c59-8a4f-dcab8117a95c | grep hosttags "explicithosttags": "abc", "hosttags": "abc", (localcloud) 🐱 > (localcloud) 🐱 > list virtualmachines id=e5fc1cd8-6ea0-4c8b-a04f-0e2e3835005f | grep serviceofferingid "serviceofferingid": "5b2d77be-4c08-4451-b84f-5343e0290c18", (localcloud) 🐱 > (localcloud) 🐱 > list virtualmachines id=e5fc1cd8-6ea0-4c8b-a04f-0e2e3835005f | grep hostid "hostid": "05132830-5e67-4c59-8a4f-dcab8117a95c", (localcloud) 🐱 > ``` <img width="3009" height="431" alt="image" src="https://github.com/user-attachments/assets/ec017158-0e11-4c0e-af7f-76619b790e26" /> ### VM with Project: Deploy/start a VM under a project. **Expected Result:** - Before deploying in a project: - <cloudstack:project> element is present with an empty UUID and no name (<cloudstack:project uuid=""/>). - No crash or malformed XML. - After deploying in a project: - <cloudstack:project> element contains the project name and UUID. - No crash or malformed XML. **Actual Result:** - Before deploying in a project: <img width="3137" height="259" alt="image" src="https://github.com/user-attachments/assets/7d37aa91-5cc6-43d5-9e83-fcef9318578e" /> - After deploying in a project: <img width="3130" height="636" alt="image" src="https://github.com/user-attachments/assets/e43d8913-198b-4d19-9fc6-0d9521bef350" /> ### Live Migration: Live migrate the VM between two patched hosts **Expected Result:** - Live migration completes successfully. - <metadata> section is intact on the destination host. - All fields (including tags, project, zone, etc.) remain unchanged. - No crash or malformed XML. **Actual Result:** - <metadata> block is fully preserved. - All expected fields are intact: zone, pod, cluster, name, uuid, service offering, created/started timestamps, owner info. - <cloudstack:host_tags/> is still present (empty as in the original). - <cloudstack:project uuid=""/> correctly indicates no project association. - <cloudstack:resource_tags> with your env=test tag is preserved. - No malformed XML, no missing sections. ``` localcloud) 🐱 > (localcloud) 🐱 > list virtualmachines name=post-patch-instance | grep hostid "hostid": "1a6fcc0b-47e7-4813-8c69-481f9ecf493a", (localcloud) 🐱 > (localcloud) 🐱 > list hosts id=1a6fcc0b-47e7-4813-8c69-481f9ecf493a | grep name "clustername": "p1-c1", "managementservername": "ref-trl-9679-k-mol8-rositsa-kyuchukova-mgmt1.sofia.shapeblue.com", "name": "ref-trl-9679-k-Mol8-rositsa-kyuchukova-kvm2", "podname": "Pod1", "zonename": "ref-trl-9679-k-Mol8-rositsa-kyuchukova" (localcloud) 🐱 > (localcloud) 🐱 > migrate virtualmachine virtualmachineid=eecb752c-159a-43ff-a1b9-c118caebcc5f hostid=05132830-5e67-4c59-8a4f-dcab8117a95c { "virtualmachine": { "account": "admin", "affinitygroup": [], "arch": "x86_64", "cpunumber": 1, "cpuspeed": 500, "cpuused": "13.9%", "created": "2025-10-14T05:00:28+0000", "deleteprotection": false, "details": { "Message.ReservedCapacityFreed.Flag": "false", "cpuOvercommitRatio": "2.0" }, "diskioread": 0, "diskiowrite": 4, "diskkbsread": 0, "diskkbswrite": 24, "displayname": "post-patch-instance", "displayvm": true, "domain": "ROOT", "domainid": "c7f20973-a8b5-11f0-857f-1e00e4000412", "domainpath": "ROOT", "guestosid": "c8448805-a8b5-11f0-857f-1e00e4000412", "haenable": false, "hasannotations": false, "hostcontrolstate": "Enabled", "hostid": "05132830-5e67-4c59-8a4f-dcab8117a95c", "hostname": "ref-trl-9679-k-Mol8-rositsa-kyuchukova-kvm1", "hypervisor": "KVM", "id": "eecb752c-159a-43ff-a1b9-c118caebcc5f", "instancename": "i-2-3-VM", "isdynamicallyscalable": false, "jobid": "00d25461-2e81-4d29-8b04-c3cfe589a193", "jobstatus": 0, "lastupdated": "2025-10-14T07:08:02+0000", "memory": 512, "memoryintfreekbs": -1, "memorykbs": 524288, "memorytargetkbs": 524288, "name": "post-patch-instance", "networkkbsread": 0, "networkkbswrite": 0, "nic": [ { "broadcasturi": "vlan://1934", "deviceid": "0", "extradhcpoption": [], "id": "64cc9d5d-fce6-4b87-b360-de0cd0402628", "isdefault": true, "isolationuri": "vlan://1934", "macaddress": "02:01:00:cc:00:01", "networkid": "92de5793-fef5-4ae6-9128-9104b14a8330", "networkname": "test", "secondaryip": [], "traffictype": "Guest", "type": "L2" } ], "osdisplayname": "CentOS 5.5 (64-bit)", "ostypeid": "c8448805-a8b5-11f0-857f-1e00e4000412", "passwordenabled": false, "pooltype": "NetworkFilesystem", "receivedbytes": 0, "rootdeviceid": 0, "rootdevicetype": "ROOT", "securitygroup": [], "sentbytes": 0, "serviceofferingid": "2b4c988f-d7b2-4455-a89d-dee618c49aa1", "serviceofferingname": "Small Instance", "state": "Running", "tags": [ { "account": "admin", "domain": "ROOT", "domainid": "c7f20973-a8b5-11f0-857f-1e00e4000412", "key": "env", "resourceid": "eecb752c-159a-43ff-a1b9-c118caebcc5f", "resourcetype": "UserVm", "value": "test" } ], "templatedisplaytext": "CentOS 5.5(64-bit) no GUI (KVM)", "templateformat": "QCOW2", "templateid": "c7fd765d-a8b5-11f0-857f-1e00e4000412", "templatename": "CentOS 5.5(64-bit) no GUI (KVM)", "templatetype": "BUILTIN", "userid": "21e941c7-a8b6-11f0-857f-1e00e4000412", "username": "admin", "zoneid": "3550556c-5e4f-4bee-8582-5c4db3c98511", "zonename": "ref-trl-9679-k-Mol8-rositsa-kyuchukova" } } ``` ``` [root@ref-trl-9679-k-Mol8-rositsa-kyuchukova-kvm1 ~]# virsh dumpxml i-2-3-VM | sed -n '/<metadata>/,/<\/metadata>/p' <metadata> <cloudstack:instance xmlns:cloudstack="http://cloudstack.apache.org/instance"> <cloudstack:zone uuid="3550556c-5e4f-4bee-8582-5c4db3c98511">ref-trl-9679-k-Mol8-rositsa-kyuchukova</cloudstack:zone> <cloudstack:pod uuid="078866e4-119e-40b9-9eec-b0431903f6f9">Pod1</cloudstack:pod> <cloudstack:cluster uuid="1ed93f29-0ada-43b2-b07d-007f1eeff3b9">p1-c1</cloudstack:cluster> <cloudstack:name>post-patch-instance</cloudstack:name> <cloudstack:internal_name>i-2-3-VM</cloudstack:internal_name> <cloudstack:display_name>post-patch-instance</cloudstack:display_name> <cloudstack:uuid>eecb752c-159a-43ff-a1b9-c118caebcc5f</cloudstack:uuid> <cloudstack:service_offering> <cloudstack:name>Small Instance</cloudstack:name> <cloudstack:cpu>1</cloudstack:cpu> <cloudstack:memory>512</cloudstack:memory> <cloudstack:host_tags/> </cloudstack:service_offering> <cloudstack:created_at>2025-10-14T05:00:28</cloudstack:created_at> <cloudstack:started_at>2025-10-14T05:16:31</cloudstack:started_at> <cloudstack:owner> <cloudstack:domain uuid="c7f20973-a8b5-11f0-857f-1e00e4000412">ROOT</cloudstack:domain> <cloudstack:account uuid="21e83ed9-a8b6-11f0-857f-1e00e4000412">admin</cloudstack:account> <cloudstack:project uuid=""/> </cloudstack:owner> <cloudstack:resource_tags> <cloudstack:resource_tag key="env">test</cloudstack:resource_tag> </cloudstack:resource_tags> </cloudstack:instance> </metadata> [root@ref-trl-9679-k-Mol8-rositsa-kyuchukova-kvm1 ~]# ``` ### Live Migration: Live migrate the VM between patched and non-patched host ``` (localcloud) 🐱 > migrate virtualmachine virtualmachineid=e5fc1cd8-6ea0-4c8b-a04f-0e2e3835005f hostid=77a38c46-5c5d-4bba-a2be-1bf58116c838 { "virtualmachine": { "account": "admin", "affinitygroup": [], "arch": "x86_64", "cpunumber": 1, "cpuspeed": 500, "cpuused": "13.79%", "created": "2025-10-14T05:32:30+0000", "deleteprotection": false, "details": { "cpuOvercommitRatio": "2.0" }, "diskioread": 0, "diskiowrite": 4, "diskkbsread": 0, "diskkbswrite": 24, "displayname": "host-tagged-instance-abc", "displayvm": true, "domain": "ROOT", "domainid": "c7f20973-a8b5-11f0-857f-1e00e4000412", "domainpath": "ROOT", "guestosid": "c8448805-a8b5-11f0-857f-1e00e4000412", "haenable": false, "hasannotations": false, "hostcontrolstate": "Enabled", "hostid": "77a38c46-5c5d-4bba-a2be-1bf58116c838", "hostname": "host3", "hypervisor": "KVM", "id": "e5fc1cd8-6ea0-4c8b-a04f-0e2e3835005f", "instancename": "i-2-6-VM", "isdynamicallyscalable": false, "jobid": "f4059d47-b81a-4d5c-909d-14c989d96d66", "jobstatus": 0, "lastupdated": "2025-10-14T07:50:18+0000", "memory": 512, "memoryintfreekbs": -1, "memorykbs": 524288, "memorytargetkbs": 524288, "name": "host-tagged-instance-abc", "networkkbsread": 0, "networkkbswrite": 0, "nic": [ { "broadcasturi": "vlan://1934", "deviceid": "0", "extradhcpoption": [], "id": "03e2f2b9-cdf7-4432-a484-c0dd492362c9", "isdefault": true, "isolationuri": "vlan://1934", "macaddress": "02:01:00:cc:00:04", "networkid": "92de5793-fef5-4ae6-9128-9104b14a8330", "networkname": "test", "secondaryip": [], "traffictype": "Guest", "type": "L2" } ], "osdisplayname": "CentOS 5.5 (64-bit)", "ostypeid": "c8448805-a8b5-11f0-857f-1e00e4000412", "passwordenabled": false, "pooltype": "NetworkFilesystem", "receivedbytes": 0, "rootdeviceid": 0, "rootdevicetype": "ROOT", "securitygroup": [], "sentbytes": 0, "serviceofferingid": "5b2d77be-4c08-4451-b84f-5343e0290c18", "serviceofferingname": "TaggedSO", "state": "Running", "tags": [], "templatedisplaytext": "CentOS 5.5(64-bit) no GUI (KVM)", "templateformat": "QCOW2", "templateid": "c7fd765d-a8b5-11f0-857f-1e00e4000412", "templatename": "CentOS 5.5(64-bit) no GUI (KVM)", "templatetype": "BUILTIN", "userid": "21e941c7-a8b6-11f0-857f-1e00e4000412", "username": "admin", "zoneid": "3550556c-5e4f-4bee-8582-5c4db3c98511", "zonename": "ref-trl-9679-k-Mol8-rositsa-kyuchukova" } } ``` XML is preserved ``` [root@ref-trl-9676-k-Mol8-rositsa-kyuchukova-kvm1 ~]# virsh list --all Id Name State -------------------------- 1 s-1-VM running 3 i-2-4-VM running [root@ref-trl-9676-k-Mol8-rositsa-kyuchukova-kvm1 ~]# virsh list --all Id Name State -------------------------- 1 s-1-VM running 3 i-2-4-VM running 4 i-2-6-VM running [root@ref-trl-9676-k-Mol8-rositsa-kyuchukova-kvm1 ~]# virsh dumpxml i-2-6-VM <domain type='kvm' id='4'> <name>i-2-6-VM</name> <uuid>e5fc1cd8-6ea0-4c8b-a04f-0e2e3835005f</uuid> <description>CentOS 5.5 (64-bit)</description> <metadata> <cloudstack:instance xmlns:cloudstack="http://cloudstack.apache.org/instance"> <cloudstack:zone uuid="3550556c-5e4f-4bee-8582-5c4db3c98511">ref-trl-9679-k-Mol8-rositsa-kyuchukova</cloudstack:zone> <cloudstack:pod uuid="078866e4-119e-40b9-9eec-b0431903f6f9">Pod1</cloudstack:pod> <cloudstack:cluster uuid="1ed93f29-0ada-43b2-b07d-007f1eeff3b9">p1-c1</cloudstack:cluster> <cloudstack:name>host-tagged-instance-abc</cloudstack:name> <cloudstack:internal_name>i-2-6-VM</cloudstack:internal_name> <cloudstack:display_name>host-tagged-instance-abc</cloudstack:display_name> <cloudstack:uuid>e5fc1cd8-6ea0-4c8b-a04f-0e2e3835005f</cloudstack:uuid> <cloudstack:service_offering> <cloudstack:name>TaggedSO</cloudstack:name> <cloudstack:cpu>1</cloudstack:cpu> <cloudstack:memory>512</cloudstack:memory> <cloudstack:host_tags> <cloudstack:tag>abc</cloudstack:tag> </cloudstack:host_tags> </cloudstack:service_offering> <cloudstack:created_at>2025-10-14T05:32:30</cloudstack:created_at> <cloudstack:started_at>2025-10-14T05:32:31</cloudstack:started_at> <cloudstack:owner> <cloudstack:domain uuid="c7f20973-a8b5-11f0-857f-1e00e4000412">ROOT</cloudstack:domain> <cloudstack:account uuid="21e83ed9-a8b6-11f0-857f-1e00e4000412">admin</cloudstack:account> <cloudstack:project uuid=""/> </cloudstack:owner> <cloudstack:resource_tags/> </cloudstack:instance> </metadata> <memory unit='KiB'>524288</memory> <currentMemory unit='KiB'>524288</currentMemory> <vcpu placement='static'>1</vcpu> <cputune> <shares>250</shares> </cputune> <resource> <partition>/machine</partition> </resource> <sysinfo type='smbios'> <system> <entry name='manufacturer'>Apache Software Foundation</entry> <entry name='product'>CloudStack KVM Hypervisor</entry> <entry name='serial'>e5fc1cd8-6ea0-4c8b-a04f-0e2e3835005f</entry> <entry name='uuid'>e5fc1cd8-6ea0-4c8b-a04f-0e2e3835005f</entry> </system> </sysinfo> <os> <type arch='x86_64' machine='pc-i440fx-rhel7.6.0'>hvm</type> <boot dev='cdrom'/> <boot dev='hd'/> <smbios mode='sysinfo'/> </os> <features> <acpi/> <apic/> <pae/> </features> <cpu mode='custom' match='exact' check='full'> <model fallback='forbid'>qemu64</model> <topology sockets='1' dies='1' cores='1' threads='1'/> <feature policy='require' name='x2apic'/> <feature policy='require' name='hypervisor'/> <feature policy='require' name='lahf_lm'/> <feature policy='disable' name='svm'/> </cpu> <clock offset='utc'> <timer name='kvmclock'/> </clock> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>destroy</on_crash> <devices> <emulator>/usr/libexec/qemu-kvm</emulator> <disk type='file' device='disk'> <driver name='qemu' type='qcow2' cache='none'/> <source file='/mnt/4a6ffbeb-b5f3-3e7d-a3a7-699b384a0bb0/f5984422-65d1-4361-940f-5f72c359ee68' index='2'/> <backingStore type='file' index='3'> <format type='qcow2'/> <source file='/mnt/4a6ffbeb-b5f3-3e7d-a3a7-699b384a0bb0/c7fd765d-a8b5-11f0-857f-1e00e4000412'/> <backingStore/> </backingStore> <target dev='vda' bus='virtio'/> <serial>f598442265d14361940f</serial> <alias name='virtio-disk0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </disk> <disk type='file' device='cdrom'> <driver name='qemu'/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> <controller type='ide' index='0'> <alias name='ide'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> <controller type='virtio-serial' index='0'> <alias name='virtio-serial0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </controller> <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> <interface type='bridge'> <mac address='02:01:00:cc:00:04'/> <source bridge='breth1-1934'/> <bandwidth> <inbound average='25000' peak='25000'/> <outbound average='25000' peak='25000'/> </bandwidth> <target dev='vnet5'/> <model type='virtio'/> <link state='up'/> <alias name='net0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> <serial type='pty'> <source path='/dev/pts/1'/> <target type='isa-serial' port='0'> <model name='isa-serial'/> </target> <alias name='serial0'/> </serial> <console type='pty' tty='/dev/pts/1'> <source path='/dev/pts/1'/> <target type='serial' port='0'/> <alias name='serial0'/> </console> <channel type='unix'> <source mode='bind' path='/var/lib/libvirt/qemu/i-2-6-VM.org.qemu.guest_agent.0'/> <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='5901' autoport='yes' listen='10.0.33.96'> <listen type='address' address='10.0.33.96'/> </graphics> <audio id='1' type='none'/> <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> <watchdog model='i6300esb' action='none'> <alias name='watchdog0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> </watchdog> <memballoon model='virtio'> <alias name='balloon0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> </memballoon> </devices> <seclabel type='dynamic' model='dac' relabel='yes'> <label>+0:+0</label> <imagelabel>+0:+0</imagelabel> </seclabel> </domain> ``` ### Cleanup: Destroy VMs, verify no unexpected libvirt leftovers **Steps** 1. Delete/expunge VM 2. Verify VM is not present on the host / no leftovers **Actual Result** VM expunged, removed from Host <img width="1646" height="1120" alt="image" src="https://github.com/user-attachments/assets/d4d06f0e-34d5-4edb-93bf-24cee90e7376" /> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
