univention.uvmm package

Submodules

univention.uvmm.client module

UVMM client using a unix-socket.

exception univention.uvmm.client.ClientError(translatable_text, dict={}, **args)[source]

Bases: univention.uvmm.helpers.TranslatableException

Error during communication with UVMM daemon.

class univention.uvmm.client.UVMM_ClientSocket[source]

Bases: object

UVMM client.

close()[source]

Close socket.

receive()[source]

Get response.

send(req)[source]

Send request, wait for and return answer.

class univention.uvmm.client.UVMM_ClientUnixSocket(socket_path, timeout=0)[source]

Bases: univention.uvmm.client.UVMM_ClientSocket

UVMM client Unix socket.

Open new UNIX socket to socket_path.

univention.uvmm.client.uvmm_connect()[source]

Get connection to UVMM.

univention.uvmm.client.uvmm_cmd(request)[source]

Send request to UVMM. cred: tupel of (username, password), defaults to machine credential.

univention.uvmm.cloudconnection module

exception univention.uvmm.cloudconnection.CloudConnectionError(translatable_text, dict={}, **args)[source]

Bases: univention.uvmm.helpers.TranslatableException

Error while handling cloud connection.

class univention.uvmm.cloudconnection.CloudConnection(cloud, cache_dir)[source]

Bases: object

_create_connection(cloud, testconnection=True)[source]
connect(cloud, testconnection=True)[source]
unregister(wait=False)[source]
set_frequency(freq)[source]
set_frequency_fast_update()[source]
run()[source]
update()[source]
update_expensive()[source]
cache_file_name(suffix='.pic')[source]
cache_save()[source]
cache_restore()[source]
_get_instance_by_id(instance_id)[source]

Find and return the Node object which has the id <instance_id> Raise OpenStackCloudConnectionError if <instance_id> can not be found

list_keypairs()[source]
to_cloud_data_image(image)[source]
list_images()[source]
list_instances(pattern='*')[source]
_exec_libcloud(func)[source]
logerror(logger, msg)[source]

Log the error with the traceback. Set self.publicdata.last_error_message to the error message in order to give the frontend the possibility to show it to the user

univention.uvmm.cloudnode module

UVMM cloud node handler.

This module implements functions to handle cloud connections and instances. This is independent from the on-wire-format.

class univention.uvmm.cloudnode.CloudConnectionMananger[source]

Bases: dict

Dictionary which holds all connections key is the cloud name, value the CloudConnection

_parse_cloud_info(cloud)[source]
_check_if_connection_exists(conn_name)[source]
_get_connections(conn_name='*')[source]
set_cache(cache)[source]
list(pattern='*')[source]
set_poll_frequency(freq, name=None)[source]
add_connection(cloud, testconnection=True)[source]

Add a new cloud connection cloud: dict with cloud name, type, credentials, urls, ...

remove_connection(cloudname)[source]

Remove connection; cloudname = ldap name attribute

list_conn_instances(conn_name, pattern='*')[source]

List instances available through connection identified by conn_name, matching the pattern. If conn_name = “*”, list all connections

list_conn_images(conn_name='*')[source]
list_conn_sizes(conn_name='*')[source]
list_conn_locations(conn_name='*')[source]
list_conn_keypairs(conn_name='*')[source]
list_conn_secgroups(conn_name='*')[source]
list_conn_networks(conn_name='*')[source]
list_conn_subnets(conn_name='*')[source]
instance_state(conn_name, instance_id, state)[source]
instance_terminate(conn_name, instance_id)[source]
instance_create(conn_name, args)[source]
univention.uvmm.cloudnode.create_cloud_connection(cloud, cache_dir)[source]

univention.uvmm.commands module

UVMM commands

This module implements parsing the protocol packets, checking parameters for validity and invoking the real implementation.

exception univention.uvmm.commands.CommandError(command, ex, **kv)[source]

Bases: univention.uvmm.helpers.TranslatableException

Signal error during command execution.

class univention.uvmm.commands._Commands[source]

Bases: object

static L_CLOUD_ADD(server, request)[source]

Add cloud via libcloud

static L_CLOUD_REMOVE(server, request)[source]

Remove cloud via libcloud

static L_CLOUD_LIST(server, request)[source]

List connected clouds

static L_CLOUD_INSTANCE_LIST(server, request)[source]

List instances in connected clouds

static L_CLOUD_FREQUENCY(server, request)[source]

Set polling interval for cloud connection

static L_CLOUD_IMAGE_LIST(server, request)[source]

List available cloud instance images of cloud connections

static L_CLOUD_SIZE_LIST(server, request)[source]

List available cloud instance sizes of cloud connections

