1. Host Status and Resource State

When VM is running on a host, the host has two states:


2. VM actions on KVM (v.s. Host Status and Resource State)

Depends on host status and resource state, some VM actions are allowed or disallowed. Below is a summary of VM actions:

Result of VM Actions

Host Status=Up

Resource state=Enabled

Host Status=Disconnected

Resource state=Enabled

Host Status=Up

Resource state=Disabled

Host Status=Up

Resource state=PrepareForMaintenance/ErrorInMaintenance

Host Status=Down

Resource state=Enabled

Start VM

Stopped VM only

Stopped VM only

Stopped VM only

Stopped VM only

Stopped VM only

Stop VM (forced=false)

yes (does not work, if vm state is Destroyed,Expunging,Error)

no

yes

no (if host resource state is PrepareForMaintenance. error: Stop VM operation on the VM id: 6 is not allowed as host is preparing for maintenance mode)

yes (if host resource state is other state)

no (Unable to stop VM instance)

Stop VM (forced=true)

yes (does not work, if vm state is Destroyed,Expunging,Error)

yes

yes

yes

yes

View console

yes (works for Starting/Stopping/Migrating/Running vms)

Failed to connect to server

yes

yes

no (Server Internal Error)

Update VM

yes (does not work for Error/Expunging VMs)

yes

yes

yes

yes

Reboot VM (forced=false)

yes

no (if host status is Disconnected or resource state is PrepareForMaintenance)

yes

no (because agent ref-trl-3842-k-M7-wei-zhou-kvm2 is in maintenance mode)

no (Host 2: Host with specified id is not in the right state: Down)

Reboot VM (forced=true)

yes

no (Unable to force reboot the VM as the host: 1 is not in the right state)

no (Unable to force reboot the VM as the host: 2 is not in the right state)

no (Unable to force reboot the VM as the host: 2 is not in the right state)

no ( Unable to force reboot the VM as the host: 2 is not in the right state)

Restore VM (=Reinstall)

yes

no

yes

same as "Stop VM (forced=false)"

no (Unable to stop VM instance )

Migrate VM

yes

no (Host with specified id is not in the right state: Disconnected)

yes

yes

no (Command failed due to Internal Server Error)

Migrate VM with volume

no (libvirt issue)

no (Host with specified id is not in the right state: Disconnected)

Bug: volume is stuck at Migrating state

no (libvirt issue)

no (libvirt issue)

no (Command failed due to Internal Server Error)

Destroy VM (vm.destroy.forcestop=true)

yes

yes

yes

yes

yes

Destroy VM (vm.destroy.forcestop=false)

yes

no (Host 2 is not up)

yes

yes

no (Unable to stop VM instance)

Expunge VM

same as Destroy VM

same as Destroy VM

same as Destroy VM

same as Destroy VM

same as Destroy VM

Recover VM

Destroyed VM only

Destroyed VM only

Destroyed VM only

Destroyed VM only

Destroyed VM only

Scale VM

(not working with non-dynamic offering)

-

-

-

-

Assign VM

Stopped VM only

Stopped VM only

Stopped VM only

Stopped VM only

Stopped VM only

Update VM affinity group

Stopped VM only

Stopped VM only

Stopped VM only

Stopped VM only

Stopped VM only

Unmanage VM

Running/Stopped User VM on vmware only

-

-

-

-







Take VM Snapshot

yes

no (Unexpected exception)

yes

no (Unexpected exception - because agent ref-trl-3842-k-M7-wei-zhou-kvm2 is in maintenance mode)

no (Unexpected exception)

Remove VM snapshot

yes

no (Failed to delete vm snapshot)

yes

no (Failed to delete vm snapshot - because agent ref-trl-3842-k-M7-wei-zhou-kvm2 is in maintenance mode)

no (Failed to delete vm snapshot)

Revert VM snapshot

yes

no (Unexpected exception)

yes

no (Unexpected exception)

no (Unexpected exception)







Attach ISO

yes

no (Failed to attach iso)

yes

no (Failed to attach iso- because agent ref-trl-3842-k-M7-wei-zhou-kvm2 is in maintenance mode)

no (Failed to attach iso)

Detach ISO

yes

no (Failed to detach iso)

yes

no (Failed to detach iso)

no (Failed to detach iso)







Attach volume

yes

no (Host with specified id is not in the right state: Disconnected)

yes

no (Failed to attach volume DATA-test to VM admin-0012 due to: Resource [Host:2] is unreachable: Host 2: Unable to send class org.apache.cloudstack.storage.command.AttachCommand because agent ref-trl-3842-k-M7-wei-zhou-kvm2 is in maintenance mode)

no (Failed to attach volume DATA-test to VM admin-0013 due to: Resource [Host:2] is unreachable: Host 2: Host with specified id is not in the right state: Down)

Detach volume

yes

no (Host with specified id is not in the right state: Disconnected)

yes

no (because agent ref-trl-3842-k-M7-wei-zhou-kvm2 is in maintenance mode)

no (Failed to detach volume DATA-test from VM admin-003 due to: Resource [Host:2] is unreachable: Host 2: Host with specified id is not in the right state: Down)

Resize volume

yes

no (The KVM host where vm is running is not Up)

no (The KVM host where vm is running is not Enabled)

no (The KVM host where vm is running is not Enabled)

no (The KVM host where vm is running is not Up)

Take volume snapshot

yes

no (Failed to create snapshot due to an internal error - [Host:2] is unreachable: Host 2: Host with specified id is not in the right state: Disconnected)

yes

no (Failed to create snapshot due to an internal error - Unable to send class org.apache.cloudstack.storage.command.CreateObjectCommand because agent ref-trl-3842-k-M7-wei-zhou-kvm2 is in maintenance mode)

no (Failed to create snapshot due to an internal error creating snapshot for volume 7960155f-c7be-4abb-a0d0-c4226fc85362)

Revert volume snapshot

no (The VM the specified disk is attached to is not in the shutdown state.)

no (The VM the specified disk is attached to is not in the shutdown state.)

no (The VM the specified disk is attached to is not in the shutdown state.)

no (The VM the specified disk is attached to is not in the shutdown state.)

no (The VM the specified disk is attached to is not in the shutdown state.)

Delete volume snapshot

yes

yes

yes

yes

yes







Reset SSH key

Stopped VM only

Stopped VM only

Stopped VM only

Stopped VM only

Stopped VM only

Reset vm password

Stopped VM only

Stopped VM only

Stopped VM only

Stopped VM only

Stopped VM only







Add NIC

yes

no (Host with specified id is not in the right state: Disconnected)

yes

no (because agent ref-trl-3842-k-M7-wei-zhou-kvm2 is in maintenance mode)

no (Resource [Host:2] is unreachable: Host 2: Host with specified id is not in the right state: Down)

Remove NIC

yes

no (Host with specified id is not in the right state: Disconnected)

yes

no (because agent ref-trl-3842-k-M7-wei-zhou-kvm2 is in maintenance mode)

no (Resource [Host:2] is unreachable: Host 2: Host with specified id is not in the right state: Down)

Update default NIC

yes

yes

yes

yes

yes

Change IP Address

no (VM is not Stopped)

no (VM is not Stopped)

no (VM is not Stopped)

no (VM is not Stopped)

no (VM is not Stopped)







VM statistics / metricsyes, updatedNot updatedyes, updatedNot updatedNot updated


3. Host control state matrix (and VM actions on KVM)


The host control state is determined by host status and host resource state. It has the following values.

  • ControlState = Enabled, if host status is Creating/ Connecting/ Up and resource state is Enabled
  • ControlState = Disabled, if host status is Creating/ Connecting/ Up and resource state is Creating/Disabled/Error/Degraded
  • ControlState = Maintenance, if host status is Creating/ Connecting/ Up and resource state is and resource state is ErrorInPrepareForMaintenance/ PrepareForMaintenance/ ErrorInMaintenance/ Maintenance
  • ControlState = Offline, if host status is Down/ Disconnected/ Alert/ Removed/ Error/ Rebalancing
  • ControlState = Unknown, if host status is Unknown or resource state is Unknown.


Resource state (right)


Host Status (below)

Enabled

Creating

Disabled

Error

Degraded

ErrorInPrepareForMaintenance

PrepareForMaintenance

ErrorInMaintenance

Maintenance

Creating

Connecting

Up

Control State: Enabled


(1) Disallowed VM actions for Enabled hosts:

  • recover
  • assign
  • update affintiygroup
  • revert volume snapshot
  • reset SSH key
  • reset password
  • change IP address


Please note:

  • VM statistics / metrics is updated


Control State: Disabled


(2) Disallowed VM actions for Disabled hosts:

  • All actions in Up/Enabled host (see 1)
  • resize volume
  • reboot VM (forced=true), equals to stop/start VM


Please note:

  • VM statistics / metrics is updated

Control State: Maintenance


(3) Disallowed VM actions for Maintenance hosts:

  • All Disallowed actions for Enabled host (see 1)
  • All Disallowed actions for Disabled host (see 2)
  • reboot VM (forced=false)
  • stop VM (only if host resource state = PrepareForMaintenance)
  • restore VM (only if host resource state = PrepareForMaintenance)
  • attach ISO
  • detach ISO
  • attach volume
  • detach volume
  • create VM snapshot
  • revert VM snapshot
  • delete VM snapshot
  • take volume snapshot
  • add nic
  • remove nic


Please note:

  • VM statistics / metrics is NOT updated

Down

Disconnected

Alert

Removed

Error

Rebalancing

Control State: Offline


(4) Disallowed VM actions for Disconnected hosts:

  • All Disallowed actions for Enabled host (see 1)
  • All Disallowed actions for Disabled host (see 2)
  • All Disallowed actions for Maintenance host (see 3)
  • vm console
  • stop vm (forced=false)
  • migrate VM
  • migrate VM with volumes


Please note:

  • VM statistics / metrics is NOT updated

Control State: Offline


Control State: Offline

Unknown

Control State: Unknown

Unknown

Unknown


  • No labels