Module instance
source code
Logical units dealing with instances.
|
|
|
_CheckOpportunisticLocking(op)
Generate error if opportunistic locking is not possible. |
source code
|
|
|
|
|
|
|
|
|
|
|
|
string
|
|
list
|
|
|
|
|
|
|
_ApplyContainerMods(kind,
container,
chgdesc,
mods,
create_fn,
modify_fn,
remove_fn,
post_add_fn=None)
Applies descriptions in mods to container . |
source code
|
|
Imports:
OpenSSL,
copy,
logging,
os,
compat,
constants,
errors,
ht,
hypervisor,
locking,
iallocator,
masterd,
netutils,
objects,
pathutils,
serializer,
rpc,
utils,
retry,
NoHooksLU,
LogicalUnit,
ResultWithJobs,
INSTANCE_DOWN,
INSTANCE_NOT_RUNNING,
CheckNodeOnline,
ShareAll,
GetDefaultIAllocator,
CheckInstanceNodeGroups,
LoadNodeEvacResult,
CheckIAllocatorOrNode,
CheckParamsNotGlobal,
IsExclusiveStorageEnabledNode,
CheckHVParams,
CheckOSParams,
CheckOSImage,
AnnotateDiskParams,
GetUpdatedParams,
ExpandInstanceUuidAndName,
ComputeIPolicySpecViolation,
CheckInstanceState,
ExpandNodeUuidAndName,
CheckDiskTemplateEnabled,
IsValidDiskAccessModeCombination,
DetermineImageSize,
IsInstanceRunning,
CreateDisks,
CheckNodesFreeDiskPerVG,
WipeDisks,
WipeOrCleanupDisks,
ImageDisks,
WaitForSync,
IsExclusiveStorageEnabledNodeUuid,
CreateSingleBlockDev,
ComputeDisks,
CheckRADOSFreeSpace,
ComputeDiskSizePerVG,
GenerateDiskTemplate,
StartInstanceDisks,
ShutdownInstanceDisks,
AssembleInstanceDisks,
CheckSpindlesExclusiveStorage,
TemporaryDisk,
BuildInstanceHookEnvByObject,
GetClusterDomainSecret,
BuildInstanceHookEnv,
NICListToTuple,
NICToTuple,
CheckNodeNotDrained,
RemoveInstance,
CopyLockList,
ReleaseLocks,
CheckNodeVmCapable,
CheckTargetNodeIPolicy,
GetInstanceInfoText,
RemoveDisks,
CheckNodeFreeMemory,
CheckInstanceBridgesExist,
CheckNicsBridgesExist,
UpdateMetadata,
CheckCompressionTool,
CheckInstanceExistence,
ganeti
Ensures that a given hostname resolves to a 'sane' name.
The given name is required to be a prefix of the resolved hostname, to
prevent accidental mismatches.
- Parameters:
lu - the logical unit on behalf of which we're checking
name - the name we should resolve and check
- Returns:
- the resolved hostname object
|
_CreateInstanceAllocRequest(op,
disks,
nics,
beparams,
node_name_whitelist)
| source code
|
Wrapper around IAReqInstanceAlloc.
- Parameters:
op - The instance opcode
disks - The computed disks
nics - The computed nics
beparams - The full filled beparams
node_name_whitelist - List of nodes which should appear as online to the allocator
(unless the node is already marked offline)
- Returns:
- A filled iallocator.IAReqInstanceAlloc
|
Computes the full beparams.
- Parameters:
op - The instance opcode
cluster - The cluster config object
- Returns:
- The fully filled beparams
|
_ComputeNics(op,
cluster,
default_ip,
cfg,
ec_id)
| source code
|
Computes the nics.
- Parameters:
op - The instance opcode
cluster - Cluster configuration object
default_ip - The default ip to assign
cfg - An instance of the configuration object
ec_id - Execution context ID
- Returns:
- The build up nics
|
In case of conflicting IP address raise error.
- Parameters:
ip (string) - IP address
node_uuid (string) - node UUID
|
_ComputeIPolicyInstanceSpecViolation(ipolicy,
instance_spec,
disk_template,
_compute_fn=ComputeIPolicySpecViolation)
| source code
|
Compute if instance specs meets the specs of ipolicy.
- Parameters:
ipolicy (dict) - The ipolicy to verify against
instance_spec - dict
instance_spec - The instance spec to verify
disk_template (string) - the disk template of the instance
_compute_fn - The function to verify ipolicy (unittest only)
|
_ComputeInstanceCommunicationNIC(instance_name)
| source code
|
Compute the name of the instance NIC used by instance
communication.
With instance communication, a new NIC is added to the instance. This
NIC has a special name that identities it as being part of instance
communication, and not just a normal NIC. This function generates the
name of the NIC based on a prefix and the instance name
- Parameters:
instance_name (string) - name of the instance the NIC belongs to
- Returns: string
- name of the NIC
|
Prepares a list of container modifications by adding a private data
field.
- Parameters:
mods (list of tuples; (operation, index, parameters)) - List of modifications
private_fn (callable or None) - Callable for constructing a private data field for a modification
- Returns: list
|
_CheckNodesPhysicalCPUs(lu,
node_uuids,
requested,
hypervisor_specs)
| source code
|
Checks if nodes have enough physical CPUs
This function checks if all given nodes have the needed number of
physical CPUs. In case any node has less CPUs or we cannot get the
information from the node, this function raises an OpPrereqError
exception.
- Parameters:
lu (LogicalUnit ) - a logical unit from which we get configuration data
node_uuids (list ) - the list of node UUIDs to check
requested (int ) - the minimum acceptable number of physical CPUs
hypervisor_specs (list of pairs (string, dict of strings)) - list of hypervisor specifications in pairs (hypervisor_name,
hvparams)
- Raises:
|
GetItemFromContainer(identifier,
kind,
container)
| source code
|
Return the item refered by the identifier.
- Parameters:
identifier (string) - Item index or name or UUID
kind (string) - One-word item description
container (list) - Container to get the item from
|
_ApplyContainerMods(kind,
container,
chgdesc,
mods,
create_fn,
modify_fn,
remove_fn,
post_add_fn=None)
| source code
|
Applies descriptions in mods to
container .
- Parameters:
kind (string) - One-word item description
container (list) - Container to modify
chgdesc (None or list) - List of applied changes
mods (list) - Modifications as returned by _PrepareContainerMods
create_fn (callable) - Callback for creating a new item (constants.DDM_ADD); receives
absolute item index, parameters and private data object as added
by _PrepareContainerMods,
returns tuple containing new item and changes as list
modify_fn (callable) - Callback for modifying an existing item (constants.DDM_MODIFY);
receives absolute item index, item, parameters and private data
object as added by _PrepareContainerMods,
returns changes as list
remove_fn (callable) - Callback on removing item; receives absolute item index, item and
private data object as added by _PrepareContainerMods
post_add_fn (callable) - Callable for post-processing a newly created item after it has
been put into the container. It receives the index of the new
item and the new item as parameters.
|
_TApplyContModsCbChanges
Type description for changes as returned by _ApplyContainerMods's
callbacks
- Value:
ht.TMaybeListOf(ht.TAnd(ht.TIsLength(2), ht.TItems([ht.TNonEmptyString
, ht.TAny,])))
|
|