class documentation

class GanetiRapiClient(object):

View In Hierarchy

Ganeti RAPI client.

Method __init__ Initializes this class.
Method ActivateInstanceDisks Activates an instance's disks.
Method AddClusterTags Adds tags to the cluster.
Method AddFilter Adds a filter rule
Method AddGroupTags Adds tags to a node group.
Method AddInstanceTags Adds tags to an instance.
Method AddNetworkTags Adds tags to a network.
Method AddNodeTags Adds tags to a node.
Method AssignGroupNodes Assigns nodes to a group.
Method CancelJob Cancels a job.
Method ConnectNetwork Connects a Network to a NodeGroup with the given netparams
Method CreateGroup Creates a new node group.
Method CreateInstance Creates a new instance.
Method CreateNetwork Creates a new network.
Method DeactivateInstanceDisks Deactivates an instance's disks.
Method DeleteClusterTags Deletes tags from the cluster.
Method DeleteFilter Deletes a filter rule
Method DeleteGroup Deletes a node group.
Method DeleteGroupTags Deletes tags from a node group.
Method DeleteInstance Deletes an instance.
Method DeleteInstanceTags Deletes tags from an instance.
Method DeleteNetwork Deletes a network.
Method DeleteNetworkTags Deletes tags from a network.
Method DeleteNodeTags Delete tags from a node.
Method DisconnectNetwork Connects a Network to a NodeGroup with the given netparams
Method EvacuateNode Evacuates instances from a Ganeti node.
Method ExportInstance Exports an instance.
Method FailoverInstance Does a failover of an instance.
Method GetClusterTags Gets the cluster tags.
Method GetFeatures Gets the list of optional features supported by RAPI server.
Method GetFilter Gets information about a filter rule.
Method GetFilters Gets all filter rules in the cluster.
Method GetGroup Gets information about a node group.
Method GetGroups Gets all node groups in the cluster.
Method GetGroupTags Gets tags for a node group.
Method GetInfo Gets info about the cluster.
Method GetInstance Gets information about an instance.
Method GetInstanceConsole Request information for connecting to instance's console.
Method GetInstanceInfo Gets information about an instance.
Method GetInstances Gets information about instances on the cluster.
Method GetInstanceTags Gets tags for an instance.
Method GetJobs Gets all jobs for the cluster.
Method GetJobStatus Gets the status of a job.
Method GetNetwork Gets information about a network.
Method GetNetworks Gets all networks in the cluster.
Method GetNetworkTags Gets tags for a network.
Method GetNode Gets information about a node.
Method GetNodeRole Gets the current role for a node.
Method GetNodes Gets all nodes in the cluster.
Method GetNodeStorageUnits Gets the storage units for a node.
Method GetNodeTags Gets the tags for a node.
Method GetOperatingSystems Gets the Operating Systems running in the Ganeti cluster.
Method GetVersion Gets the Remote API version running on the cluster.
Method GrowInstanceDisk Grows a disk of an instance.
Method InstanceAllocation Generates an instance allocation as used by multiallocate.
Method InstancesMultiAlloc Tries to allocate multiple instances.
Method MigrateInstance Migrates an instance.
Method MigrateNode Migrates all primary instances from a node.
Method ModifyCluster Modifies cluster parameters.
Method ModifyGroup Modifies a node group.
Method ModifyInstance Modifies an instance.
Method ModifyNetwork Modifies a network.
Method ModifyNode Modifies a node.
Method ModifyNodeStorageUnits Modifies parameters of storage units on the node.
Method PowercycleNode Powercycles a node.
Method PrepareExport Prepares an instance for an export.
Method Query Retrieves information about resources.
Method QueryFields Retrieves available fields for a resource.
Method RebootInstance Reboots an instance.
Method RecreateInstanceDisks Recreate an instance's disks.
Method RedistributeConfig Tells the cluster to redistribute its configuration files.
Method ReinstallInstance Reinstalls an instance.
Method RenameGroup Changes the name of a node group.
Method RenameInstance Changes the name of an instance.
Method RenameNetwork Changes the name of a network.
Method RepairNodeStorageUnits Repairs a storage unit on the node.
Method ReplaceFilter Replaces a filter rule, or creates one if it doesn't already exist
Method ReplaceInstanceDisks Replaces disks on an instance.
Method SetNodeRole Sets the role for a node.
Method ShutdownInstance Shuts down an instance.
Method StartupInstance Starts up an instance.
Method WaitForJobChange Waits for job changes.
Method WaitForJobCompletion Polls cluster for job status until completion.
Constant USER_AGENT Undocumented
Static Method _EncodeQuery Encode query values for RAPI URL.
Static Method _UpdateWithKwargs Updates the base with params from kwargs.
Method _CreateCurl Creates a cURL object.
Method _SendRequest Sends an HTTP request.
Class Variable _json_encoder Undocumented
Instance Variable _base_url Undocumented
Instance Variable _curl_config_fn Undocumented
Instance Variable _curl_factory Undocumented
Instance Variable _logger Undocumented
Instance Variable _password Undocumented
Instance Variable _username Undocumented
def __init__(self, host, port=GANETI_RAPI_PORT, username=None, password=None, logger=logging, curl_config_fn=None, curl_factory=None):