static L_CLOUD_LOCATION_LIST(server, request)[source]

List available cloud locations of cloud connections

static L_CLOUD_KEYPAIR_LIST(server, request)[source]

List available cloud keypairs of cloud connections

static L_CLOUD_SECGROUP_LIST(server, request)[source]

List available cloud security groups of cloud connections

static L_CLOUD_NETWORK_LIST(server, request)[source]

List available cloud networks of cloud connections

static L_CLOUD_SUBNET_LIST(server, request)[source]

List available cloud subnets of cloud connections

static L_CLOUD_INSTANCE_STATE(server, request)[source]

Change instance state

static L_CLOUD_INSTANCE_TERMINATE(server, request)[source]

Terminate a cloud instance

static L_CLOUD_INSTANCE_CREATE(server, request)[source]

Create a new cloud instance

static NODE_ADD(server, request)[source]

Add node to watch list.

static NODE_REMOVE(server, request)[source]

Remove node from watch list.

static NODE_QUERY(server, request)[source]

Get domain and storage-pool information from node.

static NODE_FREQUENCY(server, request)[source]

Set polling interval for node.

static NODE_LIST(server, request)[source]

Return list of nodes in group.

static GROUP_LIST(server, request)[source]

Return list of known groups.

static BYE(server, request)[source]

Terminate UVMM daemon.

static DOMAIN_LIST(server, request)[source]

Return a list of available domains of a given node.

static DOMAIN_INFO(server, request)[source]

Return detailed information about a domain.

static DOMAIN_DEFINE(server, request)[source]

Define new domain on node.

static DOMAIN_STATE(server, request)[source]

Change running state of domain on node.

static DOMAIN_SAVE(server, request)[source]

Save defined domain.

static DOMAIN_RESTORE(server, request)[source]

Restore defined domain.

static DOMAIN_UNDEFINE(server, request)[source]

Undefine a domain on a node.

static DOMAIN_MIGRATE(server, request)[source]

Migrate a domain from node to the target node.

static DOMAIN_SNAPSHOT_CREATE(server, request)[source]

Create new snapshot of domain.

static DOMAIN_SNAPSHOT_REVERT(server, request)[source]

Revert to snapshot of domain.

static DOMAIN_SNAPSHOT_DELETE(server, request)[source]

Delete snapshot of domain.

static DOMAIN_UPDATE(server, request)[source]

Trigger update of domain.

static DOMAIN_CLONE(server, request)[source]

Clone a domain.

static DOMAIN_TARGETHOST_ADD(server, request)[source]

Add a migration target host.

static DOMAIN_TARGETHOST_REMOVE(server, request)[source]

Remove a migration target host.

static STORAGE_POOLS(server, request)[source]

List all pools.

static STORAGE_VOLUMES(server, request)[source]

List all volumes in a pool.

static STORAGE_VOLUMES_DESTROY(server, request)[source]

Destroy all given volumes in a pool.

static STORAGE_VOLUME_USEDBY(server, request)[source]

Return list of domains using the given volume.

univention.uvmm.ec2cloud module

UVMM cloud ec2 handler

exception univention.uvmm.ec2cloud.EC2CloudConnectionError(translatable_text, dict={}, **args)[source]

Bases: univention.uvmm.cloudconnection.CloudConnectionError

class univention.uvmm.ec2cloud.EC2CloudConnection(cloud, cache_dir)[source]

Bases: univention.uvmm.cloudconnection.CloudConnection, univention.uvmm.node.PersistentCached

_check_connection_attributes(cloud)[source]
_create_connection(cloud, testconnection=True)[source]
update_expensive()[source]
list_instances(pattern='*')[source]
list_locations()[source]
list_secgroups()[source]
list_sizes()[source]
list_networks()[source]
list_subnets()[source]
to_cloud_data_image(image)[source]
list_images()[source]
_boot_instance(instance)[source]
_softreboot_instance(instance)[source]
_reboot_instance(instance)[source]
_pause_instance(instance)[source]
_unpause_instance(instance)[source]
_shutdown_instance(instance)[source]
_shutoff_instance(instance)[source]
_suspend_instance(instance)[source]
_resume_instance(instance)[source]
instance_state(instance_id, state)[source]
instance_terminate(instance_id)[source]
instance_create(args)[source]
_exec_libcloud(func)[source]

univention.uvmm.helpers module

univention.uvmm.helpers.N_(msg)[source]
exception univention.uvmm.helpers.TranslatableException(translatable_text, dict={}, **args)[source]

Bases: exceptions.Exception

Translatable exception (translatable_text, dict, key=value).

