Management class for VM-related functions (spawn, reboot, etc).
Bases: object
This class wraps all the functionality needed to implement basic Diffie-Hellman-Merkle key exchange in Python. It features intelligent defaults for the prime and base numbers needed for the calculation, while allowing you to supply your own. It requires that the openssl binary be installed on the system on which this is run, as it uses that to handle the encryption and decryption. If openssl is not available, a RuntimeError will be raised.
Efficient implementation of (num ** exp) % mod
Bases: object
Management class for VM-related tasks
Takes a key/value pair and adds it to the xenstore parameter record for the given vm instance. If the key exists in xenstore, it is overwritten
Adds the passed key/value pair to the xenstore record for the given VM at the specified location. A XenAPIPlugin.PluginError will be raised if any error is encountered in the write process.
Update agent on the VM instance.
Removes all data from the xenstore parameter record for this VM.
Deletes the VM’s xenstore record for the specified path. If there is no such record, the request is ignored.
Creates vifs for an instance.
Destroy VM instance.
This is the method exposed by xenapi_conn.destroy(). The rest of the destroy_* methods are internal.
Get the version of the agent running on the VM instance.
Return bandwidth usage info for each interface on each running VM
Return snapshot of console.
Return data about VM diagnostics.
Return data about VM instance.
Return connection info for a vnc console.
Write a file to the VM instance.
The path to which it is to be written and the contents of the file need to be supplied; both will be base64-encoded to prevent errors with non-ASCII characters being transmitted. If the agent does not support file injection, or the user has disabled it, a NotImplementedError will be raised.
Inject the hostname of the instance into the xenstore.
Generate the network info and make calls to place it into the xenstore and the xenstore param list. vm_ref can be passed in because it will sometimes be different than what VMHelper.lookup(session, instance.name) will find (ex: rescue)
Runs the xenstore-ls command to get a listing of all records from ‘path’ downward. Returns a dict with the sub-paths as keys, and the value stored in those paths as values. If nothing is found at that path, returns None.
List VM instances.
List VM instances, returning InstanceInfo objects.
Copies a VHD from one host machine to another, possibly resizing filesystem before hand.
Parameters: |
|
---|
Pause VM instance.
Set up VIF networking on the host.
Look for expirable rebooting instances.
Look for expirable rescued instances.
Poll for unconfirmed resizes.
Look for any unconfirmed resizes that are older than resize_confirm_window and automatically confirm them.
Power off the specified instance.
Power on the specified instance.
Returns the xenstore parameter record data for the specified VM instance as a dict. Accepts an optional key or list of keys; if a value for ‘keys’ is passed, the returned dict is filtered to only return the values for those keys.
Returns the value stored in the xenstore record for the given VM at the specified location. A XenAPIPlugin.PluginError will be raised if any error is encountered in the read process.
Returns a dict of all the keys in the xenstore parameter record for the given instance that begin with the key_prefix.
Reboot VM instance.
recreates security group rules for every instance
recreates security group rules for every instance
Takes either a single key or a list of keys and removes them from the xenstore parameter record data for the given VM. If the key doesn’t exist, the request is ignored.
Takes either a single key or a list of keys and removes them from the xenstoreirecord data for the given VM. If the key doesn’t exist, the request is ignored.
Rescue the specified instance.
Creates uuid arg to pass to make_agent_call and calls it.
Resume the specified instance.
Set the root/admin password on the VM instance.
This is done via an agent running on the VM. Communication between nova and the agent is done via writing xenstore records. Since communication is done over the XenAPI RPC calls, we need to encrypt the password. We’re using a simple Diffie-Hellman class instead of the more advanced one in M2Crypto for compatibility with the agent code.
Create snapshot from a running VM instance.
Parameters: |
|
---|
Steps involved in a XenServer snapshot:
Spawn a rescue instance.
Suspend the specified instance.
Removes filters for each VIF of the specified instance.
Unpause VM instance.
Unrescue the specified instance.
Takes a dict and writes each key/value pair to the xenstore parameter record for the given vm instance. Any existing data for those keys is overwritten.
Writes the passed value to the xenstore record for the given VM at the specified location. A XenAPIPlugin.PluginError will be raised if any error is encountered in the write process.
Compare two version strings (eg 0.0.1.10 > 0.0.1.9)
Factory to create a decorator that records instance progress as a series of discrete steps.
Each time the decorator is invoked we bump the total-step-count, so after:
@step
def step1():
...
@step
def step2():
...
we have a total-step-count of 2.
Each time the step-function (not the step-decorator!) is invoked, we bump the current-step-count by 1, so after:
step1()
the current-step-count would be 1 giving a progress of 1 / 2 * 100 or 50%.