qubes.vm.dispvm – Disposable VM

A disposable vm implementation

class qubes.vm.dispvm.DispVM(app, xml, *args, **kwargs)[source]

Bases: QubesVM

Disposable VM

async cleanup()[source]

Clean up after the DispVM

This stops the disposable qube and removes it from the store. This method modifies qubes.xml file.

create_qdb_entries()[source]

Create entries in Qubes DB.

async classmethod from_appvm(appvm, **kwargs)[source]

Create a new instance from given AppVM

Parameters:

appvm (qubes.vm.appvm.AppVM) – template from which the VM should be created

Returns:

new disposable vm

kwargs are passed to the newly created VM

>>> import qubes.vm.dispvm.DispVM
>>> dispvm = qubes.vm.dispvm.DispVM.from_appvm(appvm).start()
>>> dispvm.run_service('qubes.VMShell', input='firefox')
>>> dispvm.cleanup()

This method modifies qubes.xml file. The qube returned is not started.

on_domain_loaded(event)[source]

When domain is loaded assert that this vm has a template.

async on_domain_shutdown(_event, **_kwargs)[source]

Cleanup network interfaces of connected, running VMs.

This will allow re-reconnecting them cleanly later.

on_property_pre_reset_template(event, name, oldvalue=None)[source]

Forbid deleting template of VM

on_property_pre_set_template(event, name, newvalue, oldvalue=None)[source]

Forbid changing template of running VM

on_property_set_template(event, name, newvalue, oldvalue=None)[source]

Adjust root (and possibly other snap_on_start=True) volume on template change.

async start(**kwargs)[source]

Start domain

Parameters:
auto_cleanup

automatically remove this VM upon shutdown

default_dispvm

Default VM to be used as Disposable VM for service calls.

dispid

Internal, persistent identifier of particular DispVM.

include_in_backups

If this domain is to be included in default backup.

template

AppVM, on which this DispVM is based.