translatable_text
dict
univention.uvmm.helpers.ms(ms)[source]

Format milli seconds as readable string.

>>> ms(((12*60+34)*60+56)*1000+789)
'12:34:56.789'
univention.uvmm.helpers.prettyCapacity(value)[source]

Convert storage capacity to pretty human readable text.

Parameters:val – numeric capacity.
Returns:Human readable text.
>>> prettyCapacity(0)
'0 B'
>>> prettyCapacity(1023)
'1023 B'
>>> prettyCapacity(1024)
'1.0 KiB'
>>> prettyCapacity(1 << 20)
'1.0 MiB'
univention.uvmm.helpers.tuple2version(version)[source]

Convert version-as-tuple to version-as-string (as used by libvirt)

>>> tuple2version((1, 2, 3))
1002003
univention.uvmm.helpers.uri_encode(uri)[source]

Encode URI for file-system compatibility.

>>> uri_encode('qemu+ssh://user:univention@test.knut.univention.de/system?no_verify=1')
'qemu%2bssh%3a%2f%2fuser%3aunivention%40test%2eknut%2eunivention%2ede%2fsystem%3fno%5fverify%3d1'
univention.uvmm.helpers.uri_decode(uri)[source]

Decode URI for file-system compatibility.

>>> uri_decode('qemu%2bssh%3a%2f%2fuser%3aunivention%40test%2eknut%2eunivention%2ede%2fsystem%3fno%5fverify%3d1')
'qemu+ssh://user:univention@test.knut.univention.de/system?no_verify=1'
exception univention.uvmm.helpers.TimeoutError[source]

Bases: exceptions.Exception

class univention.uvmm.helpers.timeout(target, timeout=10.0)[source]

Bases: object

Call a function in another thread and wait for its completion. If the functions doesn’t return in the maximum allowed time, raise an TimeoutError.

>>> import time
>>> timeout(time.sleep, timeout=2.0)(1.0)
>>> timeout(time.sleep, timeout=1.0)(-1.0)
Traceback (most recent call last):
IOError: [Errno 22] Invalid argument
>>> timeout(time.sleep, timeout=1.0)(2.0)
Traceback (most recent call last):
TimeoutError: <built-in function sleep>
run(*args, **kwargs)[source]

univention.uvmm.network module

UVMM storage handler.

This module implements functions to handle network configurations.

exception univention.uvmm.network.NetworkError(translatable_text, dict={}, **args)[source]

Bases: univention.uvmm.helpers.TranslatableException

Error occurred during operation on network object.

univention.uvmm.network.network_is_active(conn, name)[source]

Check if the network with the given name is currently active.

univention.uvmm.network.network_start(conn, name)[source]

Start the network specified by given name. Returns Trie if the network could be activated or if it was already active.

univention.uvmm.network.network_find_by_bridge(conn, bridge)[source]

Find the libvirt network using a specific bridge.

univention.uvmm.node module

UVMM node handler.

This module implements functions to handle nodes and domains. This is independent from the on-wire-format.

class univention.uvmm.node.Description(*args, **kwargs)[source]

Bases: object

args
desc
class univention.uvmm.node.Domain(domain, node)[source]

Bases: univention.uvmm.node.PersistentCached

Container for domain statistics.

CPUTIMES = (10, 60, 300)
_vnc()[source]

Return (host, port) tuple for VNC connection, or None.

cache_file_name(uuid=None, suffix='.xml')[source]

Return the path of the domain cache file.

calc_cache_id()[source]
key()[source]

Return a unique key for this domain and generation.

migration_status(stats)[source]

Convert libvirt job stats to string and dictionary for string formatting.

update(domain, redefined=False)[source]

Update statistics which may change often.

Parameters:
  • domain (libvirt.virDomain) – libvirt domain instance.
  • defined (bool) – True if the domain was (re-)defined.
update_cpu(dom)[source]

Update ‘/domain/cpu’ as set by UCRV ‘uvmm/vm/cpu/host-model’.

Parameters:domain (_Domain) – domain XML data.
Returns:True if the node was updated, False otherwise.
Return type:bool
update_expensive(domain)[source]

Update statistics.

update_ldap()[source]

Update annotations from LDAP.

update_snapshots(domain)[source]

List of snapshots.

update_volumes(domain)[source]

Determine size and pool.

xml2obj(xml)[source]

Parse XML into python object.

xml2obj_boot(domain_tree)[source]

Parse boot information from XML.

xml2obj_clock(domain_tree)[source]

Parse clock information from XML.

xml2obj_disks(devices)[source]

Parse disks from XML.

xml2obj_graphics(devices)[source]

Parse graphics from XML.