Initializes this class.

Parameters
host:stringthe ganeti cluster master to interact with
port:intthe port on which the RAPI is running (default is 5080)
username:stringthe username to connect with
password:stringthe password to connect with
loggerLogging object
curl_config_fn:callableFunction to configure pycurl.Curl object
curl_factoryUndocumented
def ActivateInstanceDisks(self, instance, ignore_size=None, reason=None):

Activates an instance's disks.

Parameters
instance:stringInstance name
ignore_size:boolWhether to ignore recorded size
reason:stringthe reason for executing this operation
Returns
stringjob id
def AddClusterTags(self, tags, dry_run=False, reason=None):

Adds tags to the cluster.

Parameters
tags:list of strtags to add to the cluster
dry_run:boolwhether to perform a dry run
reason:stringthe reason for executing this operation
Returns
stringjob id
def AddFilter(self, priority, predicates, action, reason_trail=None):

Adds a filter rule

Parameters
priorityUndocumented
predicatesUndocumented
actionUndocumented
reason_trail:list of (str, str, int) triplesthe reason trail for executing this operation, or None
Returns
stringfilter UUID of the added filter
def AddGroupTags(self, group, tags, dry_run=False, reason=None):

Adds tags to a node group.

Parameters
group:strgroup to add tags to
tags:list of stringtags to add to the group
dry_run:boolwhether to perform a dry run
reason:stringthe reason for executing this operation
Returns
stringjob id
def AddInstanceTags(self, instance, tags, dry_run=False, reason=None):

Adds tags to an instance.

Parameters
instance:strinstance to add tags to
tags:list of strtags to add to the instance
dry_run:boolwhether to perform a dry run
reason:stringthe reason for executing this operation
Returns
stringjob id
def AddNetworkTags(self, network, tags, dry_run=False, reason=None):

Adds tags to a network.

Parameters
network:strnetwork to add tags to
tags:list of stringtags to add to the network
dry_run:boolwhether to perform a dry run
reason:stringthe reason for executing this operation
Returns
stringjob id
def AddNodeTags(self, node, tags, dry_run=False, reason=None):

Adds tags to a node.

Parameters
node:strnode to add tags to
tags:list of strtags to add to the node
dry_run:boolwhether to perform a dry run
reason:stringthe reason for executing this operation
Returns
stringjob id
def AssignGroupNodes(self, group, nodes, force=False, dry_run=False, reason=None):

Assigns nodes to a group.

Parameters
group:stringNode group name
nodes:list of stringsList of nodes to assign to the group
forceUndocumented
dry_runUndocumented
reason:stringthe reason for executing this operation
Returns
stringjob id
def CancelJob(self, job_id, dry_run=False):

Cancels a job.

Parameters
job_id:stringid of the job to delete
dry_run:boolwhether to perform a dry run
Returns
tupletuple containing the result, and a message (bool, string)
def ConnectNetwork(self, network_name, group_name, mode, link, vlan='', dry_run=False, reason=None):

Connects a Network to a NodeGroup with the given netparams

def CreateGroup(self, name, alloc_policy=None, dry_run=False, reason=None):

Creates a new node group.

Parameters
name:strthe name of node group to create
alloc_policy:strthe desired allocation policy for the group, if any
dry_run:boolwhether to peform a dry run
reason:stringthe reason for executing this operation
Returns
stringjob id
def CreateInstance(self, mode, name, disk_template, disks, nics, reason=None, **kwargs):

Creates a new instance.

More details for parameters can be found in the RAPI documentation.

