Skip to content

VM HA failing to restart on another primary storage #12215

Closed

Description

@DaanHoogland

Action: Enable HA on a user VM → prepare primary storage pool for maintenance.
Expected Result: HA VM automatically restarts on the alternate storage pool, stable after cancel maintenance.
Actual Result: HA VM remains in Stopped state - does NOT auto-restart on alternate pool.

Evidence

Baseline: Environment Setup

Zone, Cluster, and Hosts confirmed operational:

Primary Storage 1 and Primary Storage 2 are in Up state:

(localcloud) 🐱 > list storagepools filter=name,id,state
{
  "count": 2,
  "storagepool": [
    {
      "id": "1383bf9b-b82e-3566-9bca-769b4b69227d",
      "name": "ref-trl-10333-k-Mol8-rositsa-kyuchukova-kvm-pri1",
      "state": "Up"
    },
    {
      "id": "d2d00507-fb67-3329-a32d-775c637a0ba3",
      "name": "ref-trl-10333-k-Mol8-rositsa-kyuchukova-kvm-pri2",
      "state": "Up"
    }
  ]
}

Database clean - no stale records:

mysql> SELECT * FROM storage_pool_work;
Empty set (0.00 sec)

Test Setup: Created HA-enabled Service Offering and Deployed Test VMs

(localcloud) 🐱 > create serviceoffering name=Small-HA-Instance displaytext="Small Instance with HA" cpunumber=1 cpuspeed=1000 memory=512 offerha=true
{
  "serviceoffering": {
    "id": "e601bccc-9446-4c31-bae5-5f873bb6c712",
    "name": "Small-HA-Instance",
    "offerha": true
  }
}

Deployed two VMs - one with HA, one without:

(localcloud) 🐱 > list virtualmachines filter=name,id,instancename,state,hostname,haenable
{
  "count": 2,
  "virtualmachine": [
    {
      "haenable": false,
      "hostname": "ref-trl-10333-k-Mol8-rositsa-kyuchukova-kvm2",
      "id": "b65f682e-08de-4e8f-afce-004f4d4054f2",
      "instancename": "i-2-3-VM",
      "name": "test-vm-no-ha",
      "state": "Running"
    },
    {
      "haenable": true,
      "hostname": "ref-trl-10333-k-Mol8-rositsa-kyuchukova-kvm2",
      "id": "b7cffaf4-04c6-4c2a-9bd5-2c2ac7fe03df",
      "instancename": "i-2-5-VM",
      "name": "test-vm-ha",
      "state": "Running"
    }
  ]
}

Pre-Maintenance: VM Storage Location

HA VM (i-2-5-VM) hosted on Primary Storage 1 (ID: 1383bf9b-b82e-3566-9bca-769b4b69227d):

[root@ref-trl-10333-k-Mol8-rositsa-kyuchukova-kvm2 ~]# virsh dumpxml i-2-5-VM | grep "source file"
      <source file='/mnt/1383bf9b-b82e-3566-9bca-769b4b69227d/45e68b66-c706-43e9-82bb-5e421411d072' index='2'/>
        <source file='/mnt/1383bf9b-b82e-3566-9bca-769b4b69227d/a4658949-d4f9-11f0-b96d-1e001100042d'/>

Non-HA VM (i-2-3-VM) hosted on Primary Storage 2 (ID: d2d00507-fb67-3329-a32d-775c637a0ba3):

[root@ref-trl-10333-k-Mol8-rositsa-kyuchukova-kvm2 ~]# virsh dumpxml i-2-3-VM | grep "source file"
      <source file='/mnt/d2d00507-fb67-3329-a32d-775c637a0ba3/21b3676b-993d-4245-ad01-73de2afaba51' index='2'/>
        <source file='/mnt/d2d00507-fb67-3329-a32d-775c637a0ba3/a4658949-d4f9-11f0-b96d-1e001100042d'/>

Enabled Maintenance on Primary Storage 1

(localcloud) 🐱 > enableStorageMaintenance id=1383bf9b-b82e-3566-9bca-769b4b69227d
{
  "storagepool": {
    "id": "1383bf9b-b82e-3566-9bca-769b4b69227d",
    "jobid": "e2253689-fe35-4967-9651-a43016484f8a",
    "jobstatus": 0,
    "name": "ref-trl-10333-k-Mol8-rositsa-kyuchukova-kvm-pri1",
    "state": "Maintenance"
  }
}