xml2obj_interfaces(devices)[source]

Parse interfaces from XML.

class univention.uvmm.node.DomainTemplate(arch, domain_type, os_type, features)[source]

Bases: object

Container for node capability.

static _DomainTemplate__get_features(node)

Return list of features.

static list_from_xml(xml)[source]

Convert XML to list.

matches(domain)[source]

Return True if domain matches os_type, arch and domain_type.

class univention.uvmm.node.Node(uri, cache_dir)[source]

Bases: univention.uvmm.node.PersistentCached

Container for node statistics.

_check_ram_overcommit(domain)[source]

Check if starting/migrating the VM is withing the RAM limit of the node.

Parameters:domain – The domain to start/migrate.
Raises:NodeError – if the currently available RAM on the node is not enough.
_register_default_pool()[source]

Create a default storage pool if not available

_unregister()[source]

Unregister callback and close connection.

cache_dom_dir(uri=None)[source]

Return the path of the domain cache directory of the node.

cache_file_name(uri=None, suffix='.pic')[source]

Return the path of the node cache file.

calc_cache_id()[source]

Calculate key for disk cache.

close_event(conn, reason, opaque)[source]

Handle connection close event.

Parameters:
  • conn (libvirt.virConnect) – The (now closed) connection.
  • reason (int) – Event details.
  • opaque – Opaque data.
domain_list(pattern='*')[source]
error_event(conn, dom, srcpath, devalias, action, reason, opaque)[source]

Handle IO errors.

job_event(conn, dom, stats, opaque)[source]

Handle domain job completed events.

livecycle_event(conn, dom, event, detail, opaque)[source]

Handle domain addition, update and removal.

migration_event(conn, dom, iteration, opaque)[source]

Handle domain migration events.

reboot_event(conn, dom, opaque)[source]

Handle domain reboot.

reservedMem = 0
run()[source]

Handle regular poll. Also checks connection liveness.

set_frequency(hz)[source]

Set polling frequency for update.

unregister(wait=False)[source]

Unregister callbacks doing updates.

update()[source]

Update node statistics.

update_autoreconnect()[source]

(Re-)connect after connection broke.

update_once()[source]

Update once on (re-)connect.

wait_update(domain, state_key, timeout=10)[source]

Wait until domain gets updated.

write_novnc_tokens()[source]
exception univention.uvmm.node.NodeError(translatable_text, dict={}, **args)[source]

Bases: univention.uvmm.helpers.TranslatableException

Error while handling node.

class univention.uvmm.node.Nodes[source]

Bases: dict

Handle registered nodes.

BEBO_FREQUENCY = 300000
IDLE_FREQUENCY = 15000
USED_FREQUENCY = 10000
add(uri)[source]

Add node to watch list.

frequency(hz=15000, uri=None)[source]

Set frequency for polling nodes.

list(group, pattern)[source]

Return list of watched nodes matching the given pattern.

query(uri)[source]

Get domain data from node.

remove(uri)[source]

Remove node from watch list.

set_cache(cache)[source]

Register a cache.

set_frequency(hz)[source]

Set polling frequency for update.

class univention.uvmm.node.PersistentCached[source]

Bases: object

Abstract class to implement caching.

cache_file_name(suffix='.pic')[source]
cache_purge()[source]

Purge public data from cache.

cache_save(data)[source]

Save public data to cache.

class univention.uvmm.node.StoragePool(pool)[source]

Bases: object

Container for storage pool statistics.

update(pool)[source]

Update statistics.

class univention.uvmm.node._Domain(domain)[source]

Bases: object

_active_tree
_active_xml
_inactive_tree
_inactive_xml
active_tree
active_xml
domain
inactive_tree
inactive_xml
log
class univention.uvmm.node._DomainDict[source]

Bases: dict

Dictionary for handling domains of a node and their persistent cache.

univention.uvmm.node.__domain_targethost(uri, domain)[source]

Modify migration target host

univention.uvmm.node._backup(content, fname)[source]

Backup content to file.

Parameters:
  • content (str) – The file content.
  • fname (str) – The (relative) file name.
univention.uvmm.node._domain_backup(dom, save=True)[source]

Save domain definition to backup file.

Parameters:
  • dom (libvirt.virDomain) – libvirt domain instance.
  • save (bool) – True to create a backup of the previous description (e.g. before deleing), False to save the current description.
univention.uvmm.node._domain_edit(node, dom_stat, xml)[source]

Apply python object ‘dom_stat’ to an XML domain description.

Parameters:
  • node (Node) – The host system node.
  • dom_stat (Data_Domain) – The virtual machine object.
  • xml (str) – libvirt domain XML string.