Parameters
mode:stringInstance creation mode
name:stringHostname of the instance to create
disk_template:stringDisk template for instance (e.g. plain, diskless, file, or drbd)
disks:list of dictsList of disk definitions
nics:list of dictsList of NIC definitions
reason:stringthe reason for executing this operation
**kwargsUndocumented
dry_run:boolwhether to perform a dry run
Returns
stringjob id
def CreateNetwork(self, network_name, network, gateway=None, network6=None, gateway6=None, mac_prefix=None, add_reserved_ips=None, tags=None, dry_run=False, reason=None):

Creates a new network.

Parameters
network_name:strthe name of network to create
networkUndocumented
gatewayUndocumented
network6Undocumented
gateway6Undocumented
mac_prefixUndocumented
add_reserved_ipsUndocumented
tagsUndocumented
dry_run:boolwhether to peform a dry run
reason:stringthe reason for executing this operation
Returns
stringjob id
def DeactivateInstanceDisks(self, instance, reason=None, force=False):

Deactivates an instance's disks.

Parameters
instance:stringInstance name
reason:stringthe reason for executing this operation
forceUndocumented
Returns
stringjob id
def DeleteClusterTags(self, tags, dry_run=False, reason=None):

Deletes tags from the cluster.

Parameters
tags:list of strtags to delete
dry_run:boolwhether to perform a dry run
reason:stringthe reason for executing this operation
Returns
stringjob id
def DeleteFilter(self, uuid):

Deletes a filter rule

Returns
None
def DeleteGroup(self, group, dry_run=False, reason=None):

Deletes a node group.

Parameters
group:strthe node group to delete
dry_run:boolwhether to peform a dry run
reason:stringthe reason for executing this operation
Returns
stringjob id
def DeleteGroupTags(self, group, tags, dry_run=False, reason=None):

Deletes tags from a node group.

Parameters
group:strgroup to delete tags from
tags:list of stringtags to delete
dry_run:boolwhether to perform a dry run
reason:stringthe reason for executing this operation
Returns
stringjob id
def DeleteInstance(self, instance, dry_run=False, reason=None, **kwargs):

Deletes an instance.

Parameters
instance:strthe instance to delete
dry_runUndocumented
reason:stringthe reason for executing this operation
**kwargsUndocumented
Returns
stringjob id
def DeleteInstanceTags(self, instance, tags, dry_run=False, reason=None):

Deletes tags from an instance.

Parameters
instance:strinstance to delete tags from
tags:list of strtags to delete
dry_run:boolwhether to perform a dry run
reason:stringthe reason for executing this operation
Returns
stringjob id
def DeleteNetwork(self, network, dry_run=False, reason=None):

Deletes a network.

Parameters
network:strthe network to delete
dry_run:boolwhether to peform a dry run
reason:stringthe reason for executing this operation
Returns
stringjob id
def DeleteNetworkTags(self, network, tags, dry_run=False, reason=None):

Deletes tags from a network.

Parameters
network:strnetwork to delete tags from
tags:list of stringtags to delete
dry_run:boolwhether to perform a dry run
reason:stringthe reason for executing this operation
Returns
stringjob id
def DeleteNodeTags(self, node, tags, dry_run=False, reason=None):

Delete tags from a node.

Parameters
node:strnode to remove tags from
tags:list of strtags to remove from the node
dry_run:boolwhether to perform a dry run
reason:stringthe reason for executing this operation
Returns
stringjob id
def DisconnectNetwork(self, network_name, group_name, dry_run=False, reason=None):

Connects a Network to a NodeGroup with the given netparams

def EvacuateNode(self, node, iallocator=None, remote_node=None, dry_run=False, early_release=None, mode=None, accept_old=False, reason=None):

Evacuates instances from a Ganeti node.

Parameters
node:strnode to evacuate
iallocator:str or Noneinstance allocator to use
remote_node:strnode to evaucate to
dry_run:boolwhether to perform a dry run
early_release:boolwhether to enable parallelization
mode:stringNode evacuation mode
accept_old:boolWhether caller is ready to accept old-style (pre-2.5) results
reason:stringthe reason for executing this operation
Returns
string, or a list for pre-2.5 resultsJob ID or, if accept_old is set and server is pre-2.5, list of (job ID, instance name, new secondary node); if dry_run was specified, then the actual move jobs were not submitted and the job IDs will be None
Raises
GanetiApiErrorif an iallocator and remote_node are both specified
def ExportInstance(self, instance, mode, destination, shutdown=None, remove_instance=None, x509_key_name=None, destination_x509_ca=None, compress=None, reason=None):

Exports an instance.

Parameters
instance:stringInstance name
mode:stringExport mode
destinationUndocumented
shutdownUndocumented
remove_instanceUndocumented
x509_key_nameUndocumented
destination_x509_caUndocumented
compressUndocumented
reason:stringthe reason for executing this operation
Returns
stringJob ID
def FailoverInstance(self, instance, iallocator=None, ignore_consistency=None, target_node=None, reason=None):

Does a failover of an instance.

Parameters
instance:stringInstance name
iallocator:stringIallocator for deciding the target node for shared-storage instances
ignore_consistency:boolWhether to ignore disk consistency
target_node:stringTarget node for shared-storage instances
reason:stringthe reason for executing this operation
Returns
stringjob id
def GetClusterTags(self, reason=None):

Gets the cluster tags.

Parameters
reason:stringthe reason for executing this operation
Returns
list of strcluster tags
def GetFeatures(self):

Gets the list of optional features supported by RAPI server.

Returns
listList of optional features
def GetFilter(self, filter_uuid):

Gets information about a filter rule.

Parameters
filter_uuid:strUUID of the filter whose info to return
Returns
dictinfo about the filter
def GetFilters(self, bulk=False):

Gets all filter rules in the cluster.

Parameters
bulk:boolwhether to return all information about the networks
Returns
list of dict or strif bulk is true, a list of dictionaries with info about all filter rules in the cluster, else a list of UUIDs of those filters
def GetGroup(self, group, reason=None):

Gets information about a node group.

Parameters
group:strname of the node group whose info to return
reason:stringthe reason for executing this operation
Returns
dictinfo about the node group
def GetGroups(self, bulk=False, reason=None):

Gets all node groups in the cluster.

Parameters
bulk:boolwhether to return all information about the groups
reason:stringthe reason for executing this operation
Returns
list of dict or strif bulk is true, a list of dictionaries with info about all node groups in the cluster, else a list of names of those node groups
def GetGroupTags(self, group, reason=None):

Gets tags for a node group.

Parameters
group:stringNode group whose tags to return
reason:stringthe reason for executing this operation
Returns
list of stringstags for the group
def GetInfo(self, reason=None):

Gets info about the cluster.

Parameters
reason:stringthe reason for executing this operation
Returns
dictinformation about the cluster
def GetInstance(self, instance, reason=None):

Gets information about an instance.

Parameters
instance:strinstance whose info to return
reason:stringthe reason for executing this operation
Returns
dictinfo about the instance
def GetInstanceConsole(self, instance, reason=None):

Request information for connecting to instance's console.

Parameters
instance:stringInstance name
reason:stringthe reason for executing this operation
Returns
dictdictionary containing information about instance's console
def GetInstanceInfo(self, instance, static=None, reason=None):

Gets information about an instance.

Parameters
instance:stringInstance name
staticUndocumented
reason:stringthe reason for executing this operation
Returns
stringJob ID
def GetInstances(self, bulk=False, reason=None):

Gets information about instances on the cluster.

Parameters
bulk:boolwhether to return all information about all instances
reason:stringthe reason for executing this operation
Returns
list of dict or list of strif bulk is True, info about the instances, else a list of instances
def GetInstanceTags(self, instance, reason=None):

Gets tags for an instance.

Parameters
instance:strinstance whose tags to return
reason:stringthe reason for executing this operation
Returns
list of strtags for the instance
def GetJobs(self, bulk=False):

Gets all jobs for the cluster.

Parameters
bulk:boolWhether to return detailed information about jobs.
Returns
list of intList of job ids for the cluster or list of dicts with detailed information about the jobs if bulk parameter was true.
def GetJobStatus(self, job_id):

Gets the status of a job.

Parameters
job_id:stringjob id whose status to query
Returns
dictjob status
def GetNetwork(self, network, reason=None):

Gets information about a network.

Parameters
network:strname of the network whose info to return
reason:stringthe reason for executing this operation
Returns
dictinfo about the network
def GetNetworks(self, bulk=False, reason=None):

Gets all networks in the cluster.

Parameters
bulk:boolwhether to return all information about the networks
reasonUndocumented
Returns
list of dict or strif bulk is true, a list of dictionaries with info about all networks in the cluster, else a list of names of those networks
def GetNetworkTags(self, network, reason=None):

Gets tags for a network.

Parameters
network:stringNode group whose tags to return
reason:stringthe reason for executing this operation
Returns
list of stringstags for the network
def GetNode(self, node, reason=None):

Gets information about a node.

Parameters
node:strnode whose info to return
reason:stringthe reason for executing this operation
Returns
dictinfo about the node
def GetNodeRole(self, node, reason=None):

Gets the current role for a node.

Parameters
node:strnode whose role to return
reason:stringthe reason for executing this operation
Returns
strthe current role for a node
def GetNodes(self, bulk=False, reason=None):

Gets all nodes in the cluster.

Parameters
bulk:boolwhether to return all information about all instances
reason:stringthe reason for executing this operation
Returns
list of dict or strif bulk is true, info about nodes in the cluster, else list of nodes in the cluster
def GetNodeStorageUnits(self, node, storage_type, output_fields, reason=None):

Gets the storage units for a node.

Parameters
node:strthe node whose storage units to return
storage_type:strstorage type whose units to return
output_fields:strstorage type fields to return
reason:stringthe reason for executing this operation
Returns
stringjob id where results can be retrieved
def GetNodeTags(self, node, reason=None):

Gets the tags for a node.

Parameters
node:strnode whose tags to return
reason:stringthe reason for executing this operation
Returns
list of strtags for the node
def GetOperatingSystems(self, reason=None):

Gets the Operating Systems running in the Ganeti cluster.

Parameters
reason:stringthe reason for executing this operation
Returns
list of stroperating systems
def GetVersion(self):

Gets the Remote API version running on the cluster.

Returns
intGaneti Remote API version
def GrowInstanceDisk(self, instance, disk, amount, wait_for_sync=None, reason=None):

Grows a disk of an instance.

More details for parameters can be found in the RAPI documentation.

Parameters
instance:stringInstance name
disk:integerDisk index
amount:integerGrow disk by this amount (MiB)
wait_for_sync:boolWait for disk to synchronize
reason:stringthe reason for executing this operation
Returns
stringjob id
def InstanceAllocation(self, mode, name, disk_template, disks, nics, **kwargs):

Generates an instance allocation as used by multiallocate.

More details for parameters can be found in the RAPI documentation. It is the same as used by CreateInstance.

Parameters
mode:stringInstance creation mode
name:stringHostname of the instance to create
disk_template:stringDisk template for instance (e.g. plain, diskless, file, or drbd)
disks:list of dictsList of disk definitions
nics:list of dictsList of NIC definitions
**kwargsUndocumented
Returns
A dict with the generated entry
def InstancesMultiAlloc(self, instances, reason=None, **kwargs):

Tries to allocate multiple instances.

More details for parameters can be found in the RAPI documentation.

Parameters
instancesA list of InstanceAllocation results
reasonUndocumented
**kwargsUndocumented
def MigrateInstance(self, instance, mode=None, cleanup=None, target_node=None, reason=None):

Migrates an instance.

Parameters
instance:stringInstance name
mode:stringMigration mode
cleanup:boolWhether to clean up a previously failed migration
target_node:stringTarget Node for externally mirrored instances
reason:stringthe reason for executing this operation
Returns
stringjob id
def MigrateNode(self, node, mode=None, dry_run=False, iallocator=None, target_node=None, reason=None):

Migrates all primary instances from a node.

Parameters
node:strnode to migrate
mode:stringif passed, it will overwrite the live migration type, otherwise the hypervisor default will be used
dry_run:boolwhether to perform a dry run
iallocator:stringinstance allocator to use
target_node:stringTarget node for shared-storage instances
reason:stringthe reason for executing this operation
Returns
stringjob id
def ModifyCluster(self, reason=None, **kwargs):

Modifies cluster parameters.

More details for parameters can be found in the RAPI documentation.

Parameters
reason:stringthe reason for executing this operation
**kwargsUndocumented
Returns
stringjob id
def ModifyGroup(self, group, reason=None, **kwargs):

Modifies a node group.

More details for parameters can be found in the RAPI documentation.

Parameters
group:stringNode group name
reason:stringthe reason for executing this operation
**kwargsUndocumented
Returns
stringjob id
def ModifyInstance(self, instance, reason=None, **kwargs):

Modifies an instance.

More details for parameters can be found in the RAPI documentation.

Parameters
instance:stringInstance name
reason:stringthe reason for executing this operation
**kwargsUndocumented
Returns
stringjob id
def ModifyNetwork(self, network, reason=None, **kwargs):

Modifies a network.

More details for parameters can be found in the RAPI documentation.

Parameters
network:stringNetwork name
reason:stringthe reason for executing this operation
**kwargsUndocumented
Returns
stringjob id
def ModifyNode(self, node, reason=None, **kwargs):

Modifies a node.

More details for parameters can be found in the RAPI documentation.

Parameters
node:stringNode name
reason:stringthe reason for executing this operation
**kwargsUndocumented
Returns
stringjob id
def ModifyNodeStorageUnits(self, node, storage_type, name, allocatable=None, reason=None):

Modifies parameters of storage units on the node.

Parameters
node:strnode whose storage units to modify
storage_type:strstorage type whose units to modify
name:strname of the storage unit
allocatable:bool or NoneWhether to set the "allocatable" flag on the storage unit (None=no modification, True=set, False=unset)
reason:stringthe reason for executing this operation
Returns
stringjob id
def PowercycleNode(self, node, force=False, reason=None):

Powercycles a node.

Parameters
node:stringNode name
force:boolWhether to force the operation
reason:stringthe reason for executing this operation
Returns
stringjob id
def PrepareExport(self, instance, mode, reason=None):

Prepares an instance for an export.

Parameters
instance:stringInstance name
mode:stringExport mode
reason:stringthe reason for executing this operation
Returns
stringJob ID
def Query(self, what, fields, qfilter=None, reason=None):

Retrieves information about resources.

Parameters
what:stringResource name, one of constants.QR_VIA_RAPI
fields:list of stringRequested fields
qfilter:None or listQuery filter
reason:stringthe reason for executing this operation
Returns
stringjob id
def QueryFields(self, what, fields=None, reason=None):

Retrieves available fields for a resource.

Parameters
what:stringResource name, one of constants.QR_VIA_RAPI
fields:list of stringRequested fields
reason:stringthe reason for executing this operation
Returns
stringjob id
def RebootInstance(self, instance, reboot_type=None, ignore_secondaries=None, dry_run=False, reason=None, **kwargs):

Reboots an instance.

Parameters
instance:strinstance to reboot
reboot_type:strone of: hard, soft, full
ignore_secondaries:boolif True, ignores errors for the secondary node while re-assembling disks (in hard-reboot mode only)
dry_run:boolwhether to perform a dry run
reason:stringthe reason for the reboot
**kwargsUndocumented
Returns
stringjob id
def RecreateInstanceDisks(self, instance, disks=None, nodes=None, reason=None, iallocator=None):

Recreate an instance's disks.

Parameters
instance:stringInstance name
disks:list of intList of disk indexes
nodes:list of stringNew instance nodes, if relocation is desired
reason:stringthe reason for executing this operation
iallocator:str or Noneinstance allocator plugin to use
Returns
stringjob id
def RedistributeConfig(self, reason=None):

Tells the cluster to redistribute its configuration files.

Parameters
reason:stringthe reason for executing this operation
Returns
stringjob id
def ReinstallInstance(self, instance, os=None, no_startup=False, osparams=None, reason=None):

Reinstalls an instance.

Parameters
instance:strThe instance to reinstall
os:str or NoneThe operating system to reinstall. If None, the instance's current operating system will be installed again
no_startup:boolWhether to start the instance automatically
osparamsUndocumented
reason:stringthe reason for executing this operation
Returns
stringjob id
def RenameGroup(self, group, new_name, reason=None):

Changes the name of a node group.

Parameters
group:stringNode group name
new_name:stringNew node group name
reason:stringthe reason for executing this operation
Returns
stringjob id
def RenameInstance(self, instance, new_name, ip_check=None, name_check=None, reason=None):

Changes the name of an instance.

Parameters
instance:stringInstance name
new_name:stringNew instance name
ip_check:boolWhether to ensure instance's IP address is inactive
name_check:boolWhether to ensure instance's name is resolvable
reason:stringthe reason for executing this operation
Returns
stringjob id
def RenameNetwork(self, network, new_name, reason=None):

Changes the name of a network.

Parameters
network:stringNetwork name
new_name:stringNew network name
reason:stringthe reason for executing this operation
Returns
stringjob id
def RepairNodeStorageUnits(self, node, storage_type, name, reason=None):

Repairs a storage unit on the node.

Parameters
node:strnode whose storage units to repair
storage_type:strstorage type to repair
name:strname of the storage unit to repair
reason:stringthe reason for executing this operation
Returns
stringjob id
def ReplaceFilter(self, uuid, priority, predicates, action, reason_trail=None):

Replaces a filter rule, or creates one if it doesn't already exist

Parameters
uuidUndocumented
priorityUndocumented
predicatesUndocumented
actionUndocumented
reason_trail:list of (str, str, int) triplesthe reason trail for executing this operation, or None
Returns
stringfilter UUID of the replaced/added filter
def ReplaceInstanceDisks(self, instance, disks=None, mode=REPLACE_DISK_AUTO, remote_node=None, iallocator=None, reason=None, early_release=None):

Replaces disks on an instance.

Parameters
instance:strinstance whose disks to replace
disks:list of intsIndexes of disks to replace
mode:strreplacement mode to use (defaults to replace_auto)
remote_node:str or Nonenew secondary node to use (for use with replace_new_secondary mode)
iallocator:str or Noneinstance allocator plugin to use (for use with replace_auto mode)
reason:stringthe reason for executing this operation
early_release:boolwhether to release locks as soon as possible
Returns
stringjob id
def SetNodeRole(self, node, role, force=False, auto_promote=None, reason=None):

Sets the role for a node.

Parameters
node:strthe node whose role to set
role:strthe role to set for the node
force:boolwhether to force the role change
auto_promote:boolWhether node(s) should be promoted to master candidate if necessary
reason:stringthe reason for executing this operation
Returns
stringjob id
def ShutdownInstance(self, instance, dry_run=False, no_remember=False, reason=None, **kwargs):

Shuts down an instance.

Parameters
instance:strthe instance to shut down
dry_run:boolwhether to perform a dry run
no_remember:boolif true, will not record the state change
reason:stringthe reason for the shutdown
**kwargsUndocumented
Returns
stringjob id
def StartupInstance(self, instance, dry_run=False, no_remember=False, reason=None):

Starts up an instance.

Parameters
instance:strthe instance to start up
dry_run:boolwhether to perform a dry run
no_remember:boolif true, will not record the state change
reason:stringthe reason for the startup
Returns
stringjob id
def WaitForJobChange(self, job_id, fields, prev_job_info, prev_log_serial):

Waits for job changes.

Parameters
job_id:stringJob ID for which to wait
fieldsUndocumented
prev_job_infoUndocumented
prev_log_serialUndocumented
Returns
dictNone if no changes have been detected and a dict with two keys, job_info and log_entries otherwise.
def WaitForJobCompletion(self, job_id, period=5, retries=-1):

Polls cluster for job status until completion.

Completion is defined as any of the following states listed in JOB_STATUS_FINALIZED.

Parameters
job_id:stringjob id to watch
period:inthow often to poll for status (optional, default 5s)
retries:inthow many time to poll before giving up (optional, default -1 means unlimited)
Returns
boolTrue if job succeeded or False if failed/status timeout
Unknown Field: deprecated
It is recommended to use WaitForJobChange wherever possible; WaitForJobChange returns immediately after a job changed and does not use polling
USER_AGENT: str =

Undocumented

Value
'Ganeti RAPI Client'
@staticmethod
def _EncodeQuery(query):

Encode query values for RAPI URL.

Parameters
query:list of two-tuplesQuery arguments
Returns
listQuery list with encoded values
@staticmethod
def _UpdateWithKwargs(base, **kwargs):

Updates the base with params from kwargs.

Parameters
baseThe base dict, filled with required fields
**kwargsUndocumented
Note
This is an inplace update of base
def _CreateCurl(self):

Creates a cURL object.

def _SendRequest(self, method, path, query, content):

Sends an HTTP request.

This constructs a full URL, encodes and decodes HTTP bodies, and handles invalid responses in a pythonic way.

Parameters
method:stringHTTP method to use
path:stringHTTP URL path
query:list of two-tuplesquery arguments to pass to urlencode
content:str or NoneHTTP body content
Returns
strJSON-Decoded response
Raises
CertificateErrorIf an invalid SSL certificate is found
GanetiApiErrorIf an invalid response is returned
_json_encoder =

Undocumented

_base_url =

Undocumented

_curl_config_fn =

Undocumented

_curl_factory =

Undocumented

_logger =

Undocumented

_password =

Undocumented

_username =

Undocumented