isphere.command module
The isphere command classes.
# Copyright (c) 2014-2015 Maximilien Riehl <max@riehl.io> # This work is free. You can redistribute it and/or modify it under the # terms of the Do What The Fuck You Want To Public License, Version 2, # as published by Sam Hocevar. See the COPYING.wtfpl file for more details. # """ The isphere command classes. """ import cmd import cmd2 from isphere.command.core_command import CoreCommand from isphere.command.esx_command import EsxCommand from isphere.command.virtual_machine_command import VirtualMachineCommand from isphere.command.dvs_command import DvsCommand __pdoc__ = {} class VSphereREPL(EsxCommand, VirtualMachineCommand, DvsCommand): """ The isphere REPL command class. """ for field in cmd.Cmd.__dict__.keys(): __pdoc__['VSphereREPL.%s' % field] = None for field in cmd2.Cmd.__dict__.keys(): __pdoc__['VSphereREPL.%s' % field] = None def __init__(self, hostname=None, username=None, password=None): """ Create a new REPL that connects to a vmware vCenter. - hostname (type `str`) is the vCenter host name. Can be `None` and will result in a prompt. - username (type `str`) is the vCenter user name. Can be `None` and will result in a prompt. - password (type `str`) is the vCenter password. Can be `None` and will result in a prompt. """ self.hostname = hostname self.username = username self.password = password CoreCommand.__init__(self) def cmdloop(self, **kwargs): """ Launches a REPL and swallows `KeyboardInterrupt`s. """ try: cmd2.Cmd.cmdloop(self, **kwargs) except KeyboardInterrupt: print("Quit with Ctrl+D or `EOF`.") self.cmdloop(**kwargs)
Classes
class VSphereREPL
The isphere REPL command class.
class VSphereREPL(EsxCommand, VirtualMachineCommand, DvsCommand): """ The isphere REPL command class. """ for field in cmd.Cmd.__dict__.keys(): __pdoc__['VSphereREPL.%s' % field] = None for field in cmd2.Cmd.__dict__.keys(): __pdoc__['VSphereREPL.%s' % field] = None def __init__(self, hostname=None, username=None, password=None): """ Create a new REPL that connects to a vmware vCenter. - hostname (type `str`) is the vCenter host name. Can be `None` and will result in a prompt. - username (type `str`) is the vCenter user name. Can be `None` and will result in a prompt. - password (type `str`) is the vCenter password. Can be `None` and will result in a prompt. """ self.hostname = hostname self.username = username self.password = password CoreCommand.__init__(self) def cmdloop(self, **kwargs): """ Launches a REPL and swallows `KeyboardInterrupt`s. """ try: cmd2.Cmd.cmdloop(self, **kwargs) except KeyboardInterrupt: print("Quit with Ctrl+D or `EOF`.") self.cmdloop(**kwargs)
Ancestors (in MRO)
- VSphereREPL
- isphere.command.esx_command.EsxCommand
- isphere.command.core_command.CoreCommand
- cmd2.Cmd
- cmd.Cmd
- isphere.command.virtual_machine_command.VirtualMachineCommand
- isphere.command.dvs_command.DvsCommand
Class variables
var field
Instance variables
var cache
Inheritance:
isphere.command.core_command.CoreCommand
.isphere.command.core_command.CoreCommand.cache
var prompt
Inheritance:
isphere.command.core_command.CoreCommand
.isphere.command.core_command.CoreCommand.prompt
Methods
def compile_and_yield_dvs_patterns(
self, patterns, risky=True)
Inheritance:
isphere.command.dvs_command.DvsCommand
.isphere.command.dvs_command.DvsCommand.compile_and_yield_dvs_patterns
def compile_and_yield_dvs_patterns(self, patterns, risky=True): return self.compile_and_yield_generic_patterns(patterns, self.yield_dvs_patterns, self.cache.number_of_dvses, risky)
def compile_and_yield_esx_patterns(
self, patterns, risky=True)
Inheritance:
isphere.command.esx_command.EsxCommand
.isphere.command.esx_command.EsxCommand.compile_and_yield_esx_patterns
def compile_and_yield_esx_patterns(self, patterns, risky=True): return self.compile_and_yield_generic_patterns(patterns, self.yield_esx_patterns, self.cache.number_of_esxis, risky)
def compile_and_yield_generic_patterns(
self, patterns, pattern_generator, item_count, risky=True)
Inheritance:
isphere.command.esx_command.EsxCommand
.isphere.command.esx_command.EsxCommand.compile_and_yield_generic_patterns
Compiles and returns regular expression patterns. Swallows the exception and complains if the patterns are invalid. Optionally (yes by default), warns and prompts in case no pattern was given.
- patterns (type
str
): A space delimited sequence of regular expression patterns. - pattern_generator (type
callable
): A function that, given a list of patterns, will return matching item names. - item_count (type
int
): The number of available items before pattern matching. - risky (type
bool
, defaultTrue
): Whether to warn when no patterns are given.
def compile_and_yield_generic_patterns(self, patterns, pattern_generator, item_count, risky=True): """ Compiles and returns regular expression patterns. Swallows the exception and complains if the patterns are invalid. Optionally (yes by default), warns and prompts in case no pattern was given. - patterns (type `str`): A space delimited sequence of regular expression patterns. - pattern_generator (type `callable`): A function that, given a list of patterns, will return matching item names. - item_count (type `int`): The number of available items before pattern matching. - risky (type `bool`, default `True`): Whether to warn when no patterns are given. """ if not patterns and risky: unformatted_message = "No pattern specified - you're doing this to all {count} items. Proceed? (y/N) " message = unformatted_message.format(count=self.colorize(str(item_count), "red")) if not _input(message).lower() == "y": return [] actual_patterns = patterns.strip().split(" ") try: compiled_patterns = [re.compile(pattern) for pattern in actual_patterns] except Exception as e: print(self.colorize("Invalid regular expression patterns: {0}".format(e), "red")) return [] return pattern_generator(compiled_patterns)
def compile_and_yield_vm_patterns(
self, patterns, risky=True)
Inheritance:
isphere.command.virtual_machine_command.VirtualMachineCommand
.isphere.command.virtual_machine_command.VirtualMachineCommand.compile_and_yield_vm_patterns
def compile_and_yield_vm_patterns(self, patterns, risky=True): return self.compile_and_yield_generic_patterns(patterns, self.yield_vm_patterns, self.cache.number_of_vms, risky)
def do_alarms_vm(
self, patterns)
Inheritance:
isphere.command.virtual_machine_command.VirtualMachineCommand
.isphere.command.virtual_machine_command.VirtualMachineCommand.do_alarms_vm
Usage: alarms_vm [pattern1 [pattern2]...] Show alarm information for vms matching the given ORed name patterns.
Sample usage: alarms MY_VM_NAME
def do_alarms_vm(self, patterns): """Usage: alarms_vm [pattern1 [pattern2]...] Show alarm information for vms matching the given ORed name patterns. Sample usage: `alarms MY_VM_NAME` """ for vm_name in self.compile_and_yield_vm_patterns(patterns): print("-" * 70) print("Alarms for {0}".format(vm_name)) alarms = self.retrieve_vm(vm_name).triggeredAlarmState for alarm in alarms: print("\talarm_moref: {0}".format(alarm.key.split('.')[0])) print("\talarm status: {0}".format(alarm.overallStatus))
def do_config_vm(
self, patterns)
Inheritance:
isphere.command.virtual_machine_command.VirtualMachineCommand
.isphere.command.virtual_machine_command.VirtualMachineCommand.do_config_vm
Usage: config_vm [pattern1 [pattern2]...] Show the full config of vms matching the given ORed name patterns. Careful, there's lots of output!
Sample usage: config MY_VM_NAME
def do_config_vm(self, patterns): """Usage: config_vm [pattern1 [pattern2]...] Show the full config of vms matching the given ORed name patterns. Careful, there's lots of output! Sample usage: `config MY_VM_NAME` """ for vm_name in self.compile_and_yield_vm_patterns(patterns): print("-" * 70) print("Config for {0}:".format(vm_name)) print(self.retrieve_vm(vm_name).config) print()
def do_eval_dvs(
self, line)
Inheritance:
isphere.command.dvs_command.DvsCommand
.isphere.command.dvs_command.DvsCommand.do_eval_dvs
Usage: eval_dvs [pattern1 [pattern2]...] ! dvs
.
Calling the function no_output
will not produce any output (use this
to filter).
Sample usage:
eval MY_DVS_NAME ! filter(lambda field_name: callable(getattr(dvs, field_name)) and not field_name.startswith("_"), dir(dvs))
^ shows 'public' methods we can call on the dvs object
eval MY_DVS_NAME ! dvs.name
* eval_dvs ! dvs.overallStatus if dvs.overallStatus != "green" else no_output()
^ shows overall status of dvs hosts unless they have the "green" status
def do_eval_dvs(self, line): """Usage: eval_dvs [pattern1 [pattern2]...] ! <statement> Evaluate a statement of python code. You can access the dvs object by using the variable `dvs`. Calling the function `no_output` will not produce any output (use this to filter). Sample usage: * `eval MY_DVS_NAME ! filter(lambda field_name: callable(getattr(dvs, field_name)) and not field_name.startswith("_"), dir(dvs))` ^ shows 'public' methods we can call on the dvs object * `eval MY_DVS_NAME ! dvs.name` * `eval_dvs ! dvs.overallStatus if dvs.overallStatus != "green" else no_output()` ^ shows overall status of dvs hosts unless they have the "green" status """ self.eval(line, self.compile_and_yield_dvs_patterns, self.retrieve_dvs, "dvs")
def do_eval_esx(
self, line)
Inheritance:
isphere.command.esx_command.EsxCommand
.isphere.command.esx_command.EsxCommand.do_eval_esx
Usage: eval_esx [pattern1 [pattern2]...] ! esx
.
Calling the function no_output
will not produce any output (use this
to filter).
Sample usage:
eval MY_ESX_NAME ! filter(lambda field_name: callable(getattr(esx, field_name)) and not field_name.startswith("_"), dir(esx))
^ shows 'public' methods we can call on the esx object
eval MY_ESX_NAME ! esx.name
* eval_esx ! esx.overallStatus if esx.overallStatus != "green" else no_output()
^ shows overall status of esx hosts unless they have the "green" status
def do_eval_esx(self, line): """Usage: eval_esx [pattern1 [pattern2]...] ! <statement> Evaluate a statement of python code. You can access the esx object by using the variable `esx`. Calling the function `no_output` will not produce any output (use this to filter). Sample usage: * `eval MY_ESX_NAME ! filter(lambda field_name: callable(getattr(esx, field_name)) and not field_name.startswith("_"), dir(esx))` ^ shows 'public' methods we can call on the esx object * `eval MY_ESX_NAME ! esx.name` * `eval_esx ! esx.overallStatus if esx.overallStatus != "green" else no_output()` ^ shows overall status of esx hosts unless they have the "green" status """ self.eval(line, self.compile_and_yield_esx_patterns, self.retrieve_esx, "esx")
def do_eval_vm(
self, line)
Inheritance:
isphere.command.virtual_machine_command.VirtualMachineCommand
.isphere.command.virtual_machine_command.VirtualMachineCommand.do_eval_vm
Usage: eval_vm [pattern1 [pattern2]...] ! vm
.
Calling the function no_output
will not produce any output (use this
to filter).
Sample usage:
eval MY_VM_NAME ! filter(lambda field_name: callable(getattr(vm, field_name)) and not field_name.startswith("_"), dir(vm))
^ shows 'public' methods we can call on the vm object
eval MY_VM_NAME ! vm.name
* eval MY_VM_NAME ! vm.RebootGuest()
def do_eval_vm(self, line): """Usage: eval_vm [pattern1 [pattern2]...] ! <statement> Evaluate a statement of python code. You can access the virtual machine object by using the variable `vm`. Calling the function `no_output` will not produce any output (use this to filter). Sample usage: * `eval MY_VM_NAME ! filter(lambda field_name: callable(getattr(vm, field_name)) and not field_name.startswith("_"), dir(vm))` ^ shows 'public' methods we can call on the vm object * `eval MY_VM_NAME ! vm.name` * `eval MY_VM_NAME ! vm.RebootGuest()` """ self.eval(line, self.compile_and_yield_vm_patterns, self.retrieve_vm, "vm")
def do_info_vm(
self, patterns)
Inheritance:
isphere.command.virtual_machine_command.VirtualMachineCommand
.isphere.command.virtual_machine_command.VirtualMachineCommand.do_info_vm
Usage: info_vm [pattern1 [pattern2]...] Show quick info about vms matching the given ORed name patterns.
Sample usage: info MY_VM_NAME
def do_info_vm(self, patterns): """Usage: info_vm [pattern1 [pattern2]...] Show quick info about vms matching the given ORed name patterns. Sample usage: `info MY_VM_NAME` """ custom_attributes_mapping = self.cache.get_custom_attributes_mapping() for vm_name in self.compile_and_yield_vm_patterns(patterns): vm = self.retrieve_vm(vm_name) print("-" * 70) print("Name: {0}".format(vm.name)) print("ESXi Host: {0}".format(vm.get_esx_host().name)) print("Path to VM: {0}".format(vm.summary.config.vmPathName)) print("BIOS UUID: {0}".format(vm.config.uuid)) print("CPUs: {0}".format(vm.config.hardware.numCPU)) print("MemoryMB: {0}".format(vm.config.hardware.memoryMB)) print("Guest PowerState: {0}".format(vm.guest.guestState)) print("Guest Full Name: {0}".format(vm.config.guestFullName)) print("Guest Container Type: {0}".format(vm.config.guestId)) print("Container Version: {0}".format(vm.config.version)) for custom_field in vm.customValue: print("{0}: {1}".format(custom_attributes_mapping[custom_field.key], custom_field.value)) print()
def do_list_dvs(
self, patterns)
Inheritance:
isphere.command.dvs_command.DvsCommand
.isphere.command.dvs_command.DvsCommand.do_list_dvs
Usage: list_dvs [pattern1 [pattern2]...] List the dvs names matching the given ORed name patterns.
Sample usage:
list_dvs
list_dvs .*
def do_list_dvs(self, patterns): """Usage: list_dvs [pattern1 [pattern2]...] List the dvs names matching the given ORed name patterns. Sample usage: * `list_dvs` * `list_dvs .*` """ for dvs_name in self.compile_and_yield_dvs_patterns(patterns, risky=False): print(dvs_name)
def do_list_esx(
self, patterns)
Inheritance:
isphere.command.esx_command.EsxCommand
.isphere.command.esx_command.EsxCommand.do_list_esx
Usage: list [pattern1 [pattern2]...] List the esx names matching the given ORed name patterns.
Sample usage:
list dev.* ...ybc01
list
* list .*
def do_list_esx(self, patterns): """Usage: list [pattern1 [pattern2]...] List the esx names matching the given ORed name patterns. Sample usage: * `list dev.* ...ybc01` * `list` * `list .*` """ for esx_name in self.compile_and_yield_esx_patterns(patterns, risky=False): print(esx_name)
def do_list_vm(
self, patterns)
Inheritance:
isphere.command.virtual_machine_command.VirtualMachineCommand
.isphere.command.virtual_machine_command.VirtualMachineCommand.do_list_vm
Usage: list [pattern1 [pattern2]...] List the vm names matching the given ORed name patterns.
Sample usage:
list dev.* ...ybc01
list
* list .*
def do_list_vm(self, patterns): """Usage: list [pattern1 [pattern2]...] List the vm names matching the given ORed name patterns. Sample usage: * `list dev.* ...ybc01` * `list` * `list .*` """ for vm_name in self.compile_and_yield_vm_patterns(patterns, risky=False): print(vm_name)
def do_migrate_vm(
self, line)
Inheritance:
isphere.command.virtual_machine_command.VirtualMachineCommand
.isphere.command.virtual_machine_command.VirtualMachineCommand.do_migrate_vm
Usage: migrate_vm [pattern1 [pattern2]...] ! TARGET_ESX_NAME Migrate one or several VMs to another ESX host by name.
Sample usage: migrate MYVNNAME ! ESX_FQDN
def do_migrate_vm(self, line): """Usage: migrate_vm [pattern1 [pattern2]...] ! TARGET_ESX_NAME Migrate one or several VMs to another ESX host by name. Sample usage: `migrate MYVNNAME ! ESX_FQDN` """ try: patterns_and_esx_name = line.split("!", 1) patterns = patterns_and_esx_name[0] esx_name = patterns_and_esx_name[1].strip() except IndexError: print("Looks like your input was malformed. Try `help migrate_vm`.") return if not esx_name: print("No target esx name given. Try `help migrate_vm`.") return try: # TODO use esx from cache, allows for better error messages (eg no fqdn) esx_host = self.cache.find_by_dns_name(esx_name) except NotFound: print("Target esx host '{0}' not found, maybe try with FQDN?".format(esx_name)) return for vm_name in self.compile_and_yield_vm_patterns(patterns): relocate_spec = vim.vm.RelocateSpec(host=esx_host) print("Relocating {0} to {1}".format(vm_name, esx_name)) try: self.retrieve_vm(vm_name).Relocate(relocate_spec) except Exception as e: print("Relocation failed: {0}".format(e))
def do_reboot_vm(
self, patterns)
Inheritance:
isphere.command.virtual_machine_command.VirtualMachineCommand
.isphere.command.virtual_machine_command.VirtualMachineCommand.do_reboot_vm
Usage: reboot_vm [pattern1 [pattern2]...] Soft reboot vms matching the given ORed name patterns.
Sample usage: reboot MY_VM_NAME
def do_reboot_vm(self, patterns): """Usage: reboot_vm [pattern1 [pattern2]...] Soft reboot vms matching the given ORed name patterns. Sample usage: `reboot MY_VM_NAME` """ for vm_name in self.compile_and_yield_vm_patterns(patterns): print("Asking {0} to reboot".format(vm_name)) self.retrieve_vm(vm_name).RebootGuest()
def do_reload(
self, _)
Inheritance:
isphere.command.esx_command.EsxCommand
.isphere.command.esx_command.EsxCommand.do_reload
Usage: reload Reload VM cache from the vSphere server.
Sample usage: reload
def do_reload(self, _): """Usage: reload Reload VM cache from the vSphere server. Sample usage: `reload` """ self.preloop()
def do_reset_vm(
self, patterns)
Inheritance:
isphere.command.virtual_machine_command.VirtualMachineCommand
.isphere.command.virtual_machine_command.VirtualMachineCommand.do_reset_vm
Usage: reset_vm [pattern1 [pattern2]...] Reset vms matching the given ORed name patterns.
Sample usage: reset MY_VM_NAME OTHERNAME
def do_reset_vm(self, patterns): """Usage: reset_vm [pattern1 [pattern2]...] Reset vms matching the given ORed name patterns. Sample usage: `reset MY_VM_NAME OTHERNAME` """ reset_tasks = [] for vm_name in self.compile_and_yield_vm_patterns(patterns): print("Launching reset task for {0}".format(vm_name)) reset_task = self.retrieve_vm(vm_name).ResetVM_Task() reset_tasks.append(reset_task) print("Waiting for {0} reset tasks to complete".format(len(reset_tasks))) self.cache.wait_for_tasks(reset_tasks)
def do_set_custom_attribute_vm(
self, patterns)
Inheritance:
isphere.command.virtual_machine_command.VirtualMachineCommand
.isphere.command.virtual_machine_command.VirtualMachineCommand.do_set_custom_attribute_vm
Usage: set_custom_attribute_vm [pattern1 [pattern2]...] Set custom attributes by name on VMs matching the given ORed name patterns.
Sample usage: set_custom_attribute_vm
foo.* ^other-name$
def do_set_custom_attribute_vm(self, patterns): """Usage: set_custom_attribute_vm [pattern1 [pattern2]...] Set custom attributes by name on VMs matching the given ORed name patterns. Sample usage: `set_custom_attribute_vm` foo.* ^other-name$ """ attribute_names = self.cache.get_custom_attributes_mapping().values() formatted_attribute_names = "".join( [ "\n\t{attribute_name}".format(attribute_name=attribute_name) for attribute_name in attribute_names ] ) print("Available custom attribute names: {names}".format( names=formatted_attribute_names)) target_name = _input("Target custom attribute name? ") target_value = _input("Target value for {name}? ".format( name=target_name)) for vm_name in self.compile_and_yield_vm_patterns(patterns): print("Setting attribute for {vm_name}".format(vm_name=vm_name)) try: self.cache.set_custom_attribute( self.cache.retrieve_vm(vm_name).raw_vm, target_name, target_value) except Exception as e: print(self.colorize( "Got a problem: {problem}".format(problem=e), "red")) print(self.colorize("Not continuing.", "red")) break
def eval(
self, line, item_name_generator, item_retriever, local_name)
Inheritance:
isphere.command.esx_command.EsxCommand
.isphere.command.esx_command.EsxCommand.eval
Run an eval command. This will retrieve items based on given patterns and execute a python statement against each of these items. The item will be bound to the given name for each of these statements.
- line (type
str
): The text line provided by the user. The format should be as follows:! - item_name_generator (type
callable
): A function that should generate an iterable that represents the available item names for pattern matching. - item_retriever (type
callable
): A function that takes an item name generated byitem_name_generator
as input and returns the actual item. - local_name (type
str
): The name to bind the item to when evaluating the statement.
def eval(self, line, item_name_generator, item_retriever, local_name): """ Run an eval command. This will retrieve items based on given patterns and execute a python statement against each of these items. The item will be bound to the given name for each of these statements. - line (type `str`): The text line provided by the user. The format should be as follows: <patterns> ! <statement> - item_name_generator (type `callable`): A function that should generate an iterable that represents the available item names for pattern matching. - item_retriever (type `callable`): A function that takes an item name generated by `item_name_generator` as input and returns the actual item. - local_name (type `str`): The name to bind the item to when evaluating the statement. """ try: patterns_and_statement = line.split("!", 1) patterns = patterns_and_statement[0] statement = patterns_and_statement[1] except IndexError: print(self.colorize("Looks like your input was malformed. Try `help eval_*`.", "red")) return for item_name in item_name_generator(patterns): def guard(): raise NoOutput() _globals, _locals = {}, {} try: item = item_retriever(item_name) except NotFound: print(self.colorize("Skipping {item} since it could not be retrieved.".format(item=item_name), "red")) continue _locals[local_name] = item _locals["no_output"] = guard _globals[local_name] = item _globals["no_output"] = guard separator = "-" item_name_header = " {name} ".format( name=item_name[:78]).center( 80, separator) try: result = eval(statement, _globals, _locals) print(self.colorize(item_name_header, "blue")) print(result) except NoOutput: pass except Exception as e: print(self.colorize(item_name_header, "red")) print(self.colorize("Eval failed for {0}: {1}".format(item_name, e), "red"))
def retrieve_dvs(
self, dvs_name)
Inheritance:
isphere.command.dvs_command.DvsCommand
.isphere.command.dvs_command.DvsCommand.retrieve_dvs
def retrieve_dvs(self, dvs_name): return self.cache.retrieve_dvs(dvs_name)
def retrieve_esx(
self, esx_name)
Inheritance:
isphere.command.esx_command.EsxCommand
.isphere.command.esx_command.EsxCommand.retrieve_esx
def retrieve_esx(self, esx_name): return self.cache.retrieve_esx(esx_name)
def retrieve_vm(
self, vm_name)
Inheritance:
isphere.command.virtual_machine_command.VirtualMachineCommand
.isphere.command.virtual_machine_command.VirtualMachineCommand.retrieve_vm
def retrieve_vm(self, vm_name): return self.cache.retrieve_vm(vm_name)
def yield_dvs_patterns(
self, compiled_patterns)
Inheritance:
isphere.command.dvs_command.DvsCommand
.isphere.command.dvs_command.DvsCommand.yield_dvs_patterns
def yield_dvs_patterns(self, compiled_patterns): for dvs_name in self.cache.list_cached_dvses(): if any([pattern.match(dvs_name) for pattern in compiled_patterns]): yield(dvs_name)
def yield_esx_patterns(
self, compiled_patterns)
Inheritance:
isphere.command.esx_command.EsxCommand
.isphere.command.esx_command.EsxCommand.yield_esx_patterns
def yield_esx_patterns(self, compiled_patterns): for esx_name in self.cache.list_cached_esxis(): if any([pattern.match(esx_name) for pattern in compiled_patterns]): yield(esx_name)
def yield_vm_patterns(
self, compiled_patterns)
Inheritance:
isphere.command.virtual_machine_command.VirtualMachineCommand
.isphere.command.virtual_machine_command.VirtualMachineCommand.yield_vm_patterns
def yield_vm_patterns(self, compiled_patterns): for vm_name in self.cache.list_cached_vms(): if any([pattern.match(vm_name) for pattern in compiled_patterns]): yield(vm_name)
Sub-modules
A common set of capabilities for each command.
Distributed virtual switch specific REPL commands.
ESXi host system specific REPL commands.
isphere.command.virtual_machine_command
Virtual machine specific REPL commands.