Thanks to visit codestin.com
Credit goes to github.com

Skip to content

xenserver: do not destroy halted hypervisor vm #9175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 9, 2025

Conversation

shwstppr
Copy link
Contributor

@shwstppr shwstppr commented Jun 5, 2024

Description

Fixes: #8123

CloudStack Xenserver hypervisor plugin calls VM.destroy when the VM is stopped or found in Halted state. This PR prevents this destroy action during VM stop or other actions like snapshot. VM.destroy is already called during the execution of the start VM action which should take care of any storage, network device changes.

TBD: Whether this behavioural change should be controlled by a global configuration?

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • build/CI

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

  • Deploy a VM
  • Take a VM snapshot
  • Revert snapshot (This fails as VM is in running state)
  • Stop the VM
  • Revert snapshot (successful)
(localcloud) 🐱 > deploy virtualmachine zoneid=87ab94de-5701-4aa0-8253-fcefac217440 serviceofferingid=51ac121c-987b-446b-9e51-a383f30f8156 templateid=a698f5ea-e51a-403c-a7be-22d5f6eaa11b networkids=73a2e297-15b3-4237-b76a-12606799c055 
{
  "virtualmachine": {
    "account": "admin",
    "affinitygroup": [],
    "cpunumber": 1,
    "cpuspeed": 500,
    "created": "2024-06-05T11:39:39+0000",
    "details": {
      "cpuOvercommitRatio": "2.0",
      "hypervisortoolsversion": "false",
      "memoryOvercommitRatio": "1.0"
    },
    "displayname": "VM-81c37009-0289-4a22-84ad-1a661d7c8374",
    "displayvm": true,
    "domain": "ROOT",
    "domainid": "5a4b4766-1e62-11ef-b827-1e00120002d6",
    "guestosid": "8170a0ea-d54d-4cb9-b6a6-9d7652960164",
    "haenable": false,
    "hasannotations": false,
    "hostcontrolstate": "Enabled",
    "hostid": "19ccfbce-b0c5-4c85-a176-423d5eec70c1",
    "hostname": "ref-trl-6722-x-M7-abhishek-kumar-xs2",
    "hypervisor": "XenServer",
    "id": "81c37009-0289-4a22-84ad-1a661d7c8374",
    "instancename": "i-2-7-VM",
    "isdynamicallyscalable": false,
    "jobid": "31c96eca-fff7-4258-8a98-d3c45abf424d",
    "jobstatus": 0,
    "lastupdated": "2024-06-05T11:39:50+0000",
    "memory": 512,
    "name": "VM-81c37009-0289-4a22-84ad-1a661d7c8374",
    "nic": [
      {
        "broadcasturi": "vlan://2144",
        "deviceid": "0",
        "extradhcpoption": [],
        "id": "fe0db5bf-1903-447c-abc5-c3978b0f4ff4",
        "isdefault": true,
        "isolationuri": "vlan://2144",
        "macaddress": "02:01:00:cc:00:03",
        "networkid": "73a2e297-15b3-4237-b76a-12606799c055",
        "networkname": "test",
        "secondaryip": [],
        "traffictype": "Guest",
        "type": "L2"
      }
    ],
    "osdisplayname": "Debian GNU/Linux 12 (64-bit)",
    "ostypeid": "8170a0ea-d54d-4cb9-b6a6-9d7652960164",
    "passwordenabled": false,
    "pooltype": "NetworkFilesystem",
    "receivedbytes": 0,
    "rootdeviceid": 0,
    "rootdevicetype": "ROOT",
    "securitygroup": [],
    "sentbytes": 0,
    "serviceofferingid": "51ac121c-987b-446b-9e51-a383f30f8156",
    "serviceofferingname": "Small Instance",
    "state": "Running",
    "tags": [],
    "templatedisplaytext": "debian12-dummy",
    "templateformat": "VHD",
    "templateid": "a698f5ea-e51a-403c-a7be-22d5f6eaa11b",
    "templatename": "debian12-dummy",
    "templatetype": "USER",
    "userid": "78617ce4-1e62-11ef-b827-1e00120002d6",
    "username": "admin",
    "zoneid": "87ab94de-5701-4aa0-8253-fcefac217440",
    "zonename": "ref-trl-6722-x-M7-abhishek-kumar"
  }
}
(localcloud) 🐱 > create vmsnapshot virtualmachineid=81c37009-0289-4a22-84ad-1a661d7c8374 
{
  "vmsnapshot": {
    "account": "admin",
    "created": "2024-06-05T11:40:21+0000",
    "current": true,
    "displayname": "i-2-7-VM_VS_20240605114021",
    "domain": "ROOT",
    "domainid": "5a4b4766-1e62-11ef-b827-1e00120002d6",
    "hasannotations": false,
    "hypervisor": "XenServer",
    "id": "d71892db-5d97-49ba-8d54-98f724dc5630",
    "name": "i-2-7-VM_VS_20240605114021",
    "state": "Ready",
    "tags": [],
    "type": "Disk",
    "virtualmachineid": "81c37009-0289-4a22-84ad-1a661d7c8374",
    "virtualmachinename": "VM-81c37009-0289-4a22-84ad-1a661d7c8374",
    "zoneid": "87ab94de-5701-4aa0-8253-fcefac217440",
    "zonename": "ref-trl-6722-x-M7-abhishek-kumar"
  }
}
(localcloud) 🐱 > revert tovmsnapshot vmsnapshotid=d71892db-5d97-49ba-8d54-98f724dc5630
{
  "account": "admin",
  "accountid": "785ffbf6-1e62-11ef-b827-1e00120002d6",
  "cmd": "org.apache.cloudstack.api.command.admin.vmsnapshot.RevertToVMSnapshotCmdByAdmin",
  "completed": "2024-06-05T11:42:16+0000",
  "created": "2024-06-05T11:42:16+0000",
  "domainid": "5a4b4766-1e62-11ef-b827-1e00120002d6",
  "domainpath": "ROOT",
  "jobid": "f8fb0cf5-ce67-4e44-86e9-5777a1d1aaca",
  "jobinstancetype": "VmSnapshot",
  "jobprocstatus": 0,
  "jobresult": {
    "errorcode": 431,
    "errortext": "VM Snapshot revert not allowed. This will result in VM state change. You can revert running VM to disk and memory type snapshot and stopped VM to disk type snapshot"
  },
  "jobresultcode": 431,
  "jobresulttype": "object",
  "jobstatus": 2,
  "userid": "78617ce4-1e62-11ef-b827-1e00120002d6"
}
🙈 Error: async API failed for job f8fb0cf5-ce67-4e44-86e9-5777a1d1aaca
(localcloud) 🐱 > stop virtualmachine id=81c37009-0289-4a22-84ad-1a661d7c8374 forced=true 
{
  "virtualmachine": {
    "account": "admin",
    "affinitygroup": [],
    "cpunumber": 1,
    "cpuspeed": 500,
    "cpuused": "2%",
    "created": "2024-06-05T11:39:39+0000",
    "details": {
      "Message.ReservedCapacityFreed.Flag": "false",
      "cpuOvercommitRatio": "2.0",
      "hypervisortoolsversion": "xenserver56",
      "memoryOvercommitRatio": "1.0",
      "platform": "device-model:qemu-upstream-compat;apic:true;viridian:true;timeoffset:0;pae:true;acpi:1;hpet:true;secureboot:false;nx:true"
    },
    "diskioread": 0,
    "diskiowrite": 0,
    "diskkbsread": 119,
    "diskkbswrite": 3,
    "displayname": "VM-81c37009-0289-4a22-84ad-1a661d7c8374",
    "displayvm": true,
    "domain": "ROOT",
    "domainid": "5a4b4766-1e62-11ef-b827-1e00120002d6",
    "guestosid": "8170a0ea-d54d-4cb9-b6a6-9d7652960164",
    "haenable": false,
    "hasannotations": false,
    "hypervisor": "XenServer",
    "id": "81c37009-0289-4a22-84ad-1a661d7c8374",
    "instancename": "i-2-7-VM",
    "isdynamicallyscalable": false,
    "jobid": "75ae73fb-f917-45f7-907e-0fa5ce956b33",
    "jobstatus": 0,
    "lastupdated": "2024-06-05T11:42:41+0000",
    "memory": 512,
    "memoryintfreekbs": 0,
    "memorykbs": 524284,
    "memorytargetkbs": 524288,
    "name": "VM-81c37009-0289-4a22-84ad-1a661d7c8374",
    "networkkbsread": 0,
    "networkkbswrite": 0,
    "nic": [
      {
        "deviceid": "0",
        "extradhcpoption": [],
        "id": "fe0db5bf-1903-447c-abc5-c3978b0f4ff4",
        "isdefault": true,
        "macaddress": "02:01:00:cc:00:03",
        "networkid": "73a2e297-15b3-4237-b76a-12606799c055",
        "networkname": "test",
        "secondaryip": [],
        "traffictype": "Guest",
        "type": "L2"
      }
    ],
    "osdisplayname": "Debian GNU/Linux 12 (64-bit)",
    "ostypeid": "8170a0ea-d54d-4cb9-b6a6-9d7652960164",
    "passwordenabled": false,
    "pooltype": "NetworkFilesystem",
    "receivedbytes": 0,
    "rootdeviceid": 0,
    "rootdevicetype": "ROOT",
    "securitygroup": [],
    "sentbytes": 0,
    "serviceofferingid": "51ac121c-987b-446b-9e51-a383f30f8156",
    "serviceofferingname": "Small Instance",
    "state": "Stopped",
    "tags": [],
    "templatedisplaytext": "debian12-dummy",
    "templateformat": "VHD",
    "templateid": "a698f5ea-e51a-403c-a7be-22d5f6eaa11b",
    "templatename": "debian12-dummy",
    "templatetype": "USER",
    "userid": "78617ce4-1e62-11ef-b827-1e00120002d6",
    "username": "admin",
    "zoneid": "87ab94de-5701-4aa0-8253-fcefac217440",
    "zonename": "ref-trl-6722-x-M7-abhishek-kumar"
  }
}
(localcloud) 🐱 > revert tovmsnapshot vmsnapshotid=d71892db-5d97-49ba-8d54-98f724dc5630
{
  "virtualmachine": {
    "account": "admin",
    "affinitygroup": [],
    "cpunumber": 1,
    "cpuspeed": 500,
    "cpuused": "2%",
    "created": "2024-06-05T11:39:39+0000",
    "details": {
      "Message.ReservedCapacityFreed.Flag": "false",
      "cpuOvercommitRatio": "2.0",
      "hypervisortoolsversion": "xenserver56",
      "memoryOvercommitRatio": "1.0",
      "platform": "device-model:qemu-upstream-compat;apic:true;viridian:true;timeoffset:0;pae:true;acpi:1;hpet:true;secureboot:false;nx:true"
    },
    "diskioread": 0,
    "diskiowrite": 0,
    "diskkbsread": 119,
    "diskkbswrite": 3,
    "displayname": "VM-81c37009-0289-4a22-84ad-1a661d7c8374",
    "displayvm": true,
    "domain": "ROOT",
    "domainid": "5a4b4766-1e62-11ef-b827-1e00120002d6",
    "guestosid": "8170a0ea-d54d-4cb9-b6a6-9d7652960164",
    "haenable": false,
    "hasannotations": false,
    "hypervisor": "XenServer",
    "id": "81c37009-0289-4a22-84ad-1a661d7c8374",
    "instancename": "i-2-7-VM",
    "isdynamicallyscalable": false,
    "lastupdated": "2024-06-05T11:42:41+0000",
    "memory": 512,
    "memoryintfreekbs": 0,
    "memorykbs": 524284,
    "memorytargetkbs": 524288,
    "name": "VM-81c37009-0289-4a22-84ad-1a661d7c8374",
    "networkkbsread": 0,
    "networkkbswrite": 0,
    "nic": [
      {
        "deviceid": "0",
        "extradhcpoption": [],
        "id": "fe0db5bf-1903-447c-abc5-c3978b0f4ff4",
        "isdefault": true,
        "macaddress": "02:01:00:cc:00:03",
        "networkid": "73a2e297-15b3-4237-b76a-12606799c055",
        "networkname": "test",
        "secondaryip": [],
        "traffictype": "Guest",
        "type": "L2"
      }
    ],
    "osdisplayname": "Debian GNU/Linux 12 (64-bit)",
    "ostypeid": "8170a0ea-d54d-4cb9-b6a6-9d7652960164",
    "passwordenabled": false,
    "pooltype": "NetworkFilesystem",
    "receivedbytes": 0,
    "rootdeviceid": 0,
    "rootdevicetype": "ROOT",
    "securitygroup": [],
    "sentbytes": 0,
    "serviceofferingid": "51ac121c-987b-446b-9e51-a383f30f8156",
    "serviceofferingname": "Small Instance",
    "state": "Stopped",
    "tags": [],
    "templatedisplaytext": "debian12-dummy",
    "templateformat": "VHD",
    "templateid": "a698f5ea-e51a-403c-a7be-22d5f6eaa11b",
    "templatename": "debian12-dummy",
    "templatetype": "USER",
    "userid": "78617ce4-1e62-11ef-b827-1e00120002d6",
    "username": "admin",
    "zoneid": "87ab94de-5701-4aa0-8253-fcefac217440",
    "zonename": "ref-trl-6722-x-M7-abhishek-kumar"

How did you try to break this feature and the system with this change?

shwstppr added 3 commits June 3, 2024 14:55
Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
@shwstppr
Copy link
Contributor Author

shwstppr commented Jun 5, 2024

@blueorangutan package

@blueorangutan
Copy link

@shwstppr a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

Copy link

codecov bot commented Jun 5, 2024

Codecov Report

Attention: Patch coverage is 0% with 30 lines in your changes missing coverage. Please review.

Project coverage is 15.08%. Comparing base (54c8b71) to head (c80ffea).
Report is 243 commits behind head on 4.19.

Files with missing lines Patch % Lines
...ervisor/xenserver/resource/CitrixResourceBase.java 0.00% 19 Missing ⚠️
.../xenbase/CitrixCreateVMSnapshotCommandWrapper.java 0.00% 3 Missing and 1 partial ⚠️
...enbase/CitrixRevertToVMSnapshotCommandWrapper.java 0.00% 2 Missing ⚠️
.../wrapper/xen56/XenServer56FenceCommandWrapper.java 0.00% 1 Missing ⚠️
...per/xen56p1/XenServer56FP1FenceCommandWrapper.java 0.00% 1 Missing ⚠️
.../xenbase/CitrixDeleteVMSnapshotCommandWrapper.java 0.00% 1 Missing ⚠️
...rce/wrapper/xenbase/CitrixStartCommandWrapper.java 0.00% 1 Missing ⚠️
...urce/wrapper/xenbase/CitrixStopCommandWrapper.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##               4.19    #9175    +/-   ##
==========================================
  Coverage     15.07%   15.08%            
- Complexity    11169    11173     +4     
==========================================
  Files          5405     5405            
  Lines        472677   472692    +15     
  Branches      60049    59523   -526     
==========================================
+ Hits          71269    71283    +14     
- Misses       393479   393480     +1     
  Partials       7929     7929            
Flag Coverage Δ
uitests 4.27% <ø> (ø)
unittests 15.79% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 9794

@rohityadavcloud rohityadavcloud modified the milestones: 4.19.2.0, 4.19.1.0 Jun 24, 2024
@shwstppr
Copy link
Contributor Author

Will run a round of tests here. Though I didn't see any issue in my manual testing but I'm not sure if not destroying a halted VM from hypervisor side can lead to any regressions cc @sureshanaparti @harikrishna-patnala

@blueorangutan package

@blueorangutan
Copy link

@shwstppr a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 10139

@sureshanaparti
Copy link
Contributor

@blueorangutan test rocky8 xcpng82

@blueorangutan
Copy link

@sureshanaparti a [SL] Trillian-Jenkins test job (rocky8 mgmt + xcpng82) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian test result (tid-10635)
Environment: xcpng82 (x2), Advanced Networking with Mgmt server r8
Total time taken: 65281 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr9175-t10635-xcpng82.zip
Smoke tests completed. 111 look OK, 20 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
ContextSuite context=TestTemplateHierarchy>:setup Error 10.03 test_accounts.py
ContextSuite context=TestDeployVmWithAffinityGroup>:setup Error 0.00 test_affinity_groups.py
ContextSuite context=TestDummyBackupAndRecovery>:setup Error 0.00 test_backup_recovery_dummy.py
ContextSuite context=TestVeeamBackupAndRecovery>:setup Error 0.00 test_backup_recovery_veeam.py
test_01_condensed_drs_algorithm Error 0.00 test_cluster_drs.py
test_02_balanced_drs_algorithm Error 0.00 test_cluster_drs.py
ContextSuite context=TestConsoleEndpoint>:setup Error 0.00 test_console_endpoint.py
test_06_deploy_vm_with_extraconfig_throws_exception_xenserver Error 0.10 test_deploy_vm_extra_config_data.py
test_07_deploy_vm_with_extraconfig_xenserver Error 0.09 test_deploy_vm_extra_config_data.py
ContextSuite context=TestDeployVmRootSize>:setup Error 0.00 test_deploy_vm_root_resize.py
ContextSuite context=TestHostControlState>:setup Error 0.06 test_host_control_state.py
test_02_upgrade_kubernetes_cluster Failure 493.68 test_kubernetes_clusters.py
test_11_test_unmanaged_cluster_lifecycle Error 3.32 test_kubernetes_clusters.py
ContextSuite context=TestSharedNetwork>:setup Error 99.22 test_network.py
test_01_non_strict_host_anti_affinity Error 1.17 test_nonstrict_affinity_group.py
test_02_non_strict_host_affinity Error 2.21 test_nonstrict_affinity_group.py
ContextSuite context=TestL2PersistentNetworks>:setup Error 0.00 test_persistent_network.py
ContextSuite context=TestPrivateGwACLOvsGRE>:setup Error 0.00 test_privategw_acl_ovs_gre.py
ContextSuite context=TestTemplates>:setup Error 0.13 test_templates.py
test_01_positive_tests_usage Failure 3.58 test_usage_events.py
ContextSuite context=TestVmAutoScaling>:setup Error 0.00 test_vm_autoscaling.py
test_01_deploy_vm_on_specific_host Error 0.06 test_vm_deployment_planner.py
test_02_deploy_vm_on_specific_cluster Error 0.04 test_vm_deployment_planner.py
test_03_deploy_vm_on_specific_pod Error 0.08 test_vm_deployment_planner.py
test_04_deploy_vm_on_host_override_pod_and_cluster Error 0.10 test_vm_deployment_planner.py
test_05_deploy_vm_on_cluster_override_pod Error 0.07 test_vm_deployment_planner.py
ContextSuite context=TestVMSchedule>:setup Error 0.00 test_vm_schedule.py
ContextSuite context=TestVnfTemplates>:setup Error 0.00 test_vnf_templates.py

@sureshanaparti
Copy link
Contributor

@blueorangutan test rocky8 xcpng82

@blueorangutan
Copy link

@sureshanaparti a [SL] Trillian-Jenkins test job (rocky8 mgmt + xcpng82) has been kicked to run smoke tests

@shwstppr
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@shwstppr a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 10164

@shwstppr shwstppr changed the title [DRAFT] xenserver: do not destroy halted hypervisor vm xenserver: do not destroy halted hypervisor vm Jun 27, 2024
@blueorangutan
Copy link

[SF] Trillian test result (tid-10647)
Environment: xcpng82 (x2), Advanced Networking with Mgmt server r8
Total time taken: 63680 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr9175-t10647-xcpng82.zip
Smoke tests completed. 110 look OK, 21 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
ContextSuite context=TestTemplateHierarchy>:setup Error 10.10 test_accounts.py
ContextSuite context=TestDeployVmWithAffinityGroup>:setup Error 0.00 test_affinity_groups.py
ContextSuite context=TestDummyBackupAndRecovery>:setup Error 0.00 test_backup_recovery_dummy.py
ContextSuite context=TestVeeamBackupAndRecovery>:setup Error 0.00 test_backup_recovery_veeam.py
test_01_condensed_drs_algorithm Error 0.00 test_cluster_drs.py
test_02_balanced_drs_algorithm Error 0.00 test_cluster_drs.py
ContextSuite context=TestConsoleEndpoint>:setup Error 0.00 test_console_endpoint.py
test_06_deploy_vm_with_extraconfig_throws_exception_xenserver Error 0.09 test_deploy_vm_extra_config_data.py
test_07_deploy_vm_with_extraconfig_xenserver Error 0.07 test_deploy_vm_extra_config_data.py
ContextSuite context=TestDeployVmRootSize>:setup Error 0.00 test_deploy_vm_root_resize.py
ContextSuite context=TestHostControlState>:setup Error 0.05 test_host_control_state.py
test_11_test_unmanaged_cluster_lifecycle Error 1.28 test_kubernetes_clusters.py
ContextSuite context=TestSharedNetwork>:setup Error 94.33 test_network.py
test_01_non_strict_host_anti_affinity Error 2.19 test_nonstrict_affinity_group.py
test_02_non_strict_host_affinity Error 2.21 test_nonstrict_affinity_group.py
ContextSuite context=TestL2PersistentNetworks>:setup Error 0.00 test_persistent_network.py
ContextSuite context=TestPrivateGwACLOvsGRE>:setup Error 0.00 test_privategw_acl_ovs_gre.py
ContextSuite context=TestTemplates>:setup Error 0.13 test_templates.py
test_01_positive_tests_usage Failure 3.45 test_usage_events.py
ContextSuite context=TestVmAutoScaling>:setup Error 0.00 test_vm_autoscaling.py
test_01_deploy_vm_on_specific_host Error 0.05 test_vm_deployment_planner.py
test_02_deploy_vm_on_specific_cluster Error 0.04 test_vm_deployment_planner.py
test_03_deploy_vm_on_specific_pod Error 0.07 test_vm_deployment_planner.py
test_04_deploy_vm_on_host_override_pod_and_cluster Error 0.09 test_vm_deployment_planner.py
test_05_deploy_vm_on_cluster_override_pod Error 0.06 test_vm_deployment_planner.py
ContextSuite context=TestVMSchedule>:setup Error 0.00 test_vm_schedule.py
ContextSuite context=TestVnfTemplates>:setup Error 0.00 test_vnf_templates.py
test_01_vpc_site2site_vpn_multiple_options Failure 620.89 test_vpc_vpn.py

@shwstppr
Copy link
Contributor Author

Looks like changes behaviour is causing issues. I'll investigate further. This can be moved out of the 4.19.1 milestone. We already have a workaround for #8123 by adding the newer guest OS(es).

@sureshanaparti sureshanaparti modified the milestones: 4.19.1.0, 4.19.2.0 Jun 28, 2024
@AlexanderKgr
Copy link

image

i have a cluster with 2 xcp-ng 8.2.1.
Enable zone and system vms booted.
Booted one instance of windows, and cloudstack booted also vr.

Then i followed the reverse sequence.
Shutted down windows instance, then vr.
Disabled zone and shutted down system vms.
Then i check xcp-ng center and all vms were there but powered off and haven't been deleted.

Perfect implementation.
@shwstppr @Pearl1594 do you want to test something else?

it is a small lab for testing cloudstack, everything it is virtual.

@Pearl1594
Copy link
Contributor

Thanks @AlexanderKgr - looks good to me. Maybe @shwstppr can advice if there's anything else that needs testing..

@weizhouapache
Copy link
Member

image

i have a cluster with 2 xcp-ng 8.2.1.
Enable zone and system vms booted.
Booted one instance of windows, and cloudstack booted also vr.

Then i followed the reverse sequence.
Shutted down windows instance, then vr.
Disabled zone and shutted down system vms.
Then i check xcp-ng center and all vms were there but powered off and haven't been deleted.

Perfect implementation.
@shwstppr @Pearl1594 do you want to test something else?

it is a small lab for testing cloudstack, everything it is virtual.

@AlexanderKgr @shwstppr
One question, If start the vm on another host, will there be two vms on both host ?

@AlexanderKgr
Copy link

image
i have a cluster with 2 xcp-ng 8.2.1.
Enable zone and system vms booted.
Booted one instance of windows, and cloudstack booted also vr.
Then i followed the reverse sequence.
Shutted down windows instance, then vr.
Disabled zone and shutted down system vms.
Then i check xcp-ng center and all vms were there but powered off and haven't been deleted.
Perfect implementation.
@shwstppr @Pearl1594 do you want to test something else?
it is a small lab for testing cloudstack, everything it is virtual.

@AlexanderKgr @shwstppr One question, If start the vm on another host, will there be two vms on both host ?

image

i will be migrated to the host that you choose

@weizhouapache
Copy link
Member

@AlexanderKgr @shwstppr One question, If start the vm on another host, will there be two vms on both host ?

image

i will be migrated to the host that you choose

Looks good, thanks @AlexanderKgr

Copy link
Member

@weizhouapache weizhouapache left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code lgtm

I wondered if there are edge cases that

  • the vm exists on two hosts (it seems will not happen), or
  • vm cannot be started as the last host has communication failure.
    These are difficult to be reproduced.

@AlexanderKgr
Copy link

code lgtm

I wondered if there are edge cases that

  • the vm exists on two hosts (it seems will not happen), or
  • vm cannot be started as the last host has communication failure.
    These are difficult to be reproduced.

Xcp-ng when is configured as a cluster cannot start vm with the same name (i am thinking of it) also with the same uuid. Each instance has a unique uuid.

If there is host communication error it will choose the next available

@AlexanderKgr
Copy link

My production cs is based on 4.20. will this be merged on 4.20?

@Pearl1594
Copy link
Contributor

@blueorangutan test ol8 xcpng82

@blueorangutan
Copy link

@Pearl1594 a [SL] Trillian-Jenkins test job (ol8 mgmt + xcpng82) has been kicked to run smoke tests

@weizhouapache
Copy link
Member

code lgtm
I wondered if there are edge cases that

  • the vm exists on two hosts (it seems will not happen), or
  • vm cannot be started as the last host has communication failure.
    These are difficult to be reproduced.

Xcp-ng when is configured as a cluster cannot start vm with the same name (i am thinking of it) also with the same uuid. Each instance has a unique uuid.

If there is host communication error it will choose the next available

thanks @AlexanderKgr

this is targeted to 4.19.
when it is merged, it will be forward-merged into 4.20 and main branch as well

@shwstppr
Copy link
Contributor Author

shwstppr commented Apr 9, 2025

Thanks @AlexanderKgr for tests.
Just to confirm, did you test the original issue that restoring VM snapshot wasn't working #8123?

@AlexanderKgr
Copy link

Thanks @AlexanderKgr for tests. Just to confirm, did you test the original issue that restoring VM snapshot wasn't working #8123?

i will test it. sorry

@AlexanderKgr
Copy link

Thanks @AlexanderKgr for tests. Just to confirm, did you test the original issue that restoring VM snapshot wasn't working #8123?

it is working without issues. tried with a windows 11 instance. Shutted down vm, took snapshot. Booted, shutted down, took new snapshot. Then reverted to previous snapshot. No issues at all.
Do you need something else?

@shwstppr
Copy link
Contributor Author

shwstppr commented Apr 9, 2025

@AlexanderKgr thanks. Nothing more from my end

@DaanHoogland DaanHoogland merged commit 5d5ac17 into apache:4.19 Apr 9, 2025
25 of 26 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in ACS 4.20.1 Apr 9, 2025
@DaanHoogland DaanHoogland deleted the fix-xen-stopvmdestroy branch April 9, 2025 07:33
DaanHoogland pushed a commit that referenced this pull request Apr 9, 2025
* 4.20:
  xenserver: do not destroy halted hypervisor vm (#9175)
  define the limit of projects through the UI (#10652)
  fix projects metrics on dashboard (#10651)
  systemvm: Bump systemvm template version to debian 12.10 (#10628)
  Enhance VPC Network Tier form to auto-populate  Gateway, and Netmask (#10617)
@blueorangutan
Copy link

[SF] Trillian test result (tid-12912)
Environment: xcpng82 (x2), Advanced Networking with Mgmt server ol8
Total time taken: 157451 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr9175-t12912-xcpng82.zip
Smoke tests completed. 82 look OK, 51 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_01_events_resource Error 1526.03 test_events_resource.py
test_01_condensed_drs_algorithm Failure 206.52 test_cluster_drs.py
test_02_balanced_drs_algorithm Failure 194.37 test_cluster_drs.py
ContextSuite context=TestInternalLb>:setup Error 0.00 test_internal_lb.py
ContextSuite context=TestDeployVMFromISO>:setup Error 0.00 test_deploy_vm_iso.py
test_01_1_create_iso_with_checksum_sha1_negative Error 66.66 test_iso.py
test_01_create_iso_with_checksum_sha1 Error 66.64 test_iso.py
test_01_create_iso_with_checksum_sha1 Error 66.64 test_iso.py
test_02_1_create_iso_with_checksum_sha256_negative Error 66.66 test_iso.py
test_02_create_iso_with_checksum_sha256 Error 66.64 test_iso.py
test_02_create_iso_with_checksum_sha256 Error 66.64 test_iso.py
test_03_1_create_iso_with_checksum_md5_negative Error 66.64 test_iso.py
test_03_create_iso_with_checksum_md5 Error 66.70 test_iso.py
test_03_create_iso_with_checksum_md5 Error 66.70 test_iso.py
test_04_create_iso_with_no_checksum Error 66.67 test_iso.py
test_04_create_iso_with_no_checksum Error 66.67 test_iso.py
test_01_create_iso Failure 1519.46 test_iso.py
ContextSuite context=TestISO>:setup Error 3037.86 test_iso.py
ContextSuite context=TestDeployVMsInParallel>:setup Error 0.00 test_deploy_vms_in_parallel.py
ContextSuite context=TestRemoteDiagnostics>:setup Error 0.00 test_diagnostics.py
ContextSuite context=TestDeployVmWithVariedPlanners>:setup Error 0.00 test_deploy_vms_with_varied_deploymentplanners.py
ContextSuite context=TestDeployVmWithUserData>:setup Error 0.00 test_deploy_vm_with_userdata.py
ContextSuite context=TestDomainsServiceOfferings>:setup Error 1522.84 test_domain_service_offerings.py
test_01_browser_migrate_template Error 66.00 test_image_store_object_migration.py
test_01_invalid_upgrade_kubernetes_cluster Failure 0.01 test_kubernetes_clusters.py
test_02_upgrade_kubernetes_cluster Failure 0.01 test_kubernetes_clusters.py
test_03_deploy_and_scale_kubernetes_cluster Failure 0.01 test_kubernetes_clusters.py
test_04_autoscale_kubernetes_cluster Failure 0.01 test_kubernetes_clusters.py
test_05_basic_lifecycle_kubernetes_cluster Failure 0.01 test_kubernetes_clusters.py
test_06_delete_kubernetes_cluster Failure 0.01 test_kubernetes_clusters.py
test_08_upgrade_kubernetes_ha_cluster Failure 0.00 test_kubernetes_clusters.py
test_10_vpc_tier_kubernetes_cluster Failure 0.01 test_kubernetes_clusters.py
test_11_test_unmanaged_cluster_lifecycle Error 0.01 test_kubernetes_clusters.py
ContextSuite context=TestAdapterTypeForNic>:setup Error 0.00 test_nic_adapter_type.py
test_01_nic Error 1521.33 test_nic.py
test_01_non_strict_host_anti_affinity Error 2.60 test_nonstrict_affinity_group.py
test_02_non_strict_host_affinity Error 3.61 test_nonstrict_affinity_group.py
ContextSuite context=TestIsolatedNetworksPasswdServer>:setup Error 0.00 test_password_server.py
ContextSuite context=TestProjectSuspendActivate>:setup Error 1529.20 test_projects.py
ContextSuite context=TestPrivateGwACL>:setup Error 0.00 test_privategw_acl.py
test_another_user_can_allocate_ip_after_quarantined_has_ended_network Error 6.24 test_quarantined_ips.py
test_another_user_can_allocate_ip_after_quarantined_has_ended_vpc Error 0.49 test_quarantined_ips.py
test_only_owner_can_allocate_ip_in_quarantine_network Error 0.44 test_quarantined_ips.py
test_only_owner_can_allocate_ip_in_quarantine_vpc Error 0.47 test_quarantined_ips.py
test_CRUD_operations_userdata Error 1521.54 test_register_userdata.py
test_deploy_vm_with_registered_userdata Error 5.64 test_register_userdata.py
test_deploy_vm_with_registered_userdata_with_override_policy_allow Error 5.99 test_register_userdata.py
test_deploy_vm_with_registered_userdata_with_override_policy_append Error 5.56 test_register_userdata.py
test_deploy_vm_with_registered_userdata_with_override_policy_deny Error 5.51 test_register_userdata.py
test_deploy_vm_with_registered_userdata_with_params Error 6.03 test_register_userdata.py
test_link_and_unlink_userdata_to_template Error 5.50 test_register_userdata.py
test_user_userdata_crud Error 5.79 test_register_userdata.py
ContextSuite context=TestResetVmOnReboot>:setup Error 0.00 test_reset_vm_on_reboot.py
ContextSuite context=TestCreateVolume>:setup Error 0.00 test_volumes.py
ContextSuite context=TestVolumes>:setup Error 5.13 test_volumes.py
ContextSuite context=TestRAMCPUResourceAccounting>:setup Error 0.00 test_resource_accounting.py
ContextSuite context=TestRestoreVM>:setup Error 0.00 test_restore_vm.py
ContextSuite context=TestRouterDHCPHosts>:setup Error 0.00 test_router_dhcphosts.py
ContextSuite context=TestRouterDHCPOpts>:setup Error 0.00 test_router_dhcphosts.py
ContextSuite context=TestIpv6Vpc>:setup Error 0.00 test_vpc_ipv6.py
ContextSuite context=TestRouterDns>:setup Error 0.00 test_router_dns.py
ContextSuite context=TestRouterDnsService>:setup Error 0.00 test_router_dnsservice.py
ContextSuite context=TestChangeServiceOfferingForVmWithSnapshots>:setup Error 0.00 test_vm_snapshots.py
ContextSuite context=TestVmSnapshot>:setup Error 0.00 test_vm_snapshots.py
ContextSuite context=TestRouterIpTablesPolicies>:setup Error 0.00 test_routers_iptables_default_policy.py
ContextSuite context=TestVPCIpTablesPolicies>:setup Error 0.00 test_routers_iptables_default_policy.py
ContextSuite context=TestIsolatedNetworks>:setup Error 0.00 test_routers_network_ops.py
ContextSuite context=TestRedundantIsolateNetworks>:setup Error 0.00 test_routers_network_ops.py
ContextSuite context=TestRouterServices>:setup Error 0.00 test_routers.py
ContextSuite context=TestScaleVm>:setup Error 0.00 test_scale_vm.py
test_01_sys_vm_start Failure 60.30 test_secondary_storage.py
ContextSuite context=TestServiceOfferings>:setup Error 1519.02 test_service_offerings.py
ContextSuite context=TestSetSourceNatIp>:setup Error 0.00 test_set_sourcenat.py
ContextSuite context=TestRVPCSite2SiteVpn>:setup Error 0.00 test_vpc_vpn.py
ContextSuite context=TestVPCSite2SiteVPNMultipleOptions>:setup Error 0.00 test_vpc_vpn.py
ContextSuite context=TestVpcRemoteAccessVpn>:setup Error 0.00 test_vpc_vpn.py
ContextSuite context=TestVpcSite2SiteVpn>:setup Error 0.00 test_vpc_vpn.py
ContextSuite context=TestSnapshotRootDisk>:setup Error 0.00 test_snapshots.py
ContextSuite context=TestSnapshotStandaloneBackup>:setup Error 0.00 test_snapshots.py
test_01_list_sec_storage_vm Failure 0.05 test_ssvm.py
test_02_list_cpvm_vm Failure 0.05 test_ssvm.py
test_03_ssvm_internals Failure 0.05 test_ssvm.py
test_04_cpvm_internals Failure 0.05 test_ssvm.py
test_05_stop_ssvm Failure 0.06 test_ssvm.py
test_06_stop_cpvm Failure 0.05 test_ssvm.py
test_07_reboot_ssvm Failure 0.05 test_ssvm.py
test_08_reboot_cpvm Failure 0.06 test_ssvm.py
test_09_reboot_ssvm_forced Failure 0.05 test_ssvm.py
test_10_reboot_cpvm_forced Failure 0.04 test_ssvm.py
test_11_destroy_ssvm Failure 0.05 test_ssvm.py
test_12_destroy_cpvm Failure 0.05 test_ssvm.py
ContextSuite context=TestVPCRedundancy>:setup Error 0.00 test_vpc_redundant.py
ContextSuite context=TestVMWareStoragePolicies>:setup Error 0.00 test_storage_policy.py
test_02_create_template_with_checksum_sha1 Error 65.70 test_templates.py
test_03_create_template_with_checksum_sha256 Error 65.73 test_templates.py
test_04_create_template_with_checksum_md5 Error 65.74 test_templates.py
test_05_create_template_with_no_checksum Error 65.73 test_templates.py
ContextSuite context=TestTemplates>:setup Error 8.39 test_templates.py
ContextSuite context=TestISOUsage>:setup Error 0.00 test_usage.py
ContextSuite context=TestLBRuleUsage>:setup Error 0.00 test_usage.py
ContextSuite context=TestNatRuleUsage>:setup Error 0.00 test_usage.py
ContextSuite context=TestPublicIPUsage>:setup Error 0.00 test_usage.py
ContextSuite context=TestSnapshotUsage>:setup Error 0.00 test_usage.py
ContextSuite context=TestVmUsage>:setup Error 0.00 test_usage.py
ContextSuite context=TestVolumeUsage>:setup Error 0.00 test_usage.py
ContextSuite context=TestVpnUsage>:setup Error 0.00 test_usage.py
ContextSuite context=TestVmAutoScaling>:setup Error 0.00 test_vm_autoscaling.py
test_01_deploy_vm_on_specific_host Error 1.44 test_vm_deployment_planner.py
test_02_deploy_vm_on_specific_cluster Error 1.35 test_vm_deployment_planner.py
test_03_deploy_vm_on_specific_pod Error 1.43 test_vm_deployment_planner.py
test_04_deploy_vm_on_host_override_pod_and_cluster Error 1.49 test_vm_deployment_planner.py
test_05_deploy_vm_on_cluster_override_pod Error 1.38 test_vm_deployment_planner.py
ContextSuite context=TestDeployVM>:setup Error 0.00 test_vm_life_cycle.py
ContextSuite context=TestVMLifeCycle>:setup Error 4.85 test_vm_life_cycle.py
ContextSuite context=TestUnmanageVM>:setup Error 0.00 test_vm_lifecycle_unmanage_import.py
ContextSuite context=TestVMSchedule>:setup Error 0.00 test_vm_schedule.py
ContextSuite context=TestVPCNics>:setup Error 0.00 test_vpc_router_nics.py
test_01_register_vnf_template Error 0.09 test_vnf_templates.py
test_02_list_vnf_template Error 0.09 test_vnf_templates.py
test_03_edit_vnf_template Error 0.08 test_vnf_templates.py
test_04_deploy_vnf_appliance Error 0.08 test_vnf_templates.py
test_05_delete_vnf_template Error 0.10 test_vnf_templates.py
test_02_cancel_host_maintenace_with_migration_jobs Error 1519.43 test_host_maintenance.py
test_03_cancel_host_maintenace_with_migration_jobs_failure Error 2.03 test_host_maintenance.py

@DaanHoogland
Copy link
Contributor

@Pearl1594 I didn't look at the smoke tests still running and as the user reported having tested I merged. Do we need to revert or can we explain the failures by environmental issues?

@weizhouapache
Copy link
Member

@DaanHoogland
we had storage capacity issues in the past few days.
there are lots of test failures in the smoke tests of some PRs, not only this PR

@blueorangutan test ol8 xcpng82

@blueorangutan
Copy link

@weizhouapache a [SL] Trillian-Jenkins test job (ol8 mgmt + xcpng82) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian test result (tid-12953)
Environment: xcpng82 (x2), Advanced Networking with Mgmt server ol8
Total time taken: 61061 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr9175-t12953-xcpng82.zip
Smoke tests completed. 131 look OK, 2 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_01_condensed_drs_algorithm Failure 164.47 test_cluster_drs.py
test_02_balanced_drs_algorithm Failure 189.74 test_cluster_drs.py
test_01_non_strict_host_anti_affinity Error 201.23 test_nonstrict_affinity_group.py
test_02_non_strict_host_affinity Error 123.81 test_nonstrict_affinity_group.py

@weizhouapache
Copy link
Member

@shwstppr
while testing xcpng/xen 8.3/8.4, I found the Expunged vms are still listed in the output of xm-list
should we destroy the halted vm in xen/xcp-ng as part of expunge process ?

cc @AlexanderKgr @Pearl1594 @DaanHoogland

@Pearl1594
Copy link
Contributor

@weizhouapache I think you are right, we need to cleanup the halted VMs at some point and expunge seems fair.

@shwstppr
Copy link
Contributor Author

shwstppr commented May 8, 2025

@weizhouapache @Pearl1594 I'm not sure but maybe code can have some additional flag to see if expunge is called and destroy the halted VM.
I'm okay you guys think this should be reverted.

shwstppr added a commit to shapeblue/cloudstack that referenced this pull request May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Status: Abhishek's Bugfix List
Development

Successfully merging this pull request may close these issues.

Cannot restore VM snapshot on XenServer
8 participants