Returns:

A 2-tuple (xml, updates_xml), where xml is the updated domain XML string, updates_xml a list of device update XML strings.

univention.uvmm.node._update_xml(_node_parent, _node_name, _node_value, _changes=set([]), **attr)[source]

Create, update or delete node named ‘_node_name’ of ‘_node_parent’. If _node_value == None and all(attr == None), then node is deleted.

univention.uvmm.node.domain_clone(uri, domain, name, subst)[source]

Clone a domain.

univention.uvmm.node.domain_define(uri, domain)[source]

Convert python object to an XML document.

univention.uvmm.node.domain_info(uri, domain)[source]

Return detailed information of a domain.

univention.uvmm.node.domain_list(uri, pattern='*')[source]

Returns a dictionary of domains matching the pattern in name, contact or description.

return: { ‘nodeY’ : [ ( <uuid>, <domain name> ), ... ], ... }

univention.uvmm.node.domain_migrate(source_uri, domain, target_uri, mode=0)[source]

Start migration a domain from node to the target node.

The functions does not wait for the migration to finish!

Parameters:
  • source_uri (str) – libvirt URI of source node.
  • domain (str) – UUID of domain to migrate.
  • target_uri (str) – libvirt URI of target node.
  • mode (int) – Migration mode: 0 to start normal migration, -1 to abort any running migration, 1..99 to set auto-convergence increment, 100 to force post-copy now.
Raises:

NodeError – if migration failes.

univention.uvmm.node.domain_restore(uri, domain, statefile)[source]

Restore defined domain.

univention.uvmm.node.domain_save(uri, domain, statefile)[source]

Save defined domain.

univention.uvmm.node.domain_snapshot_create(uri, domain, snapshot)[source]

Create new snapshot of domain.

univention.uvmm.node.domain_snapshot_delete(uri, domain, snapshot)[source]

Delete snapshot of domain.

univention.uvmm.node.domain_snapshot_revert(uri, domain, snapshot)[source]

Revert to snapshot of domain.

univention.uvmm.node.domain_state(uri, domain, state)[source]

Change running state of domain on node and wait for updated state.

univention.uvmm.node.domain_targethost_add(uri, domain, targethost)[source]

Add a migration target host

univention.uvmm.node.domain_targethost_remove(uri, domain, targethost)[source]

Remove a migration target host

univention.uvmm.node.domain_undefine(uri, domain, volumes=[])[source]

Undefine a domain and its volumes on a node.

univention.uvmm.node.domain_update(domain)[source]

Trigger update of domain. Unfound domains are ignored.

univention.uvmm.node.format_error(ex)[source]
univention.uvmm.node.group_list()[source]

Return list of groups for nodes.

univention.uvmm.openstackcloud module

UVMM cloud openstack handler

exception univention.uvmm.openstackcloud.OpenStackCloudConnectionError(translatable_text, dict={}, **args)[source]

Bases: univention.uvmm.cloudconnection.CloudConnectionError

class univention.uvmm.openstackcloud.OpenStackCloudConnection(cloud, cache_dir)[source]

Bases: univention.uvmm.cloudconnection.CloudConnection, univention.uvmm.node.PersistentCached

_check_connection_attributes(cloud)[source]
_create_connection(cloud, testconnection=True)[source]
update_expensive()[source]
list_instances(pattern='*')[source]
list_locations()[source]
list_secgroups()[source]
list_sizes()[source]
list_networks()[source]
list_subnets()[source]
_boot_instance(instance)[source]
_softreboot_instance(instance)[source]
_reboot_instance(instance)[source]
_pause_instance(instance)[source]
_unpause_instance(instance)[source]
_shutdown_instance(instance)[source]
_shutoff_instance(instance)[source]
_suspend_instance(instance)[source]
_resume_instance(instance)[source]
instance_state(instance_id, state)[source]
instance_terminate(instance_id)[source]
instance_create(args)[source]
_exec_libcloud(func)[source]

univention.uvmm.protocol module

UVMM protocol.

exception univention.uvmm.protocol.PacketError(translatable_text, dict={}, **args)[source]

Bases: univention.uvmm.helpers.TranslatableException

Packet framing error.

class univention.uvmm.protocol.Packet(**kw)[source]

Bases: object

On-wire packet format.

Create new packet.

pack()[source]

Pack data for transfer.

static parse(buffer, offset=0)[source]

Unpack packet from data.

class univention.uvmm.protocol.Request(**kw)[source]

Bases: univention.uvmm.protocol.Packet

Super class of all requests to UVMM daemon.

Create new packet.

_default()[source]

Set default values. Called from __init__(self).

