Welcome to MCVirt’s documentation!¶
MCVirt - Managed Consistent Virtualisation¶
MCVirt (em-see-vert)
- Command line virtual machine management utility.
Description¶
MCVirt is a utility for managing virtual machines, supporting the following technologies:
- Ubuntu 14.04 LTS.
- KVM virtualisation.
- Clustering with optional DRBD support.
MCVirt is implemented in Python, using the the libvirt virtualisation library.
Getting started¶
MCVirt must currently be built from source into a deb package, using the build script. The package and dependencies can then be installed:
$ ./build.sh
$ sudo dpkg -i mcvirt_0.10_all.deb
$ sudo apt-get -f install
See the installation guide for other dependencies and system configuration.
Start the MCVirt nameserver and daemon by running:
$ sudo service mcvirt-ns start
$ sudo service mcvirtd start
Most commands require a username and password to the MCVirt daemon. During installation a superuser is created with username mjc
and password pass
- see permissions for information on creating new users.
Configure the volume group that MCVirt will use to store virtual machine data:
$ sudo mcvirt node --set-vm-vg <Volume Group>
See the configuration guide for further node configuration steps.
Create a VM:
$ sudo mcvirt create --cpu-count 1 --memory 512 --disk-size 8000 test-vm
See the create/remove VMs, cluster, permissions and modifying VMs guides for further administrative instructions.
Start the VM:
$ sudo mcvirt start test-vm
See the controlling VMs guide for further user instructions.
Note: Username and password can be provided on the command line with the --username
and --password
options to instead of typing them in after every command.
For information on developing on MCVirt, see the development documentation.
See the guide index for a full list of manuals
For more information, please feel free to contact us
COPYRIGHT¶
Copyright © 2015 - I.T. Dev Ltd
Clustering¶
Nodes running MCVirt can be joined together in a cluster - this allows the synchronization of VM/global configurations.
Viewing the status of a cluster¶
To view the status of the cluster, run the following on an MCVirt node:
mcvirt info
This will show the cluster nodes, IP addresses, and status.
Adding a new node¶
It is best to join a blank node (containing a default configuration without any VMs) to a cluster.
When a new node is connected to a cluster, the configuration from the present nodes in the cluster (e.g. users, permissions, networks etc.) are pushed to the new node and any existing configuration is replaced.
Note: Always run the mcvirt cluster add
command from the source machine, containing VMs, connecting to a remote node that is blank.
The new node must be configured on separate network/VLAN for MCVirt cluster communication.
The IP address that MCVirt clustering/DRBD communications will be performed over must be configured by performing the following on both nodes:
mcvirt node --set-ip-address <Node cluster IP address>
This configuration can be retrieved by running mcvirt info
.
Joining the node to the cluster¶
Note: The following can only be performed by a superuser.
- From the remote node, run:
mcvirt cluster get-connect-string
The connect string will be displayed
- From the source node, run:
mcvirt cluster add-node --connect-string <connect string>
where <connect string>
is the string printed out in step 1.
- The local node will connect to the remote node, ensure it is suitable as a remote node, setup authentication between the nodes and copy the local permissions/network/virtual machine configurations to the remote node. Note: All existing data on the remote node will be removed.
Removing a node from the cluster¶
Note: The following can only be performed by a superuser.
To the remove a node from the cluster, run:
mcvirt cluster remove-node --node <Remote Node Name>
Get Cluster information¶
In order to view status information about the cluster, use the ‘info’ parameter for MCVirt, without specifying a VM name:
mcvirt info
Virtual machine migration¶
VMs that use DRBD-based storage can be migrated to the other node in the cluster, whilst the VM is powered off, using:
mcvirt migrate --node <Destination node> <VM Name>
Additional parameters are available to aid the migration and minimise downtime:
--wait-for-shutdown
, which will cause the migration command to poll the running state of the VM and migrate once the VM is in a powered off state, allowing the user to shutdown the VM from within the guest operating system.--start-after-migration
, which starts the VM immediately after the migration has finished--online
, which will perform online migration. Note: these cannot be used with either of the previous arguments.
DRBD¶
DRBD is used by MCVirt to use replicate storage across a 2-node cluster.
Once DRBD is configured and the node is in a cluster, ‘DRBD’ can be specified as the storage type when creating a VM, which allows the VM to be migrated between nodes.
Configuring DRBD¶
Ensure the package
drbd8-utils
is installed on both of the nodes in the clusterDRBD data will be transmitted over the ‘cluster’ address. Ensure that this has been set and that the network is segemneted from other network traffic (e.g. by using VLANs).
Perform the following MCVirt command to configure DRBD:
mcvirt drbd --enable
DRBD verification¶
MCVirt has the ability to start/monitor DRBD verifications (See the DRBD documentation).
The verification can be performed by using:
mcvirt verify <--all>|<VM Name>
This will perform a verification of the specified VM (or all of the DRBD-backed VMs, if ‘–all’ is specified). Once the verification is complete, an exception is thrown if any of the verifications fail.
The status of the latest verification is captured and will stop users from starting/migrating the VM.
If the verification fails:
- The DRBD volume must be resynced (for more information, see the DRBD documentation for re-syncing).
- Once this is complete, perform another MCVirt verification to mark the VM as in-sync, which will lift the limitations.
Troubleshooting¶
Failures during VM creation/deletion¶
When a VM is created, the following order is performed:
- The VM is created, configured with the name, memory allocation and number of CPU cores
- The VM is then created on the remote node
- The VM is then registered with LibVirt on the local node
- The hard drive for the VM is created. (For DRBD-backed storage, the storage is created on both nodes and synced)
- Any network adapters are added to the VM
If a failure of occurs during steps 4/5, the VM will still exist after the failure. The user should be able to see the VM, using mcvirt list
.
The user can re-create the disks/network adapters as necessary, using the mcvirt update
command, using mcvirt info <VM Name>
to monitor the virtual hardware that is attached to the VM.
Configuration¶
Configure Network¶
Remove default network¶
By default, libvirt configures a default network, ‘default’.
The ‘default’ network is attached to a private network, which provides NAT routing through the node’s physical interfaces.
If you wish to use bridging, the default network can be removed by performing the following:
mcvirt network delete default
Creating/Removing Networks¶
- Networks provide bridges between physical/bridge interfaces and virtual machines.
- To create a bridge network on the node, an additional network interface will need to be created on the node
- This will generally be placed in /etc/network/interfaces
The following example should help with creating this interface:
auto vmbr0
iface vmbr0 inet manual
bridge_ports <Physical interface>
bridge_stp off
bridge_fd 0
Where <Physical interface> is the name of the interface that the bridge should be bridged with, e.g. ‘eth0’
To create a network on the node, perform the following as a superuser:
mcvirt network create <Network name> --interface <Bridge interface>
Assuming that there are not any VMs connected to a network, they can be removed using:
mcvirt network delete <Network name>
Configure MCVirt¶
The first time MCVirt is run, it creates a configuration file for itself, found in /var/lib/mcvirt/<Hostname>/config.json.
The volume group, in which VM data will be stored as logical volumes, must be setup using:
mcvirt node --set-vm-vg <Volume Group>
The cluster IP address must be configured if the node will be used in a cluster (See the Cluster documentation):
mcvirt node --set-ip-address <Cluster IP Address>
In order for the MCVirt client to connect to the daemon, the hosts file at
/etc/hosts
must edited by changing the line:127.0.0.1 <hostname>
to:
<Cluster IP Address> <hostname>
Controlling VMs¶
All commands must be performed on the MCVirt node, which can be accessed via SSH.
Start VM¶
Use the MCVirt utility to start VMs:
mcvirt start <VM name>
Stop VM¶
Use the MCVirt utility to stop VMs:
mcvirt stop <VM name>
Reset VM¶
Use the MCVirt utility to reset VMs:
mcvirt reset <VM Name>
Only a super user can reset a VM. Normal users can stop and start the VM.
Get VM information¶
In order to view information about a VM, use the ‘info’ parameter for MCVirt:
mcvirt info <VM Name>
Example output:
<Username>@node:~# mcvirt info test-vm Name | test-vm CPU Cores | 1 Memory Allocation | 512MB State | Running ISO location | /var/lib/mcvirt/iso/ubuntu-12.04-server-amd64.iso -- Disk ID -- | -- Disk Size -- 1 | 8GB -- MAC Address -- | -- Network -- 52:54:00:2b:8a:a1 | Production -- Group -- | -- Users -- owner | mc user | nd
Listing virtual machines¶
In order to list the virtual machines on a node, run the following:
mcvirt list
This will provide the names of the virtual machines and their current state (running/stopped)
Connect to VNC¶
By default, VMs are started with a VNC console, for which the port is automatically generated.
The default listening IP address is 127.0.0.1, meaning that it can only be accessed from the node itself.
To manually gain access to a VNC console, ssh to the node, forwarding the port:
Determine the port that the VM is listening on:
mcvirt info <VM Name> --vnc-port 5904
SSH onto the node, forwarding the port provided in the previous step (5904 in this case)
- The local port can be any available port. In this example, 1232 is used:
ssh <Username>@<Node> -L 1232:127.0.0.1:5904
- For putty, use the tunnels configuration under Connection -> SSH -> Tunnels, where the source port is the local port and the destination is 127.0.0.1:<VNC Port>
Use an VNC client to connect to 127.0.0.1:1232 on your local PC
Removing VNC display¶
By disabling the VNC display, a greater VM performance may be achieved.
Power off the VM
Perform:
virsh edit <VM Name>
Remove the
<graphics type='vnc'...>...</graphics>
lines from the configuration.Save the configuration and start the VM
This can only be performed by root
Monitoring Resources¶
- To monitor resources, the following commands are available that can be run from an SSH console:
- top - monitor CPU/memory usages by processes
- iftop - monitor network usage
- iotop - monitor disk usages
Back up VM¶
MCVirt can provide access to snapshots of the raw volumes of VM disks, allowing a superuser to backup the data
- To create a snapshot, perform the following:
mcvirt backup --create-snapshot --disk-id <Disk ID> <VM Name>
- The returned path provides access to the disk at the time that the snapshot was created
Warning: The snapshot is 500MB in size, meaning that once the VM has changed 500MB of space on the disk, the VM will no longer be able to write to its disk
- Once the data has been backed up, the snapshot can be removed by performing:
mcvirt backup --delete-snapshot --disk-id <Disk ID> <VM Name>
- This can only be performed by a superuser
Create/Remove VMs¶
- All commands must be performed on the MCVirt node, which can be accessed via SSH using LDAP credentials.
- You must be a superuser to create and remove VMs
Create VM¶
Use the MCVirt utility to create VMs:
mcvirt create '<VM Name>'
The following parameters are available:
- –memory - Amount of memory to allocate to the VM (MB) (required)
- –cpu-count - Number of vCPUs to be allocated to the VM (required)
- –disk-size - Size of initial disk to be added to the VM (MB) (optional)
- –network - Provide the name of a network to be attached to the VM. (optional)
- This can be called as multiple times.
- A separate network interface is added to the VM for each network.
- A network can be specified multiple times to create multiple adapters connected to the same network.
- –storage-type - Storage backing type - either
Local
orDRBD
. - –nodes - Specifies the nodes that the VM will be hosted on, if a DRBD storage-type is specified and there are more than 2 nodes in the cluster.
- –driver - The virtual disk driver to use. If this is not specified then MCVirt will select the most appropriate driver (optional)
Cloning a VM¶
Cloning/duplicating a VM will create an identical replica of the VM.
Although both cloning and duplicating initially may appear to provide the same functionality, there are core differences, based on how they work, which should be noted to decide which function to use.
Both cloning and duplicating a VM can be performed by an owner of a VM.
Cloning¶
- The hard disk for the VM is snapshotted, which means the VM is cloned very quickly
- Cloning VMs is not support for DRBD-backed VMs
- Some restrictions are imposed on both the parent and clone, due to the way that the storage is cloned:
- Parent VMs cannot be:
- Started
- Resize (HDDs)
- Deleted
- VM Clones cannot be:
- Resized
- Cloned
- Note: All restrictions are lifted once all VM clones have been removed.
- Parent VMs cannot be:
A VM can be cloned by performing the following:
mcvirt clone --template <Source VM Name> <Target VM Name>
Duplicating¶
- Duplicating produces a new VM that is a completely separate entity to the source, meaning that no restrictions are imposed on either VM
- Duplicating a VM will copy the entire VM hard drive, which takes longer than cloning a VM
A VM can be duplicated by performing the following:
mcvirt duplicate --template <Source VM Name> <Target VM Name>
Removing VM¶
Ensure that the VM is stopped.
Use the MCVirt utility to remove the VM:
mcvirt delete <VM Name>
Without any parameters, the VM will simply be ‘unregistered’ from the node.
To remove all data associated with the VM, supply the parameter –remove-data
Only a superuser can delete a VM
Development¶
Coding Standards¶
The MCVirt code base follows the python PEP 8 coding standards, with a line length limit of 100 characters.
All code changes must comply with this coding standard and are checked by continuous integration.
The PEP 8 code checker can be installed using:
sudo apt-get install pep8
Run the checks using:
pep8
Automated Tests¶
There is a collection of unit tests for MCVirt, which can be run as follows:
python /usr/lib/mcvirt/test/run_tests.py
Before runing the tests ensure that the mcvirt-ns
service is running on all nodes in the cluster, and that mcvirtd
is running on all nodes except the one the tests are being run on (since mcvirtd
is started when the tests are run)
Manual Test Procedure¶
This test procedure is designed to compliment the automated unit tests and should be performed prior to making a new release.
- Make sure the
mcvirt-ns
andmcvirtd
daemons are started - Create a VM called ‘test-vm’
- Run
mcvirt list
and check that ‘test-vm’ is shown in the list, and that its state is ‘STOPPED’- If the node is part of a cluster, run
mcvirt list
on another node in the cluster, and check that ‘test-vm’ is listed
- If the node is part of a cluster, run
- Start ‘test-vm’. Run
mcvirt list
again and check that its state is now ‘RUNNING’- Run
mcvirt list
on a remote node to check the state of ‘test-vm’ if the node is part of a cluster
- Run
- Try to delete ‘test-vm’ and check that an error is shown saying ‘Can’t delete a running VM’
- Stop ‘test-vm’, and try to delete it again. Check that it is no longer shown in the output of
mcvirt list
- If the node is part of a cluster, confirm ‘test-vm’ has been deleted on a remote node too
- If the node is part of a cluster:
- Make sure DRBD is enabled by running
mcvirt drbd --enable
- Create a new VM called ‘cluster-vm’, specifying the storage type as ‘Drbd’
- Start ‘cluster-vm’
- Test online migration of VMs by running
mcvirt migrate --online --node <remote node> cluster-vm
- Run
mcvirt list
on the local and remote nodes to check that ‘cluster-vm’ is now registered on the remote node
- Make sure DRBD is enabled by running
Installation¶
Install Operating System¶
- MCVirt is currently built to support Ubuntu 14.04 with native versions of dependencies.
- When installing the operating system, create the following logical volumes:
- Root - Create a 50GB partition using ext4. This is used for the operating system, MCVirt configurations and ISO images
- SWAP - leave the suggested SWAP volume unaltered
- Virtual machine storage will be created as additional volumes in the volume group.
Building the package¶
- Ensure the build dependencies are installed:
dpkg, python-docutils
- Clone the repository with:
git clone https://github.com/ITDevLtd/MCVirt
- From within the root of the working copy, run build.sh
Installing Package¶
To install the package, run:
$ sudo dpkg -i mcvirt_X.XX_all.deb
$ sudo apt-get -f install
MCVirt uses a customised version of Pyro, which can be installed by running:
$ git clone https://github.com/MatthewJohn/Pyro4
$ cd Pyro4
$ sudo pip install .
You may need to install pip by running sudo apt-get install python-pip.
User Guides¶
Installation¶
- Installation - Procedure for building the MCVirt package, setting up a node with MCVirt and performing initial configuration
Configuration¶
- Configuration - Procedures for performing initial configurations of an MCVirt installation
Administration¶
- Permissions - Procedures for configuring permissions within MCVirt
- Cluster - Procedures for configuring an MCVirt Cluster
Usage¶
- Create/Remove VMs - Procedures for creating and deleting virtual machines
- Controlling VMs - Instructions for using the MCVirt script and controlling virtual machines
- Modifying VMs - Procedures for making changes to virtual machine configurations
Development¶
- Development - Information about performing development on MCVirt
Modifying VMs¶
Increase Disk Size¶
Power off the VM
Use MCVirt to increase the size of the disk - you will need to find the disk ID, which can be found by looking at the VM configuration (in most cases where a VM has one disk attached to it, it should be 1):
mcvirt update --increase-disk <Amount to increase (MB)> --disk-id <Disk Id> <VM Name>
Change Memory/CPU Allocation¶
Update the VM memory allocation and virtual CPU count using the following:
mcvirt update --memory <New Memory Allocation (MB)> <VM Name> mcvirt update --cpu-count <New CPU count> <VM Name>
The changes will take affect the next time the VM is booted. If the VM is running, it will need to be powered off and started again.
Add Additional Disk¶
Use the following MCVirt command to add an additional disk to a VM:
mcvirt update --add-disk <Size of disk (MB)> <VM Name>
The device will be attached to the VM the next time it’s booted. If the VM is running, it will need to be powered off and started again.
Add/Remove Network Adapter¶
Use the following MCVirt command to add/remove network adapters to/from a VM
Add an adapter:
mcvirt update --add-network <Network Name> <VM Name>
Remove an adapter:
mcvirt update --remove-network '<NIC MAC Address>' <VM Name>
Use the formatting ‘00:11:22:33:44:55’ for the MAC address
The device will altered the next time the VM is booted. If the VM is running, it will need to be powered off and started again.
Attaching ISO¶
ISO images can be attached to the cdrom drive of a VM whilst booting the VM
Use the MCVirt utility to start the VM, using the ‘–iso’ parameter to define the ISO image to be attached to the VM:
mcvirt start <VM Name> --iso <Name of ISO file>
The ISO file must be stored within /var/lib/mcvirt/iso.
VM Locking¶
VMs can be locked by superusers, which stops them from being started, stopped or migrated
To lock a VM:
mcvirt lock --lock <VM Name>
To unlock a VM:
mcvirt lock --unlock <VM Name>
Users can check the lock status of a VM by running:
mcvirt lock --check-lock <VM Name>
Permissions¶
Superusers¶
To run MCVirt commands as a superuser you must either:
- Have your username included in the superusers section in the configuration file.
Superusers can be added/removed using the following:
mcvirt permission --add-superuser=<username> mcvirt permission --delete-superuser=<username>
Managing users¶
To create a new user, perform the following as a superuser:
mcvirt user create <new username>
The password for the new user can be provided interactively, passed on the command line with
--user-password <new password>
, or generated automatically with--generate-password
. The generated password will be displayed when the user is created.To remove a user, perform the following as a superuser:
mcvirt user remove <user>
To change your password, perform the following:
mcvirt user change-password
The new password can be provided interactively or on the command line with
--new-password <new password>
. Note: Superusers can change the password of any other user by runningmcvirt user change-password --target-user <other user>
.In MCVirt, ‘users’ are able to start/stop VMs
To view the current permissions on a VM, including users and owners of a VM, run:
mcvirt info <VM Name>
To add a user to VM, perform the following:
mcvirt permission --add-user <Username> <VM Name>
To remove a user, perform the following:
mcvirt permission --delete-user <Username> <VM Name>
Owners of a VM are able to manage the users of a VM.
Managing owners¶
VM owners have the same permissions as users, except they are also able to manage the users of the VM
To add an owner to VM, perform the following:
mcvirt permission --add-owner <Username> <VM Name>
To remove an owner, perform the following:
mcvirt permission --delete-owner <Username> <VM Name>
Only superusers are able to manage the owners of a VM.
API Documentation¶
Contents:
mcvirt package¶
Subpackages¶
mcvirt.auth package¶
Submodules¶
mcvirt.auth.auth module¶
Provide auth class for managing permissions.
-
class
mcvirt.auth.auth.
Auth
[source]¶ Bases:
mcvirt.rpc.pyro_object.PyroObject
Provides authentication and permissions for performing functions within MCVirt.
-
add_user_permission_group
(*args, **kwargs)¶
-
assert_permission
(permission_enum, vm_object=None)[source]¶ Use check_permission function to determine if a user has a given permission and throws an exception if the permission is not present.
-
assert_user_type
(*user_type_names)[source]¶ Ensure that the currently logged in user is of a specified type.
-
check_permission
(permission_enum, vm_object=None, user_object=None)[source]¶ Check that the user has a given permission, either globally through MCVirt or for a given VM.
-
check_permission_in_config
(permission_config, user, permission_enum)[source]¶ Read permissions config and determines if a user has a given permission.
-
static
check_root_privileges
()[source]¶ Ensure that the user is either running as root or using sudo.
-
check_user_type
(*user_type_names)[source]¶ Check that the currently logged-in user is of a specified type.
-
copy_permissions
(source_vm, dest_vm)[source]¶ Copy the permissions from a given VM to this VM. This functionality is used whilst cloning a VM
-
delete_user_permission_group
(*args, **kwargs)¶
-
mcvirt.auth.cluster_user module¶
Provide class for managing cluster users.
-
class
mcvirt.auth.cluster_user.
ClusterUser
(username)[source]¶ Bases:
mcvirt.auth.user_base.UserBase
User type for cluster daemon users.
-
CAN_GENERATE
= True¶
-
CLUSTER_USER
= True¶
-
DISTRIBUTED
= False¶
-
USER_PREFIX
= 'mcv-cluster-'¶
-
allow_proxy_user
¶ Connection users can proxy for another user.
-
node
¶ Return the node that the user is used for
-
mcvirt.auth.connection_user module¶
Provide class for managing connection users.
-
class
mcvirt.auth.connection_user.
ConnectionUser
(username)[source]¶ Bases:
mcvirt.auth.user_base.UserBase
User type for initial connection users
-
CAN_GENERATE
= True¶
-
CLUSTER_USER
= True¶
-
DISTRIBUTED
= False¶
-
PERMISSIONS
= [<Mock id='139879885448592'>]¶
-
USER_PREFIX
= 'mcv-connection-'¶
-
allow_proxy_user
¶ Connection users can proxy for another user.
-
mcvirt.auth.factory module¶
Provide factory class to create/obtain users.
-
class
mcvirt.auth.factory.
Factory
[source]¶ Bases:
mcvirt.rpc.pyro_object.PyroObject
Class for obtaining user objects
-
USER_CLASS
¶ alias of
UserBase
-
generate_user
(user_type)[source]¶ Remove any existing connection user and generates credentials for a new connection user.
-
mcvirt.auth.permissions module¶
Provide permission enum and permission group definitions.
mcvirt.auth.session module¶
Provide class for managing authentication sessions.
mcvirt.auth.user module¶
Provide class for regular MCVirt interactive users
-
class
mcvirt.auth.user.
User
(username)[source]¶ Bases:
mcvirt.auth.user_base.UserBase
Provides an interaction with the local user backend
mcvirt.auth.user_base module¶
Provide a base class for user objects.
-
class
mcvirt.auth.user_base.
UserBase
(username)[source]¶ Bases:
mcvirt.rpc.pyro_object.PyroObject
Base object for users (both user and automated).
-
CAN_GENERATE
= False¶
-
CLUSTER_USER
= False¶
-
DISTRIBUTED
= True¶
-
PERMISSIONS
= []¶
-
USER_PREFIX
= None¶
-
allow_proxy_user
¶ Connection users can proxy for another user.
-
delete
(*args, **kwargs)¶
-
Module contents¶
mcvirt.client package¶
Submodules¶
mcvirt.client.rpc module¶
Provide class for connecting to RPC daemon
-
class
mcvirt.client.rpc.
Connection
(username=None, password=None, session_id=None, host=None, ignore_cluster=False)[source]¶ Bases:
object
Connection class, providing connections to the Pyro MCVirt daemon
-
NS_PORT
= 9090¶
-
SESSION_OBJECT
= 'session'¶
-
get_connection
(object_name, password=None)[source]¶ Obtain a connection from pyro for a given object
-
session_id
¶ Property for the session ID
-
Module contents¶
mcvirt.cluster package¶
Submodules¶
mcvirt.cluster.cluster module¶
Provide cluster classes
-
class
mcvirt.cluster.cluster.
Cluster
[source]¶ Bases:
mcvirt.rpc.pyro_object.PyroObject
Class to perform node management within the MCVirt cluster
-
add_node
(*args, **kwargs)¶
-
add_node_configuration
(*args, **kwargs)¶
-
check_ip_configuration
()[source]¶ Perform various checks to ensure that the IP configuration is such that is suitable to be part of a cluster
-
check_node_versions
()[source]¶ Ensure that all nodes in the cluster are connected and checks the node Status
-
check_remote_machine
(remote_connection)[source]¶ Perform checks on the remote node to ensure that there will be no object conflicts when syncing the Network and VM configurations
-
generate_connection_info
()[source]¶ Generate required information to connect to this node from a remote node
-
get_remote_node
(node, ignore_cluster_master=False)[source]¶ Obtain a Remote object for a node, caching the object
-
remove_node
(*args, **kwargs)¶
-
remove_node_configuration
(node_name)[source]¶ Remove an MCVirt node from the configuration and regenerates authorized_keys file
-
run_remote_command
(callback_method, nodes=None, args=[], kwargs={})[source]¶ Run a remote command on all (or a given list of) remote nodes
-
mcvirt.cluster.remote module¶
Provide interface for RPC to cluster nodes
-
class
mcvirt.cluster.remote.
Node
(name, node_config)[source]¶ Bases:
mcvirt.client.rpc.Connection
A class to perform remote commands on MCVirt nodes
Module contents¶
mcvirt.iso package¶
Submodules¶
mcvirt.iso.factory module¶
Provide factory class for ISO
mcvirt.iso.iso module¶
Provide class for managing ISO files
-
class
mcvirt.iso.iso.
Iso
(name)[source]¶ Bases:
mcvirt.rpc.pyro_object.PyroObject
Provides management of ISOs for use in MCVirt
-
in_use
¶ Determine if the ISO is currently in use by a VM
-
Module contents¶
mcvirt.node package¶
Subpackages¶
mcvirt.node.network package¶
Provide class for generating network objects
-
class
mcvirt.node.network.factory.
Factory
[source]¶ Bases:
mcvirt.rpc.pyro_object.PyroObject
Class for obtaining network objects
-
OBJECT_TYPE
= 'network'¶
-
create
(*args, **kwargs)¶
-
Provide interface to libvirt network objects
-
class
mcvirt.node.network.network.
Network
(name)[source]¶ Bases:
mcvirt.rpc.pyro_object.PyroObject
Provides an interface to LibVirt networks
-
delete
(*args, **kwargs)¶
-
Submodules¶
mcvirt.node.drbd module¶
Provides interface to mange the DRBD installation.
-
class
mcvirt.node.drbd.
Drbd
[source]¶ Bases:
mcvirt.rpc.pyro_object.PyroObject
Performs configuration of DRBD on the node
-
CLUSTER_SIZE
= 2¶
-
CONFIG_DIRECTORY
= '/etc/drbd.d'¶
-
DrbdADM
= '/sbin/drbdadm'¶
-
GLOBAL_CONFIG
= '/etc/drbd.d/global_common.conf'¶
-
GLOBAL_CONFIG_TEMPLATE
= '/usr/lib/mcvirt/templates/drbd_global.conf'¶
-
adjust_drbd_config
(resource='all')[source]¶ Perform a Drbd adjust, which updates the Drbd running configuration
-
enable
(*args, **kwargs)¶
-
get_all_drbd_hard_drive_object
(include_remote=False)[source]¶ Obtain all hard drive objects that are backed by DRBD
-
mcvirt.node.libvirt_config module¶
Provide class to configure libvirtd
-
class
mcvirt.node.libvirt_config.
LibvirtConfig
[source]¶ Bases:
mcvirt.rpc.pyro_object.PyroObject
Provides configuration for libvirtd
-
CONFIG_FILE
= '/etc/libvirt/libvirtd.conf'¶
-
CONFIG_TEMPLATE
= '/usr/lib/mcvirt/templates/libvirtd.conf'¶
-
DEFAULT_CONFIG
= '\n# Defaults for libvirtd initscript (/etc/init.d/libvirtd)\n# This is a POSIX shell fragment\n\n# Start libvirtd to handle qemu/kvm:\nstart_libvirtd="yes"\n\n# options passed to libvirtd, add "-l" to listen on tcp\nlibvirtd_opts=" --listen --verbose %s"\n'¶
-
DEFAULT_FILE
= '/etc/default/%s'¶
-
mcvirt.node.node module¶
Perform configurations for local node.
-
class
mcvirt.node.node.
Node
[source]¶ Bases:
mcvirt.rpc.pyro_object.PyroObject
Provides methods to configure the local node.
-
set_cluster_ip_address
(*args, **kwargs)¶
-
set_storage_volume_group
(*args, **kwargs)¶
-
Module contents¶
mcvirt.rpc package¶
Submodules¶
mcvirt.rpc.certificate_generator module¶
Provides class to generate and manage SSL certificates
-
class
mcvirt.rpc.certificate_generator.
CertificateGenerator
(server=None, remote=False)[source]¶ Bases:
mcvirt.rpc.pyro_object.PyroObject
Class for providing SSL socket wrappers for Pyro. Since the MCVirt isn’t available for 2/3 of the time that this is used (NS and CLI), all methods are static and paths are calculated manually. @TODO Fix this in future - create MCVirt config class.
-
OPENSSL
= '/usr/bin/openssl'¶
-
ca_key_file
¶ Return/generate the CA prviate key.
-
ca_pub_file
¶ Return/generate the CA pub file
-
check_certificates
(check_client=True)[source]¶ Ensure that the required certificates are available to start the daemon and connect to the local host
-
client_csr
¶ Return the client CSR
-
client_key_file
¶ Obtain the private key for the client key
-
client_pub_file
¶ Return/generate the client public file, used for connecting to the libvirt daemon
-
is_local
¶ Determine if the server is the local machine
-
remote_ssl_directory
¶ Return the ‘remote’ subdirectory of server, used for storing certificates that are used by a remote server.
-
server_key_file
¶ Obtain the server private key file
-
server_pub_file
¶ Obtain the server public key file
-
ssl_base_directory
¶ Return the base SSL directory for the node.
-
ssl_directory
¶ Return the SSL directory for the server
-
ssl_dn
¶ “Return the certificate DN is openssl argument format.
-
ssl_subj
¶ Return the SSL DN in regular format
-
mcvirt.rpc.certificate_generator_factory module¶
Provides an interface to obtain certificate generator objects
-
class
mcvirt.rpc.certificate_generator_factory.
CertificateGeneratorFactory
[source]¶ Bases:
mcvirt.rpc.pyro_object.PyroObject
Provides an interface to obtain certificate generator objects
mcvirt.rpc.constants module¶
Provides constants for the RPC daemon
mcvirt.rpc.daemon_lock module¶
Provides a locking mechanism for the MCVirt daemon
mcvirt.rpc.lock module¶
Provides classes for locking the MCVirt daemon whilst a function is being performed
mcvirt.rpc.name_server module¶
Thread for running the name server
mcvirt.rpc.pyro_object module¶
Base class for providing Pyro-based methods for objects
mcvirt.rpc.rpc_daemon module¶
Provide class for RPC daemon.
-
class
mcvirt.rpc.rpc_daemon.
BaseRpcDaemon
(*args, **kwargs)[source]¶ Bases:
Pyro4.core.Daemon
Override Pyro daemon to add authentication checks and MCVirt integration
-
class
mcvirt.rpc.rpc_daemon.
DaemonSession
[source]¶ Bases:
object
Class for allowing client to obtain the session ID
-
class
mcvirt.rpc.rpc_daemon.
RpcNSMixinDaemon
[source]¶ Bases:
object
Wrapper for the daemon. Required since the Pyro daemon class overrides get/setattr and other built-in object methods
-
DAEMON
= None¶
-
mcvirt.rpc.ssl_socket module¶
Provides methods for wrapping Pyro methods with SSL
-
class
mcvirt.rpc.ssl_socket.
SSLSocket
[source]¶ Bases:
object
Provides methods for wrapping Pyro methods with SSL
-
static
create_broadcast_ssl_socket
(*args, **kwargs)[source]¶ Override the Pyro createBroadcastSocket method and wrap with SSL
-
static
Module contents¶
mcvirt.test package¶
Subpackages¶
mcvirt.test.lock package¶
-
class
mcvirt.test.lock.lock_tests.
LockTests
(methodName='runTest')[source]¶ Bases:
mcvirt.test.test_base.TestBase
Provide unit tests for the functionality provided by the node subparser
mcvirt.test.node package¶
-
class
mcvirt.test.node.network_tests.
NetworkTests
(methodName='runTest')[source]¶ Bases:
mcvirt.test.test_base.TestBase
Test suite for performing tests on the network class
-
class
mcvirt.test.node.node_tests.
NodeTests
(methodName='runTest')[source]¶ Bases:
mcvirt.test.test_base.TestBase
Provide unit tests for the functionality provided by the node subparser
mcvirt.test.virtual_machine package¶
-
class
mcvirt.test.virtual_machine.online_migrate_tests.
LibvirtConnectorUnitTest
[source]¶ Bases:
mcvirt.libvirt_connector.LibvirtConnector
Override LibvirtConnector class to provide ability to cause connection errors whilst connecting to remote libvirt instances
-
exception
mcvirt.test.virtual_machine.online_migrate_tests.
LibvirtFailureSimulationException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
A libvirt command has been simulated to fail
-
class
mcvirt.test.virtual_machine.online_migrate_tests.
OnlineMigrateTests
(methodName='runTest')[source]¶ Bases:
mcvirt.test.test_base.TestBase
Provides unit tests for the onlineMigrate function
-
RPC_DAEMON
= None¶
-
test_migrate
(*args)¶
-
test_migrate_drbd_not_connected
(*args)¶
-
test_migrate_inappropriate_node
(*args)¶
-
test_migrate_invalid_iso
(*args)¶
-
test_migrate_invalid_network
(*args)¶
-
test_migrate_invalid_node
(*args)¶
-
test_migrate_libvirt_connection_failure
(*args)¶
-
test_migrate_locked
(*args)¶
-
test_migrate_post_migration_libvirt_failure
(*args)¶
-
test_migrate_pre_migration_libvirt_failure
(*args)¶
-
test_migrate_stopped_vm
(*args)¶
-
test_migrate_unregistered
(*args)¶
-
-
class
mcvirt.test.virtual_machine.online_migrate_tests.
VirtualMachineLibvirtFail
(virtual_machine_factory, name)[source]¶ Bases:
mcvirt.virtual_machine.virtual_machine.VirtualMachine
Override the VirtulMachine class to add overrides for simulating libvirt failures.
-
LIBVIRT_FAILURE_MODE
¶
-
-
class
mcvirt.test.virtual_machine.virtual_machine_tests.
VirtualMachineTests
(methodName='runTest')[source]¶ Bases:
mcvirt.test.test_base.TestBase
Provide unit tests for the VirtualMachine class
-
test_clone_drbd
(*args)¶
-
test_create_drbd
(*args)¶
-
test_create_drbd_not_enabled
(*args)¶
-
test_delete_drbd
(*args)¶
-
test_duplicate
(storage_type)[source]¶ Attempt to duplicate a VM using the argument parser and perform tests on the parent and duplicate VM
-
test_duplicate_drbd
(*args)¶
-
test_offline_migrate
(*args)¶
-
test_start_drbd
(*args)¶
-
test_stop_drbd
(*args)¶
-
test_unspecified_storage_type_drbd
(*args)¶
-
test_unspecified_storage_type_local
(*args)¶
-
Submodules¶
mcvirt.test.auth_tests module¶
-
class
mcvirt.test.auth_tests.
AuthTests
(methodName='runTest')[source]¶ Bases:
mcvirt.test.test_base.TestBase
Provides unit tests for the Auth class
-
TEST_PASSWORD
= 'test-password'¶
-
TEST_USERNAME
= 'test-user'¶
-
TEST_USERNAME_ALTERNATIVE
= 'user-to-delete'¶
-
create_test_user
(username, password)[source]¶ Create a test user, annotate the user object and return it
-
parse_command
(command, username, password)[source]¶ Parse the specified command with the specified credentials
-
test_add_remove_user_permission
()[source]¶ Add a user to a virtual machine, using the argument parser
-
mcvirt.test.run_tests module¶
mcvirt.test.test_base module¶
mcvirt.test.unit_test_bootstrap module¶
mcvirt.test.update_tests module¶
-
class
mcvirt.test.update_tests.
UpdateTests
(methodName='runTest')[source]¶ Bases:
mcvirt.test.test_base.TestBase
Provide unit tests for the functionality provided by the update subparser
mcvirt.test.validation_tests module¶
-
class
mcvirt.test.validation_tests.
ValidationTests
(methodName='runTest')[source]¶ Bases:
mcvirt.test.test_base.TestBase
Provides unit tests for validation
-
test_create_network
()[source]¶ Test creating a netork with an invalid name to check that network creation uses ArgumentValidator
-
test_validity
(validator, valid_list, invalid_list, expected_exception=<type 'exceptions.TypeError'>)[source]¶ Use the provided validator function to test each string in valid_list and invalid_list, failing the test if expected_exception is raised for anything in valid_list, and failing if the exception is NOT raised for anything in invalid_list
-
Module contents¶
mcvirt.virtual_machine package¶
Subpackages¶
mcvirt.virtual_machine.hard_drive package¶
Provide base operations to manage all hard drives, used by VMs
-
class
mcvirt.virtual_machine.hard_drive.base.
Base
(vm_object, disk_id=None, driver=None)[source]¶ Bases:
mcvirt.rpc.pyro_object.PyroObject
Provides base operations to manage all hard drives, used by VMs
-
DEFAULT_DRIVER
¶
-
MAXIMUM_DEVICES
= 1¶
-
SNAPSHOT_SIZE
= '500M'¶
-
SNAPSHOT_SUFFIX
= '_snapshot'¶
-
activateLogicalVolume
(*args, **kwargs)¶
-
addToVirtualMachine
(*args, **kwargs)¶
-
clone
(destination_vm_object)[source]¶ Clone a VM, using snapshotting, attaching it to the new VM object
-
config_properties
¶ Return the disk object config items
-
create
()[source]¶ Creates a new disk image, attaches the disk to the VM and records the disk in the VM configuration
-
createBackupSnapshot
()[source]¶ Creates a snapshot of the logical volume for backing up and locks the VM
-
createLogicalVolume
(*args, **kwargs)¶
-
disk_id
¶ Return the disk ID of the current disk, generating a new one if there is not already one present
-
driver
¶ Return the disk drive driver name
-
get_remote_object
(node_name=None, remote_node=None, registered=True)[source]¶ Obtain an instance of the current hard drive object on a remote node
-
increaseSize
(*args, **kwargs)¶
-
preMigrationChecks
(destination_node)[source]¶ Determines if the disk is in a state to allow the attached VM to be migrated to another node
-
preOnlineMigration
()[source]¶ Performs required tasks in order for the underlying VM to perform an online migration
-
removeFromVirtualMachine
(*args, **kwargs)¶
-
removeLogicalVolume
(*args, **kwargs)¶
-
zeroLogicalVolume
(*args, **kwargs)¶
-
-
class
mcvirt.virtual_machine.hard_drive.drbd.
Drbd
(drbd_minor=None, drbd_port=None, *args, **kwargs)[source]¶ Bases:
mcvirt.virtual_machine.hard_drive.base.Base
Provides operations to manage Drbd-backed hard drives, used by VMs
-
CACHE_MODE
= 'none'¶
-
CREATE_PROGRESS
¶
-
Drbd_CONFIG_TEMPLATE
= '/usr/lib/mcvirt/templates/drbd_resource.conf'¶
-
Drbd_META_SUFFIX
= 'meta'¶
-
Drbd_RAW_SUFFIX
= 'raw'¶
-
Drbd_STATES
= {'CONNECTION': {'CONNECTED': [<Mock id='139879884454480'>, <Mock id='139879883919696'>, <Mock id='139879895072464'>, <Mock id='139879886588880'>, <Mock id='139879881399312'>, <Mock id='139879878593616'>, <Mock id='139879881478992'>, <Mock id='139879886774672'>, <Mock id='139879887715920'>, <Mock id='139879879171856'>], 'WARNING': [<Mock id='139879893623312'>, <Mock id='139879893648592'>, <Mock id='139879893653392'>, <Mock id='139879893551696'>, <Mock id='139879893478672'>, <Mock id='139879893491664'>, <Mock id='139879893566160'>], 'OK': [<Mock id='139879883844432'>, <Mock id='139879890713104'>, <Mock id='139879890534800'>, <Mock id='139879890960912'>, <Mock id='139879890612624'>, <Mock id='139879884047888'>, <Mock id='139879884675856'>, <Mock id='139879886824016'>, <Mock id='139879896450832'>]}, 'DISK': {'WARNING': [<Mock id='139879890647824'>, <Mock id='139879890705872'>], 'OK': [<Mock id='139879890597968'>]}, 'ROLE': {'WARNING': [], 'OK': [<Mock id='139879893685648'>]}}¶
-
INITIAL_MINOR
= 1¶
-
INITIAL_PORT
= 7789¶
-
config_properties
¶ Return the disk object config items
-
create
(size)[source]¶ Creates a new hard drive, attaches the disk to the VM and records the disk in the VM configuration
-
drbdConnect
(*args, **kwargs)¶
-
drbdDisconnect
(*args, **kwargs)¶
-
drbdDown
(*args, **kwargs)¶
-
drbdSetPrimary
(*args, **kwargs)¶
-
drbdSetSecondary
(*args, **kwargs)¶
-
drbdUp
(*args, **kwargs)¶
-
drbd_minor
¶ Returns the Drbd port assigned to the hard drive
-
drbd_port
¶ Returns the Drbd port assigned to the hard drive
-
generateDrbdConfig
(*args, **kwargs)¶
-
initialiseMetaData
(*args, **kwargs)¶
-
move
(destination_node, source_node)[source]¶ Replaces a remote node for the Drbd volume with a new node and syncs the data
-
preMigrationChecks
()[source]¶ Ensures that the Drbd state of the disk is in a state suitable for migration
-
preOnlineMigration
(destination_node)[source]¶ Performs required tasks in order for the underlying VM to perform an online migration
-
removeDrbdConfig
(*args, **kwargs)¶
-
resource_name
¶ Returns the Drbd resource name for the hard drive object
-
setSyncState
(*args, **kwargs)¶
-
setTwoPrimariesConfig
(*args, **kwargs)¶
-
-
class
mcvirt.virtual_machine.hard_drive.factory.
Factory
[source]¶ Bases:
mcvirt.rpc.pyro_object.PyroObject
Provides a factory for creating hard drive/hard drive config objects
-
DEFAULT_STORAGE_TYPE
= 'Local'¶
-
HARD_DRIVE_CLASS
¶ alias of
Base
-
OBJECT_TYPE
= 'hard disk'¶
-
STORAGE_TYPES
= [<class 'mcvirt.virtual_machine.hard_drive.local.Local'>, <class 'mcvirt.virtual_machine.hard_drive.drbd.Drbd'>]¶
-
create
(*args, **kwargs)¶
-
-
class
mcvirt.virtual_machine.hard_drive.local.
Local
(*args, **kwargs)[source]¶ Bases:
mcvirt.virtual_machine.hard_drive.base.Base
Provides operations to manage local hard drives, used by VMs
-
CACHE_MODE
= 'directsync'¶
-
MAXIMUM_DEVICES
= 4¶
-
clone
(destination_vm_object)[source]¶ Clone a VM, using snapshotting, attaching it to the new VM object
-
create
(size)[source]¶ Creates a new disk image, attaches the disk to the VM and records the disk in the VM configuration
-
increaseSize
(*args, **kwargs)¶
-
mcvirt.virtual_machine.network_adapter package¶
-
class
mcvirt.virtual_machine.network_adapter.factory.
Factory
[source]¶ Bases:
mcvirt.rpc.pyro_object.PyroObject
Factory method to create/obtain network adapter instances
-
NETWORK_ADAPTER_CLASS
¶ alias of
NetworkAdapter
-
OBJECT_TYPE
= 'network adapter'¶
-
create
(*args, **kwargs)¶
-
Provide class for network adapters.
-
class
mcvirt.virtual_machine.network_adapter.network_adapter.
NetworkAdapter
(mac_address, vm_object)[source]¶ Bases:
mcvirt.rpc.pyro_object.PyroObject
Provides operations to network interfaces attached to a VM
-
delete
(*args, **kwargs)¶
-
Submodules¶
mcvirt.virtual_machine.disk_drive module¶
-
class
mcvirt.virtual_machine.disk_drive.
DiskDrive
(vm_object)[source]¶ Bases:
mcvirt.rpc.pyro_object.PyroObject
Provides operations to manage the disk drive attached to a VM
mcvirt.virtual_machine.factory module¶
-
class
mcvirt.virtual_machine.factory.
Factory
[source]¶ Bases:
mcvirt.rpc.pyro_object.PyroObject
Class for obtaining virtual machine objects
-
OBJECT_TYPE
= 'virtual machine'¶
-
VIRTUAL_MACHINE_CLASS
¶ alias of
VirtualMachine
-
create
(*args, **kwargs)¶
-
getAllVmNames
(node=None)[source]¶ Returns a list of all VMs within the cluster or those registered on a specific node
-
listVms
(*args, **kwargs)¶
-
mcvirt.virtual_machine.virtual_machine module¶
Provides virtual machine class.
-
class
mcvirt.virtual_machine.virtual_machine.
VirtualMachine
(virtual_machine_factory, name)[source]¶ Bases:
mcvirt.rpc.pyro_object.PyroObject
Provides operations to manage a LibVirt virtual machine.
-
OBJECT_TYPE
= 'virtual machine'¶
-
clone
(*args, **kwargs)¶
-
delete
(*args, **kwargs)¶
-
duplicate
(*args, **kwargs)¶
-
editConfig
(*args, **kwargs)¶
-
ensureRegisteredLocally
()[source]¶ Ensures that the VM is registered locally, otherwise an exception is thrown
-
get_remote_object
()[source]¶ Return a instance of the virtual machine object on the machine that the VM is registered
-
move
(*args, **kwargs)¶
-
offlineMigrate
(*args, **kwargs)¶
-
onlineMigrate
(*args, **kwargs)¶
-
register
(*args, **kwargs)¶
-
reset
(*args, **kwargs)¶
-
setBootOrder
(boot_devices)[source]¶ Sets the boot devices and the order in which devices are booted from
-
setNodeRemote
(*args, **kwargs)¶
-
start
(*args, **kwargs)¶
-
stop
(*args, **kwargs)¶
-
unregister
(*args, **kwargs)¶
-
updateCPU
(*args, **kwargs)¶
-
updateRAM
(*args, **kwargs)¶
-
mcvirt.virtual_machine.virtual_machine_config module¶
-
class
mcvirt.virtual_machine.virtual_machine_config.
VirtualMachineConfig
(vm_object)[source]¶ Bases:
mcvirt.config_file.ConfigFile
Provides operations to obtain and set the MCVirt configuration for a VM
Module contents¶
Submodules¶
mcvirt.argument_validator module¶
Argument validators.
mcvirt.bash-complete module¶
mcvirt.config_file module¶
Provide base class for configuration files
mcvirt.constants module¶
Provide constants used throughout MCVirt.
-
class
mcvirt.constants.
DirectoryLocation
[source]¶ Bases:
object
Provides directory/file path constants.
-
BASE_STORAGE_DIR
= '/var/lib/mcvirt'¶
-
BASE_VM_STORAGE_DIR
= '/var/lib/mcvirt/build-4189623-project-52530-mcvirt/vm'¶
-
ISO_STORAGE_DIR
= '/var/lib/mcvirt/build-4189623-project-52530-mcvirt/iso'¶
-
LOCK_FILE
= '/var/run/lock/mcvirt/lock'¶
-
LOCK_FILE_DIR
= '/var/run/lock/mcvirt'¶
-
LOG_FILE
= '/var/log/mcvirt.log'¶
-
NODE_STORAGE_DIR
= '/var/lib/mcvirt/build-4189623-project-52530-mcvirt'¶
-
TEMPLATE_DIR
= '/usr/lib/mcvirt/templates'¶
-
mcvirt.exceptions module¶
Provide access to all MCVirt exceptions.
-
exception
mcvirt.exceptions.
ArgumentParserException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
An invalid argument was provided
-
exception
mcvirt.exceptions.
AttributeAlreadyChanged
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Attribute, user is trying to change, has already changed
-
exception
mcvirt.exceptions.
AuthenticationError
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Incorrect credentials
-
exception
mcvirt.exceptions.
BackupSnapshotAlreadyExistsException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
The backup snapshot for the logical volume already exists
-
exception
mcvirt.exceptions.
BackupSnapshotDoesNotExistException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
The backup snapshot for the logical volume does not exist
-
exception
mcvirt.exceptions.
BlankPasswordException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
The provided password is blank
-
exception
mcvirt.exceptions.
CACertificateAlreadyExists
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
CA file for server already exists
-
exception
mcvirt.exceptions.
CACertificateNotFoundException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
CA certificate for host could not be found
-
exception
mcvirt.exceptions.
CAFileAlreadyExists
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
The CA file already exists.
-
exception
mcvirt.exceptions.
CannotCloneDrbdBasedVmsException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Cannot clone Drbd-based VMs
-
exception
mcvirt.exceptions.
CannotDeleteClonedVmException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Cannot delete a cloned VM
-
exception
mcvirt.exceptions.
CannotMigrateLocalDiskException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Local disks cannot be migrated
-
exception
mcvirt.exceptions.
CannotStartClonedVmException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Cloned VMs cannot be started
-
exception
mcvirt.exceptions.
ClusterNotInitialisedException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
The cluster has not been initialised, so cannot connect to the remote node
-
exception
mcvirt.exceptions.
ConfigFileCouldNotBeFoundException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Config file could not be found
-
exception
mcvirt.exceptions.
ConnectionFailureToRemoteLibvirtInstance
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Connection failure whilst attempting to obtain a remote libvirt connection
-
exception
mcvirt.exceptions.
CouldNotConnectToNodeException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Could not connect to remove cluster node
-
exception
mcvirt.exceptions.
CurrentUserError
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Error whilst obtaining current pyro user
-
exception
mcvirt.exceptions.
DiskAlreadyExistsException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
The disk already exists
-
exception
mcvirt.exceptions.
DrbdAlreadyEnabled
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Drbd has already been enabled on this node
-
exception
mcvirt.exceptions.
DrbdBlockDeviceDoesNotExistException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Drbd block device does not exist
-
exception
mcvirt.exceptions.
DrbdNotEnabledOnNode
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Drbd volumes cannot be created on a node that has not been configured to use Drbd
-
exception
mcvirt.exceptions.
DrbdNotInstalledException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Drbd is not installed
-
exception
mcvirt.exceptions.
DrbdStateException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
The Drbd state is not OK
-
exception
mcvirt.exceptions.
DrbdVolumeNotInSyncException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
The last Drbd verification of the volume failed
-
exception
mcvirt.exceptions.
DuplicatePermissionException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
User already exists in group
-
exception
mcvirt.exceptions.
ExternalStorageCommandErrorException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
An error occurred whilst performing an external command
-
exception
mcvirt.exceptions.
FailedToRemoveFileException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
A failure occurred whilst trying to remove an ISO
-
exception
mcvirt.exceptions.
HardDriveDoesNotExistException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
The given hard drive does not exist
-
exception
mcvirt.exceptions.
InaccessibleNodeException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
,Pyro4.errors.SecurityError
Unable to connect to node in the cluster
-
exception
mcvirt.exceptions.
IncorrectCredentials
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
The supplied credentials are incorrect
-
exception
mcvirt.exceptions.
InsufficientPermissionsException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
User does not have the required permission
-
exception
mcvirt.exceptions.
InterfaceDoesNotExist
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Physical interface does not exist
-
exception
mcvirt.exceptions.
InvalidArgumentException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Argument given is not valid
-
exception
mcvirt.exceptions.
InvalidConnectionString
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Connection string is invalid
-
exception
mcvirt.exceptions.
InvalidIPAddressException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
The specified IP address is invalid
-
exception
mcvirt.exceptions.
InvalidISOPathException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
ISO to add does not exist
-
exception
mcvirt.exceptions.
InvalidNodesException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
The nodes passed is invalid
-
exception
mcvirt.exceptions.
InvalidPermissionGroupException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Attempted to perform actions on an invalid permission group
-
exception
mcvirt.exceptions.
InvalidUserTypeException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
An invalid user type was specified.
-
exception
mcvirt.exceptions.
InvalidUsernameException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Username is within a reserved namespace
-
exception
mcvirt.exceptions.
InvalidVirtualMachineNameException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
VM is being created with an invalid name
-
exception
mcvirt.exceptions.
InvalidVolumeGroupNameException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
The specified name of the volume group is invalid
-
exception
mcvirt.exceptions.
IsoAlreadyExistsException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
An ISO with the same name already exists
-
exception
mcvirt.exceptions.
IsoInUseException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
The ISO is in use, so cannot be removed
-
exception
mcvirt.exceptions.
IsoNotPresentOnDestinationNodeException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
ISO attached to VM does not exist on destination node whilst performing a migration]
-
exception
mcvirt.exceptions.
LibVirtConnectionException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
An error ocurred whilst connecting to LibVirt
-
exception
mcvirt.exceptions.
LibvirtException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Issue with performing libvirt command
-
exception
mcvirt.exceptions.
LibvirtNotInstalledException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Libvirt does not appear to be installed
-
exception
mcvirt.exceptions.
LogicalVolumeDoesNotExistException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
A required logical volume does not exist
-
exception
mcvirt.exceptions.
MCVirtCommandException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Provides an exception to be thrown after errors whilst calling external commands
-
exception
mcvirt.exceptions.
MCVirtException
[source]¶ Bases:
exceptions.Exception
Provides an exception to be thrown for errors in MCVirt
-
exception
mcvirt.exceptions.
MCVirtLockException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
A lock has already been found
-
exception
mcvirt.exceptions.
MigrationFailureExcpetion
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
A Libvirt Exception occurred whilst performing a migration
-
exception
mcvirt.exceptions.
MissingConfigurationException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Configuration is missing
-
exception
mcvirt.exceptions.
MustGenerateCertificateException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
The certificate cannot be manually added and must be generated
-
exception
mcvirt.exceptions.
NameNotSpecifiedException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
A name has not been specified and cannot be determined by the path/URL
-
exception
mcvirt.exceptions.
NetworkAdapterDoesNotExistException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
The network adapter does not exist
-
exception
mcvirt.exceptions.
NetworkAlreadyExistsException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Network already exists with the same name
-
exception
mcvirt.exceptions.
NetworkDoesNotExistException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Network does not exist
-
exception
mcvirt.exceptions.
NetworkUtilizedException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Network is utilized by virtual machines
-
exception
mcvirt.exceptions.
NodeAlreadyPresent
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Node being added is already connected to cluster
-
exception
mcvirt.exceptions.
NodeAuthenticationException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Incorrect password supplied for remote node
-
exception
mcvirt.exceptions.
NodeDoesNotExistException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
The node does not exist
-
exception
mcvirt.exceptions.
NodeVersionMismatch
[source]¶ Bases:
Pyro4.errors.SecurityError
A node is running a different version of MCVirt
-
exception
mcvirt.exceptions.
OpenSSLNotFoundException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
The OpenSSL executable could not be found
-
exception
mcvirt.exceptions.
PasswordsDoNotMatchException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
The new passwords do not match
-
exception
mcvirt.exceptions.
ReachedMaximumStorageDevicesException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Reached the limit to number of hard disks attached to VM
-
exception
mcvirt.exceptions.
RemoteCommandExecutionFailedException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
A remote command execution fails
-
exception
mcvirt.exceptions.
RemoteNodeLockedException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Remote node is locked
-
exception
mcvirt.exceptions.
RemoteObjectConflict
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
The remote node contains an object that will cause conflict when syncing
-
exception
mcvirt.exceptions.
StorageTypeNotSpecified
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Storage type has not been specified
-
exception
mcvirt.exceptions.
StorageTypesCannotBeMixedException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Storage types cannot be mixed within a single VM
-
exception
mcvirt.exceptions.
UnknownRemoteCommandException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
An unknown command was passed to the remote machine
-
exception
mcvirt.exceptions.
UnknownStorageTypeException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
An hard drive object with an unknown disk type has been initialised
-
exception
mcvirt.exceptions.
UnprivilegedUserException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Unprivileged user running executable
-
exception
mcvirt.exceptions.
UnsuitableNodeException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
The node is unsuitable to run the VM
-
exception
mcvirt.exceptions.
UserAlreadyExistsException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
The given user already exists.
-
exception
mcvirt.exceptions.
UserDoesNotExistException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
The specified user does not exist
-
exception
mcvirt.exceptions.
UserNotPresentInGroup
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
User to be removed from group is not in the group
-
exception
mcvirt.exceptions.
VirtualMachineDoesNotExistException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Virtual machine does not exist
-
exception
mcvirt.exceptions.
VirtualMachineLockException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Lock cannot be set to the current lock state
-
exception
mcvirt.exceptions.
VmAlreadyExistsException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
VM is being created with a duplicate name
-
exception
mcvirt.exceptions.
VmAlreadyRegisteredException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
VM is already registered on a node
-
exception
mcvirt.exceptions.
VmAlreadyStartedException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
VM is already started when attempting to start it
-
exception
mcvirt.exceptions.
VmAlreadyStoppedException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
VM is already stopped when attempting to stop it
-
exception
mcvirt.exceptions.
VmDirectoryAlreadyExistsException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Directory for a VM already exists
-
exception
mcvirt.exceptions.
VmIsCloneException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
VM is a clone
-
exception
mcvirt.exceptions.
VmNotRegistered
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
The virtual machine is not currently registered on a node
-
exception
mcvirt.exceptions.
VmRegisteredElsewhereException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
Attempt to perform an action on a VM registered on another node
-
exception
mcvirt.exceptions.
VmRunningException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
An offline migration can only be performed on a powered off VM
-
exception
mcvirt.exceptions.
VmStoppedException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
An online migraiton can only be performed on a powered on VM
-
exception
mcvirt.exceptions.
VncNotEnabledException
[source]¶ Bases:
mcvirt.exceptions.MCVirtException
VNC is not enabled on the VM
-
mcvirt.exceptions.
exception_class
¶ alias of
InaccessibleNodeException
mcvirt.libvirt_connector module¶
-
class
mcvirt.libvirt_connector.
LibvirtConnector
[source]¶ Bases:
mcvirt.rpc.pyro_object.PyroObject
Obtains/manages Libvirt connections
mcvirt.logger module¶
-
class
mcvirt.logger.
LogItem
(method, user, object_name, object_type)[source]¶ Bases:
object
-
description
¶
-
-
class
mcvirt.logger.
LogState
[source]¶ Bases:
object
-
FAILED
= {'status': 3, 'name': 'FAILED'}¶
-
QUEUED
= {'status': 0, 'name': 'QUEUED'}¶
-
RUNNING
= {'status': 1, 'name': 'RUNNING'}¶
-
SUCCESS
= {'status': 2, 'name': 'SUCCESS'}¶
-
-
class
mcvirt.logger.
Logger
[source]¶ Bases:
mcvirt.rpc.pyro_object.PyroObject
-
LOGS
= []¶
-
mcvirt.mcvirt-drbd module¶
mcvirt.mcvirt_config module¶
-
class
mcvirt.mcvirt_config.
MCVirtConfig
[source]¶ Bases:
mcvirt.config_file.ConfigFile
Provides operations to obtain and set the MCVirt configuration for a VM
mcvirt.parser module¶
Provides argument parser.
-
class
mcvirt.parser.
Parser
(verbose=True)[source]¶ Bases:
object
Provides an argument parser for MCVirt.
-
class
mcvirt.parser.
ThrowingArgumentParser
(prog=None, usage=None, description=None, epilog=None, version=None, parents=[], formatter_class=<class 'argparse.HelpFormatter'>, prefix_chars='-', fromfile_prefix_chars=None, argument_default=None, conflict_handler='error', add_help=True)[source]¶ Bases:
argparse.ArgumentParser
Override the ArgumentParser class, in order to change the handling of errors.