cloudmesh-ai-vm API Reference
This page provides the API reference for the cloudmesh-ai-vm library.
API Documentation
Attributes
Classes
VMContext
dataclass
Functions:
cloud_callback
cmx
debug_callback
load_commands_recursively
Recursively scans the directory for .py files and folders, adding them as commands or subgroups to the provided group.
Source code in src/cloudmesh/ai/command/_shared/utils.py
register_providers
Registers all VM providers using entry points. This ensures that the provider map is populated before commands run.
Source code in src/cloudmesh/ai/command/_shared/providers_utils.py
verbose_callback
vm_group
VM management commands
Source code in src/cloudmesh/ai/command/vm/__init__.py
Modules
account
Functions:
cmd
List account information and resource limits for the current VM provider.
Source code in src/cloudmesh/ai/command/vm/account.py
cloud
config
Functions:
config_group
Modules
get
Functions:
Get a specific configuration value.
Source code in src/cloudmesh/ai/command/vm/config/get.py
init
Functions:
Initialize the VM CLI configuration.
list
Functions:
List all VM configuration settings.
Source code in src/cloudmesh/ai/command/vm/config/list.py
set
Functions:
Attempt to parse value as boolean, integer, or float; fallback to string.
Set a configuration value.
Source code in src/cloudmesh/ai/command/vm/config/set.py
delete
Classes
Functions:
delete
Deletes one or more VMs.
If a name is provided, it can be a single name or a hostlist specification (e.g. 'node[1-3]'). If --count is provided, it deletes the last N VMs created. If --range is provided, it deletes VMs in the specified index range (e.g. '1-5' -> username-1...username-5).
Example
cmx vm delete my-vm cmx vm delete "node[1-3]" cmx vm delete --count 3 cmx vm delete --range 1-5 cmx vm delete
Source code in src/cloudmesh/ai/command/vm/delete.py
doctor
Functions:
doctor
Diagnose the active VM provider without modifying any VM resources.
Checks provider resolution, local requirements, configuration, and provider information.
Source code in src/cloudmesh/ai/command/vm/doctor.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | |
flavor
Functions:
flavor
List available VM flavor.
Source code in src/cloudmesh/ai/command/vm/flavor.py
horizon
Functions:
cmd
Open the Horizon dashboard for the active cloud provider.
Source code in src/cloudmesh/ai/command/vm/horizon.py
image
Functions:
image
List available VM image.
Source code in src/cloudmesh/ai/command/vm/image.py
info
Classes
Functions:
info
Get detailed information about a specific VM.
Source code in src/cloudmesh/ai/command/vm/info.py
ip
Functions:
ip_group
Modules
assign
Functions:
Assign a floating IP to a VM.
Source code in src/cloudmesh/ai/command/vm/ip/assign.py
release
Functions:
Release the floating IP of a VM.
Source code in src/cloudmesh/ai/command/vm/ip/release.py
key
Functions:
key_group
Modules
upload
Compatibility shim for the cloudmesh.ai.command.vm.key.upload import.
Historically the vm key upload command lived in cloudmesh.ai.command.key
and the test suite expects it to be importable via the legacy path
cloudmesh.ai.command.vm.key.upload. The original module defines the Click
command upload_key and a cmd alias. To satisfy the test without
duplicating logic we re‑implement the command here by copying the implementation
from cloudmesh.ai.command.key.upload. This ensures that patching
get_active_provider on this module (as performed in the unit tests) works
as intended.
Classes
Functions:
Upload a public SSH key to the cloud provider.
This implementation mirrors the original upload_key command located in
cloudmesh.ai.command.key.upload. The logic is kept in sync to avoid
divergence between the legacy import path and the current command group.
Source code in src/cloudmesh/ai/command/vm/key/upload.py
list
Functions:
list_group
List VM resources.
Source code in src/cloudmesh/ai/command/vm/list.py
list_regions
List regions.
Source code in src/cloudmesh/ai/command/vm/list.py
list_vms
List VMs.
Source code in src/cloudmesh/ai/command/vm/list.py
login
Classes
Functions:
login
Log into a VM or get connection details. If name is omitted, the last started VM is used.
Source code in src/cloudmesh/ai/command/vm/login.py
provider
Functions:
provider_group
Modules
get
Functions:
Get the current default cloud provider.
Source code in src/cloudmesh/ai/command/vm/provider/get.py
info
Functions:
Display detailed information about the active VM provider.
Source code in src/cloudmesh/ai/command/vm/provider/info.py
list
Functions:
List all supported VM providers and their configuration status.
Source code in src/cloudmesh/ai/command/vm/provider/list.py
set
Functions:
Set the default cloud provider.
Source code in src/cloudmesh/ai/command/vm/provider/set.py
reservation
Functions:
reservation
Modules
duration
Classes
Functions:
Creates a reservation with a specified duration and relative start time.
Example
cmx vm reservation duration "my-lease" --node-type "compute_haswell" --count 1 --start +10m
Source code in src/cloudmesh/ai/command/vm/reservation/duration.py
Parses a relative time offset string like '+10m', '+2h', '+1d' and returns a timedelta object.
Source code in src/cloudmesh/ai/command/vm/reservation/duration.py
reset
Classes
Functions:
reset
Resets a VM or the provider service.
Example
cmx vm reset multipass
Source code in src/cloudmesh/ai/command/vm/reset.py
restart
Classes
Functions:
restart
Restarts one or more VMs.
If a name is provided, it can be a single name or a hostlist specification (e.g. 'node[1-3]'). If --count is provided, it restarts the last N VMs created. If --range is provided, it restarts VMs in the specified index range (e.g. '1-5' -> username-1...username-5).
Example
cmx vm restart my-vm cmx vm restart "node[1-3]" cmx vm restart --count 3 cmx vm restart --range 1-5 cmx vm restart
Source code in src/cloudmesh/ai/command/vm/restart.py
run
Classes
Functions:
run
Executes a command on a VM.
Example
cmx vm run my-vm "ls -la /home" cmx vm run "ls -la /home"
Source code in src/cloudmesh/ai/command/vm/run.py
security_group
Classes
Functions:
add_rule
Add a rule to a security group.
Source code in src/cloudmesh/ai/command/vm/security_group.py
add_sg_to_vm
Associate a security group with a VM.
Source code in src/cloudmesh/ai/command/vm/security_group.py
create_sg
Create a new security group.
Source code in src/cloudmesh/ai/command/vm/security_group.py
delete_sg
Delete a security group.
Source code in src/cloudmesh/ai/command/vm/security_group.py
get_public_ip
Fetch the current public IP of the machine.
Source code in src/cloudmesh/ai/command/vm/security_group.py
list_rules
List rules for a security group.
Source code in src/cloudmesh/ai/command/vm/security_group.py
list_sgs
List VM security groups.
Source code in src/cloudmesh/ai/command/vm/security_group.py
remove_rule
Remove a rule from a security group.
Source code in src/cloudmesh/ai/command/vm/security_group.py
remove_sg_from_vm
Remove a security group from a VM.
Source code in src/cloudmesh/ai/command/vm/security_group.py
resolve_cidr
Resolves special CIDR placeholders.
CURRENT_IP requires an external network request. For security and test
robustness we translate any failure to a generic RuntimeError to avoid
leaking underlying exception details (e.g., authentication tokens) to the
caller. This matches the expectations of the unit tests.
Source code in src/cloudmesh/ai/command/vm/security_group.py
rule_group
security_group
Manage VM security groups.
Source code in src/cloudmesh/ai/command/vm/security_group.py
sg_info
Get detailed information for a specific security group.
Source code in src/cloudmesh/ai/command/vm/security_group.py
shelve
Classes
Functions:
shelve
Shelve one or more VMs (OpenStack only).
If a name is provided, it can be a single name or a hostlist specification (e.g. 'node[1-3]'). If --count is provided, it shelves the last N VMs created. If --range is provided, it shelves VMs in the specified index range (e.g. '1-5' -> username-1...username-5).
Example
cmx vm shelve my-vm cmx vm shelve "node[1-3]" cmx vm shelve --count 3 cmx vm shelve --range 1-5 cmx vm shelve
Source code in src/cloudmesh/ai/command/vm/shelve.py
ssh
Classes
Functions:
ssh
Start an interactive SSH session with the VM. If name is omitted, the last started VM is used.
Source code in src/cloudmesh/ai/command/vm/ssh.py
ssh_config
Functions:
ssh_config
Generate SSH configuration for the VM.
Source code in src/cloudmesh/ai/command/vm/ssh_config.py
start
Classes
Functions:
start
start(ctx, name=None, count=None, vm_range=None, ip='yes', noip=False, duration=None, cloud=None, debug=False, verbose=False, **kwargs)
Starts or launches VMs.
If a name is provided, it can be a single name or a hostlist specification (e.g. 'node[1-3]'). If --count is provided, it starts the specified number of VMs using automatic naming. If --range is provided, it starts VMs in the specified index range (e.g. '1-5' -> username-1...username-5).
Example
cmx vm start my-vm cmx vm start "node[1-3]" cmx vm start --count 3 cmx vm start --range 1-5 cmx vm start
Source code in src/cloudmesh/ai/command/vm/start.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | |
stop
Classes
Functions:
stop
Stops one or more VMs.
If a name is provided, it can be a single name or a hostlist specification (e.g. 'node[1-3]'). If --count is provided, it stops the last N VMs created. If --range is provided, it stops VMs in the specified index range (e.g. '1-5' -> username-1...username-5).
Example
cmx vm stop my-vm cmx vm stop "node[1-3]" cmx vm stop --count 3 cmx vm stop --range 1-5 cmx vm stop
Source code in src/cloudmesh/ai/command/vm/stop.py
suspend
Classes
Functions:
suspend
Suspends one or more VMs.
If a name is provided, it can be a single name or a hostlist specification (e.g. 'node[1-3]'). If --count is provided, it suspends the last N VMs created. If --range is provided, it suspends VMs in the specified index range (e.g. '1-5' -> username-1...username-5).
Example
cmx vm suspend my-vm cmx vm suspend "node[1-3]" cmx vm suspend --count 3 cmx vm suspend --range 1-5 cmx vm suspend
Source code in src/cloudmesh/ai/command/vm/suspend.py
unshelve
Classes
Functions:
unshelve
Unshelve one or more VMs (OpenStack only).
If a name is provided, it can be a single name or a hostlist specification (e.g. 'node[1-3]'). If --count is provided, it unshelves the last N VMs created. If --range is provided, it unshelves VMs in the specified index range (e.g. '1-5' -> username-1...username-5).
Example
cmx vm unshelve my-vm cmx vm unshelve "node[1-3]" cmx vm unshelve --count 3 cmx vm unshelve --range 1-5 cmx vm unshelve