qubesadmin.vm package¶
Module contents¶
Qubes VM objects.
- class qubesadmin.vm.DispVM(app, name, klass=None, power_state=None)[source]¶
Bases:
QubesVMDisposable VM
- classmethod from_appvm(app, appvm, redirect_dispvm_calls=False)[source]¶
Returns a wrapper for calling service in a new DispVM based on given AppVM. If appvm is none, use default DispVM template
If redirect_dispvm_calls is used, calls made before the disposable is created will instead guess the disposable template to query for features, properties etc.
- class qubesadmin.vm.DispVMWrapper(*args, **kwargs)[source]¶
Bases:
QubesVMWrapper class for new disposable, supporting only service call.
Note that when running in dom0, one need to manually kill the disposable after service call ends.
- class qubesadmin.vm.QubesVM(app, name, klass=None, power_state=None)[source]¶
Bases:
PropertyHolderQubes domain.
- property appvms¶
Returns a generator containing all domains based on the current TemplateVM.
Do not check vm type of self, core (including its extentions) have ultimate control what can be a template of what.
- property connected_vms¶
Return a generator containing all domains connected to the current NetVM.
- property derived_vms¶
Return list of all domains based on the current TemplateVM at any level of inheritance.
- devices: qubesadmin.devices.DeviceManager¶
- features: qubesadmin.features.Features¶
- firewall: qubesadmin.firewall.Firewall¶
- get_power_state()[source]¶
Return power state description string.
Return value may be one of those:
return value
meaning
'Halted'Machine is not active.
'Transient'Machine is in progress of starting. This state will be deprecated in favor of
'Starting'.'Running'Machine is ready and running.
'Paused'Machine is paused.
'Suspended'Machine is S3-suspended.
'Halting'Machine is in process of shutting down (OS shutdown).
'Crashed'Machine crashed and is unusable.
'NA'Machine is in unknown state.
See also
- http://wiki.libvirt.org/page/VM_lifecycle
Description of VM life cycle from the point of view of libvirt.
- https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainState
Libvirt’s enum describing precise state of a domain.
- is_halted()[source]¶
Check whether this domain’s state is ‘Halted’ :returns:
Trueif this domain is halted,Falseotherwise. :rtype: bool
- property klass¶
Qube class
- log: Logger¶
- prepare_input_for_vmshell(command, input=None)[source]¶
Prepare shell input for the given command and optional (real) input
- run(command, input=None, **kwargs)[source]¶
Run a shell command inside the domain using qubes.VMShell qrexec.
- run_service(service, **kwargs)[source]¶
Run service on this VM
- Parameters:
service (str) – service name
- Return type:
- run_service_for_stdio(service, input=None, timeout=None, **kwargs)[source]¶
Run a service, pass an optional input and return (stdout, stderr).
Raises an exception if return code != 0.
args and kwargs are passed verbatim to
run_service().Warning
There are some combinations if stdio-related kwargs, which are not filtered for problems originating between the keyboard and the chair.
- run_with_args(*args, **kwargs)[source]¶
Run a single command inside the domain. Use the qubes.VMExec qrexec, if available.
This method execute a single command, without interpreting any shell special characters.
- tags: qubesadmin.tags.Tags¶
- property volumes¶
VM disk volumes