class univention.uvmm.protocol.Request_NODE_ADD(**kw)[source]

Bases: univention.uvmm.protocol.Request

Add node to watch list.

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_NODE_REMOVE(**kw)[source]

Bases: univention.uvmm.protocol.Request

Remove node to watch list.

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_NODE_QUERY(**kw)[source]

Bases: univention.uvmm.protocol.Request

Query node on watch list.

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_NODE_FREQUENCY(**kw)[source]

Bases: univention.uvmm.protocol.Request

Set query frequency for nodes on watch list.

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_NODE_LIST(**kw)[source]

Bases: univention.uvmm.protocol.Request

Query for list of watched nodes in specific group.

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_GROUP_LIST(**kw)[source]

Bases: univention.uvmm.protocol.Request

Query for list of known groups.

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_BYE(**kw)[source]

Bases: univention.uvmm.protocol.Request

Disconnect client.

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_DOMAIN_LIST(**kw)[source]

Bases: univention.uvmm.protocol.Request

List domains.

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_DOMAIN_INFO(**kw)[source]

Bases: univention.uvmm.protocol.Request

Detailed information of a domain.

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_DOMAIN_DEFINE(**kw)[source]

Bases: univention.uvmm.protocol.Request

Define new or replace old domain.

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_DOMAIN_STATE(**kw)[source]

Bases: univention.uvmm.protocol.Request

Change running state of defined domain.

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_DOMAIN_SAVE(**kw)[source]

Bases: univention.uvmm.protocol.Request

Save defined domain.

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_DOMAIN_RESTORE(**kw)[source]

Bases: univention.uvmm.protocol.Request

Resume defined domain.

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_DOMAIN_UNDEFINE(**kw)[source]

Bases: univention.uvmm.protocol.Request

Remove domain.

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_DOMAIN_MIGRATE(**kw)[source]

Bases: univention.uvmm.protocol.Request

Migrate domain.

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_DOMAIN_SNAPSHOT_CREATE(**kw)[source]

Bases: univention.uvmm.protocol.Request

Create new snapshot of domain.

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_DOMAIN_SNAPSHOT_REVERT(**kw)[source]

Bases: univention.uvmm.protocol.Request

Revert to snapshot of domain.

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_DOMAIN_SNAPSHOT_DELETE(**kw)[source]

Bases: univention.uvmm.protocol.Request

Delete snapshot of domain.

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_DOMAIN_UPDATE(**kw)[source]

Bases: univention.uvmm.protocol.Request

Trigger update of domain.

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_DOMAIN_CLONE(**kw)[source]

Bases: univention.uvmm.protocol.Request

Clone a domain.

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_DOMAIN_TARGETHOST_ADD(**kw)[source]

Bases: univention.uvmm.protocol.Request

Add a migration target host

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_DOMAIN_TARGETHOST_REMOVE(**kw)[source]

Bases: univention.uvmm.protocol.Request

Remove a migration target host

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_STORAGE_POOLS(**kw)[source]

Bases: univention.uvmm.protocol.Request

List all pools.

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_STORAGE_VOLUMES(**kw)[source]

Bases: univention.uvmm.protocol.Request

List all volumes in pool.

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_STORAGE_VOLUMES_DESTROY(**kw)[source]

Bases: univention.uvmm.protocol.Request

Destroy all given volumes in a pool.

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_STORAGE_VOLUME_USEDBY(**kw)[source]

Bases: univention.uvmm.protocol.Request

Return list of domains using the given iamge.

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_STORAGE_DEFINE(**kw)[source]

Bases: univention.uvmm.protocol.Request

Create new volume in pool.

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_L_CLOUD_ADD(**kw)[source]

Bases: univention.uvmm.protocol.Request

Add libcloud cloud connection

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_L_CLOUD_REMOVE(**kw)[source]

Bases: univention.uvmm.protocol.Request

Remove libcloud cloud connection

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_L_CLOUD_LIST(**kw)[source]

Bases: univention.uvmm.protocol.Request

List libcloud cloud connections

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_L_CLOUD_INSTANCE_LIST(**kw)[source]

Bases: univention.uvmm.protocol.Request

List instances matching ‘pattern’ of libcloud cloud connections

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_L_CLOUD_FREQUENCY(**kw)[source]

Bases: univention.uvmm.protocol.Request

Set polling frequency of one or all connections

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_L_CLOUD_IMAGE_LIST(**kw)[source]

Bases: univention.uvmm.protocol.Request

List available cloud instance images of cloud connections

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_L_CLOUD_SIZE_LIST(**kw)[source]

Bases: univention.uvmm.protocol.Request

List available cloud instance sizes of cloud connections

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_L_CLOUD_LOCATION_LIST(**kw)[source]

Bases: univention.uvmm.protocol.Request

List available cloud locations of cloud connections

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_L_CLOUD_KEYPAIR_LIST(**kw)[source]

Bases: univention.uvmm.protocol.Request

List available cloud keypairs of cloud connections

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_L_CLOUD_SECGROUP_LIST(**kw)[source]

Bases: univention.uvmm.protocol.Request

List available cloud security groups of cloud connections

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_L_CLOUD_NETWORK_LIST(**kw)[source]

Bases: univention.uvmm.protocol.Request

List available cloud networks of cloud connections

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_L_CLOUD_SUBNET_LIST(**kw)[source]

Bases: univention.uvmm.protocol.Request

List available cloud subnets of cloud connections

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_L_CLOUD_INSTANCE_STATE(**kw)[source]

Bases: univention.uvmm.protocol.Request

Change instance state

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_L_CLOUD_INSTANCE_TERMINATE(**kw)[source]

Bases: univention.uvmm.protocol.Request

Terminate a cloud instance

Create new packet.

_default()[source]
class univention.uvmm.protocol.Request_L_CLOUD_INSTANCE_CREATE(**kw)[source]

Bases: univention.uvmm.protocol.Request

Create a new cloud instance

Create new packet.

_default()[source]
class univention.uvmm.protocol.Response(**kw)[source]

Bases: univention.uvmm.protocol.Packet

Super class of all responses from UVMM daemon.

Create new packet.

_default()[source]
class univention.uvmm.protocol.Response_ERROR(**kw)[source]

Bases: univention.uvmm.protocol.Response

Create new packet.

_default()[source]
msg
class univention.uvmm.protocol.Response_OK(**kw)[source]

Bases: univention.uvmm.protocol.Response

Create new packet.

_default()[source]
class univention.uvmm.protocol.Response_DUMP(**kw)[source]

Bases: univention.uvmm.protocol.Response_OK

Create new packet.

_default()[source]
class univention.uvmm.protocol.Data_Domain[source]

Bases: object

Container for domain statistics.

class univention.uvmm.protocol.Data_Node[source]

Bases: object

Container for node statistics.

class univention.uvmm.protocol.Data_Pool[source]

Bases: object

Container for storage pool statistics.

class univention.uvmm.protocol.Cloud_Data_Connection[source]

Bases: object

Container for libcloud connection statistics

class univention.uvmm.protocol.Cloud_Data_Instance[source]

Bases: object

Container for libcloud instance statistics

class univention.uvmm.protocol.Cloud_Data_Size[source]

Bases: object

Container for libcloud size statistics

class univention.uvmm.protocol.Cloud_Data_Image[source]

Bases: object

Container for libcloud image statistics

class univention.uvmm.protocol.Cloud_Data_Location[source]

Bases: object

Container for libcloud location statistics

class univention.uvmm.protocol.Cloud_Data_Keypair[source]

Bases: object

Container for libcloud keypair statistics

class univention.uvmm.protocol.Cloud_Data_Secgroup[source]

Bases: object

Container for libcloud security group statistics

class univention.uvmm.protocol.Cloud_Data_Secgroup_Rule[source]

Bases: object

Container for libcloud security group rules statistics

class univention.uvmm.protocol.Cloud_Data_Network[source]

Bases: object

Container for libcloud network statistics

class univention.uvmm.protocol.Cloud_Data_Subnet[source]

Bases: object

Container for libcloud subnet statistics

class univention.uvmm.protocol.Data_Snapshot[source]

Bases: object

Container for snapshot data.

univention.uvmm.protocol._map(dictionary, id=None, name=None)[source]

Map id to name or reverse using the dictionary.

class univention.uvmm.protocol.Disk[source]

Bases: object

Container for disk objects.

DEVICE_DISK = 'disk'
DEVICE_CDROM = 'cdrom'
DEVICE_FLOPPY = 'floppy'
DEVICE_LUN = 'lun'
TYPE_FILE = 'file'
TYPE_BLOCK = 'block'
TYPE_DIR = 'dir'
TYPE_NETWORK = 'network'
CACHE_DEFAULT = 'default'
CACHE_NONE = 'none'
CACHE_WT = 'writethrough'
CACHE_WB = 'writeback'
CACHE_UNSAFE = 'unsafe'
CACHE_DIRECTSYNC = 'directsync'
class univention.uvmm.protocol.Interface[source]

Bases: object

Container for interface objects.

TYPE_BRIDGE = 'bridge'
TYPE_NETWORK = 'network'
TYPE_USER = 'user'
TYPE_ETHERNET = 'ethernet'
TYPE_DIRECT = 'direct'
class univention.uvmm.protocol.Graphic[source]