Post-Maintenance Results

Storage Pool State:

(localcloud) 🐱 > list storagepools filter=name,id,state
{
  "count": 2,
  "storagepool": [
    {
      "id": "1383bf9b-b82e-3566-9bca-769b4b69227d",
      "name": "ref-trl-10333-k-Mol8-rositsa-kyuchukova-kvm-pri1",
      "state": "Maintenance"
    },
    {
      "id": "d2d00507-fb67-3329-a32d-775c637a0ba3",
      "name": "ref-trl-10333-k-Mol8-rositsa-kyuchukova-kvm-pri2",
      "state": "Up"
    }
  ]
}

VM States - HA VM did NOT auto-restart:

(localcloud) 🐱 > list virtualmachines filter=name,instancename,state,hostname,haenable
{
  "count": 2,
  "virtualmachine": [
    {
      "haenable": false,
      "hostname": "ref-trl-10333-k-Mol8-rositsa-kyuchukova-kvm2",
      "instancename": "i-2-3-VM",
      "name": "test-vm-no-ha",
      "state": "Running"
    },
    {
      "haenable": true,
      "instancename": "i-2-5-VM",
      "name": "test-vm-ha",
      "state": "Stopped"
    }
  ]
}

HA VM not running on hypervisor:

[root@ref-trl-10333-k-Mol8-rositsa-kyuchukova-kvm2 ~]# virsh list --all
 Id   Name       State
--------------------------
 1    v-2-VM     running
 2    r-4-VM     running
 3    i-2-3-VM   running

Database Evidence:

mysql> SELECT * FROM storage_pool_work;
+----+---------+-------+-------------------------+---------------------------+----------------+
| id | pool_id | vm_id | stopped_for_maintenance | started_after_maintenance | mgmt_server_id |
+----+---------+-------+-------------------------+---------------------------+----------------+
|  1 |       1 |     1 |                       1 |                         1 | 32985634047021 |
|  2 |       1 |     5 |                       1 |                         0 | 32985634047021 |
+----+---------+-------+-------------------------+---------------------------+----------------+
2 rows in set (0.00 sec)

vm_id=5 (HA VM i-2-5-VM): stopped_for_maintenance=1, started_after_maintenance=0 ✗ Should be 1

Originally posted by @rosi-shapeblue in #11789 (comment)

Activity

  1. added this to the 4.20.3 milestone on Dec 9, 2025
  2. added theissue type on Dec 10, 2025
  3. abh1sar commented on Jan 14, 2026

    @abh1sar
    Contributor

    When a storage is put on maintenance, Cloudstack stops all guests that have any volume on that storage device.
    https://docs.cloudstack.apache.org/en/4.22.0.0/adminguide/storage.html#maintenance-mode-for-primary-storage

    Since Cloudstack itself stopped the user VMs during Prepare for Maintenance, VM HA is not triggered.
    I think this is an expected behaviour.

    Thoughts? @DaanHoogland @RosiKyu

  4. self-assigned this
    on Jan 14, 2026
  5. DaanHoogland commented on Jan 14, 2026

    @DaanHoogland
    ContributorAuthor

    Since Cloudstack itself stopped the user VMs during Prepare for Maintenance, VM HA is not triggered. I think this is an expected behaviour.

    Though it might be expected, it might not be desirable for the operator. It also might not be expected. Maybe we can address this in documentation and add a future feature request to change the behaviour. The documentation can be augmented with a note about HA enabled VMs being stopped as well. (It feels like something the operator would want automated though)

  6. abh1sar commented on Jan 14, 2026

    @abh1sar
    Contributor

    Thanks @DaanHoogland.

    The behaviour could be changed controlled by a global setting. As you mentioned that would be a new feature request.
    Created the doc PR and the new feature request.

  7. moved this from Discuss to ready for Review in Apache CloudStack BugFest - Issueson Jan 14, 2026
  8. removed their assignment
    on Jan 14, 2026
  9. abh1sar commented on Jan 15, 2026

    @abh1sar
    Contributor

    Doc PR is merged. Closing this issue as the new feature request is created.

  10. vishesh92 commented on Jan 15, 2026

    @vishesh92
    Member

    Closing since this is addressed in docs apache/cloudstack-documentation#619
    and the feature request is being tracked in #12423

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions