Module instance
source code
Logical units dealing with instances.
|
|
|
_CheckOpportunisticLocking(op)
Generate error if opportunistic locking is not possible. |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
list
|
|
|
|
|
|
|
|
|
|
Imports:
OpenSSL,
copy,
logging,
os,
compat,
constants,
errors,
ht,
hypervisor,
locking,
iallocator,
masterd,
netutils,
objects,
opcodes,
pathutils,
rpc,
utils,
NoHooksLU,
LogicalUnit,
ResultWithJobs,
INSTANCE_DOWN,
INSTANCE_NOT_RUNNING,
CAN_CHANGE_INSTANCE_OFFLINE,
CheckNodeOnline,
ShareAll,
GetDefaultIAllocator,
CheckInstanceNodeGroups,
LoadNodeEvacResult,
CheckIAllocatorOrNode,
CheckParamsNotGlobal,
IsExclusiveStorageEnabledNode,
CheckHVParams,
CheckOSParams,
AnnotateDiskParams,
GetUpdatedParams,
ExpandInstanceUuidAndName,
ComputeIPolicySpecViolation,
CheckInstanceState,
ExpandNodeUuidAndName,
CheckDiskTemplateEnabled,
CreateDisks,
CheckNodesFreeDiskPerVG,
WipeDisks,
WipeOrCleanupDisks,
WaitForSync,
IsExclusiveStorageEnabledNodeUuid,
CreateSingleBlockDev,
ComputeDisks,
CheckRADOSFreeSpace,
ComputeDiskSizePerVG,
GenerateDiskTemplate,
StartInstanceDisks,
ShutdownInstanceDisks,
AssembleInstanceDisks,
CheckSpindlesExclusiveStorage,
BuildInstanceHookEnvByObject,
GetClusterDomainSecret,
BuildInstanceHookEnv,
NICListToTuple,
NICToTuple,
CheckNodeNotDrained,
RemoveInstance,
CopyLockList,
ReleaseLocks,
CheckNodeVmCapable,
CheckTargetNodeIPolicy,
GetInstanceInfoText,
RemoveDisks,
CheckNodeFreeMemory,
CheckInstanceBridgesExist,
CheckNicsBridgesExist,
CheckNodeHasOS,
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)
|
Check whether an OS name conforms to the os variants
specification.
- Parameters:
os_obj (objects.OS) - OS object to check
name (string) - OS name passed by the user, to check for validity
|
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)
| 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
|
Updates the iv_name attribute of disks.
- 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,])))
|
|