Skip to content

Maintenance mode caused stopped vms #11286

Closed

Description

@BartJM

problem

We had a vm that was migrated from host A to host B after putting host A into maintenance mode. The first attempt at maintenance mode had a Errorinmaintenance so maintenance was canceled and started again.

After maintenance was done and maintenance mode canceled on host A, host B was set in maintenance. This caused the vm to be migrated to host A again. Right after the migration to host A was finished Cloudstack attempted to migrate the vm to host B for maintenance. But due to host B being in maintenance the com.cloud.agent.api.PrepareForMigrationCommand failed with com.cloud.exception.AgentUnavailableException. This caused Cloudstack to stop the vm.

The time between maintenance cancel on Host A and the migrations of the vm was around 2 hours.

versions

Cloudstack 4.19.3

The steps to reproduce the bug

Currently trying to reproduce on our testing environment but the steps would be

  1. Host A: Put in maintenance
  2. Host A: Cancel maintenance
  3. Host A: Put in maintenance
  4. Host A: Wait for host to be in maintenance
  5. Host A: Cancel maintenance
  6. Host B: Put in maintenance

What to do about it?

We do not expect Cloudstack to stop the vm due to a failed prepare for migration.

Activity

  1. BartJM commented on Jul 29, 2025

    @BartJM
    ContributorAuthor

    I have been unable to reproduce the issue. I do have some additional info found:

    • Not all vms that were migrated from Host B to Host A had the same issue.
    • Found that the vms that were stopped had the migration started by c.c.h.HighAvailabilityManagerImpl, but I did not find the scheduling.
  2. DaanHoogland commented on Jul 31, 2025

    @DaanHoogland
    Contributor

    @BartJM , any updates on this. Have you considdered a ntp issue?
    another cause may have been that multiple migrate async jobs were created. Any chance you can do any forensic work on the DB?
    🤞

  3. BartJM commented on Jul 31, 2025

    @BartJM
    ContributorAuthor

    I had not considered ntp issues, but we keep sync with chrony, so not expecting that to be an issue.

    I think the cause is related to the multiple async maintenance jobs, since the stopped vms were not originally on Host A. I however expect that cancelling the maintenance and having the enabled state on the hypervisor does not start migrations due to a still present async job.

    The main issue however is that the vm was stopped by Cloudstack after the migration to the host in maintenance failed.

    Currently I do not have much time to further investigate, but if there are specific places in the db (or elsewhere) to look I will be able to check. Sadly was still not able to reproduce.

  4. DaanHoogland commented on Jul 31, 2025

    @DaanHoogland
    Contributor

    Currently I do not have much time to further investigate, but if there are specific places in the db (or elsewhere) to look I will be able to check. Sadly was still not able to reproduce.

    well, you’d need historic data of the async job table to get any meaningful info, i think.

    keep us updated,

  5. added this to the 4.19.4 milestone on Aug 19, 2025
  6. modified the milestones: 4.19.4, 4.20.2 on Sep 2, 2025
  7. modified the milestones: 4.20.2, 4.20.3 on Oct 23, 2025
  8. locked and limited conversation to collaborators on Jan 5, 2026
  9. converted this issue into a discussion #12370 on Jan 5, 2026
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

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions