Introduction
Diving into the ever-evolving world of Apache CloudStack, it is undeniable that its continuous enhancement has led it to become an influential infrastructure management platform. The recent feature addition, ‘Host Control Plane Status’, further refines this powerful tool by extending the hypervisor host control state in the listing of Virtual Machines / VMs (ie. user Instances, Virtual Routers, and System VMs). Specifically, it permits users to evaluate the feasibility of VM lifecycle actions like start / stop / restart / migrate, and to cross-verify the accuracy of VM metrics.
Host State and Resource State
Each Host in the Apache CloudStack environment contains two distinct fields to indicate the Host states: ‘State’ and ‘Resource State’. Each plays a crucial role in the overall functioning and operation of the Host.
Host Status
The “State” represents the operational condition of the Host. The possible states are as follows:
• Creating: The Host is being added to Apache CloudStack
• Connecting: The Host is connecting to Apache CloudStack
• Up: The Host is Up and ready for use
• Down: The Host is down
• Disconnected: The Host is disconnected
• Alert: There might be something wrong with the Host
• Removed: The Host has been removed from Apache CloudStack therefore not usable.
• Error: There are errors while adding a Host to Apache CloudStack
• Rebalancing: The Host is being rebalanced between management servers.
• Unknown: The Host state is unknown
Resource State
The “Resource State” signifies the availability of host resources such as CPU, memory, local storage, and so on. The possible resource states include:
• Creating: The Host resource is being created.
• Enabled: The Host resource is enabled, can use the resource on the host.
• Disabled: The Host resource is disabled. Cannot use the resource on the host.
• PrepareForMaintenance: The Host is being prepared for maintenance.
• ErrorInPrepareForMaintenance: Error while the Host is being prepared for maintenance.
• ErrorInMaintenance: Error while putting the Host to maintenance .
• Maintenance: The Host is in maintenance mode.
• Error: There are errors while creating the Host resource.
• Degraded: Admin declares the Host as Degraded.
Introducing Host Control Plane Status
Certain VM operations may fail if the commands cannot be dispatched to a Host that isn’t “Up” or if the resource state isn’t “Enabled”. Currently, only root Admin possesses permission to view the “State” and the “Resource State”. Neither of these states is accessible to Domain Admins and regular Users.
If the user VM response reflects the Host connectivity state, the user can ascertain whether CloudStack is capable of executing actions like start / stop / migrate.
This feature introduces a new “ControlState” class in CloudStack, establishing the Host Control state of VMs. The Host control state is derived from both the “State” and the “Resource State”. It encompasses the following values:
ControlState value | Description |
Enabled | The Host state is Creating / Connecting / Up and resource state is Enabled. |
Disabled | The Host state is Creating / Connecting / Up and resource state is Creating / Disabled / Error / Degraded. |
Maintenance | The Host state is Creating / Connecting / Up and resource state is and resource state is ErrorInPrepareForMaintenance / PrepareForMaintenance / ErrorInMaintenance / Maintenance. |
Offline | The Host state is Down / Disconnected / Alert / Removed / Error / Rebalancing. |
Unknown | The Host state is Unknown or resource state is Unknown. |
API changes
The property “hostcontrolstate” has been introduced in some CloudStack API responses.
CloudStack API | New property | Description |
ListVirtualMachines | hostcontrolstate | The Host control state for the Instance |
ListRouters | hostcontrolstate | The Host control state for the Virtual Router |
ListSystemVms | hostcontrolstate | The Host control state for the System VM |
Examples
The Host control state is shown for both admin and normal users on the details page. Certain actions on the UI are disabled based on the host control state of VMs:
- The Host control state is Enabled.
- Disabled (icons are same as Host control state is Enabled)
- The Host control state is Maintenance.
- The Host control state is Offline.
- The Host control state is Unknown (icons are same as Host control state is Enabled).
Conclusion
With the integration of the host control plane status in Apache CloudStack 4.18, this state is now included in the API responses related to Instances, System VMs, and Virtual Routers. This not only gives users a clearer picture of the state of the host running their Instances but also empowers them with the knowledge needed to manage VM lifecycle actions such as start / stop / restart. This feature significantly enhances user autonomy and operational efficiency.
References
[2] https://github.com/apache/cloudstack/pull/6946
Wei Zhou works as a Software Architect at ShapeBlue. He has many years experience on cloud computing and a passion for various cutting-edge knowledge. Wei works on software design and implementation, as well as resolving issues for customers and community users. Wei has been a committer of the Apache CloudStack project since 2013 and a PMC member since 2017.