Bases: object

Container for graphic objects.

TYPE_VNC = 'vnc'
TYPE_SDL = 'sdl'
TYPE_SPICE = 'spice'
TYPE_RDP = 'rdp'
TYPE_DESKTOP = 'desktop'
class univention.uvmm.protocol.Network[source]

Bases: object

Container for network objects.

univention.uvmm.storage module

UVMM storage handler.

This module implements functions to handle storage on nodes. This is independent from the on-wire-format.

exception univention.uvmm.storage.StorageError(translatable_text, dict={}, **args)[source]

Bases: univention.uvmm.helpers.TranslatableException

Error while handling storage.

univention.uvmm.storage.create_storage_pool(conn, path, pool_name='default')[source]

Create directory pool.

univention.uvmm.storage.create_storage_volume(conn, domain, disk)[source]

Create disk for domain.

univention.uvmm.storage.get_storage_volumes(node, pool_name, type=None)[source]

Get ‘protocol.Disk’ instance for all Storage Volumes in named pool of given type.

univention.uvmm.storage.get_domain_storage_volumes(domain)[source]

Retrieve all referenced storage volumes.

univention.uvmm.storage.destroy_storage_volumes(conn, volumes, ignore_error=False)[source]

Destroy volumes.

univention.uvmm.storage.get_pool_info(pool)[source]

Get ‘protocol.Data_Pool’ instance for named pool.

univention.uvmm.storage.storage_pools(node)[source]

Get ‘protocol.Data_Pool’ instance for all (active) pools.

univention.uvmm.storage.storage_volume_usedby(nodes, volume_path, ignore_cdrom=True)[source]

Returns a list of tuples ( <node URI>, <domain UUID> ) of domains that use the given volume

univention.uvmm.storage.calc_index(disk)[source]

Calculate device number

Parameters:disk – The xml element of the disk.
Returns:The index number
univention.uvmm.storage.assign_disks(disks, used_addr)[source]

Verify block devices are connected to allowed buses.

Parameters:
  • disks – the list of Disks.
  • old_disks – A dictionary mapping the 2-tuple (bus, dev) to the XML elements of the old disks.

univention.uvmm.unix module

UVMM unix-socket handler.

class univention.uvmm.unix.StreamHandler(request, client_address, server)[source]

Bases: SocketServer.StreamRequestHandler

Handle one client connection.

active_count = 0
client_count = 0
setup()[source]

Initialize connection.

handle()[source]

Handle protocol.

handle_command(command)[source]

Handle command packet.

finish()[source]

Perform cleanup.

univention.uvmm.unix.unix(options)[source]

Run UNIX SOCKET server.

univention.uvmm.uvmm_ldap module

UVMM LDAP integration.

exception univention.uvmm.uvmm_ldap.LdapError(translatable_text, dict={}, **args)[source]

Bases: univention.uvmm.helpers.TranslatableException

LDAP error.

exception univention.uvmm.uvmm_ldap.LdapConfigurationError(translatable_text, dict={}, **args)[source]

Bases: univention.uvmm.uvmm_ldap.LdapError

LDAP configuration error.

exception univention.uvmm.uvmm_ldap.LdapConnectionError(translatable_text, dict={}, **args)[source]

Bases: univention.uvmm.uvmm_ldap.LdapError

LDAP connection error.

univention.uvmm.uvmm_ldap.ldap2fqdn(ldap_result)[source]

Convert LDAP result to fqdn.

univention.uvmm.uvmm_ldap.cached(cachefile, func, exception=<class 'univention.uvmm.uvmm_ldap.LdapConnectionError'>)[source]

Cache result of function or return cached result on LdapConnectionException.

univention.uvmm.uvmm_ldap.ldap_uris(ldap_uri=None)[source]

Return all nodes registered in LDAP.

univention.uvmm.uvmm_ldap.ldap_annotation(uuid)[source]

Load annotations for domain from LDAP.

univention.uvmm.uvmm_ldap.ldap_modify(uuid)[source]

Modify annotations for domain from LDAP.

univention.uvmm.uvmm_ldap.ldap_cloud_connections()[source]

Return a list of all cloud connections.

univention.uvmm.uvmm_ldap.ldap_cloud_connection_add(cloudtype, name, parameter, ucs_images='1', search_pattern='*', preselected_images=[])[source]

Add a new cloud connection.

univention.uvmm.uvmm_ldap.ldap_cloud_types()[source]

Return a list of all cloud types.

univention.uvmm.xml module

Shared XML definitions for UVMM.