class LUInstanceCreate(LogicalUnit):
Create an instance.
Method |
|
Build hooks env. |
Method |
|
Build hooks nodes. |
Method |
|
Check arguments. |
Method |
|
Check prerequisites. |
Method |
|
Declare LU locking needs for a level |
Method |
|
Create and add the instance to the cluster. |
Method |
|
ExpandNames for CreateInstance. |
Method |
|
Returns the OS scripts environment for the helper VM |
Method |
|
Prepare the LU to run again. |
Method |
|
Run OS scripts |
Method |
|
Runs the OS scripts inside a safe virtualized environment. |
Method |
|
Updates the OS parameter 'os-install-package' for an instance. |
Constant | HPATH |
Undocumented |
Constant | REQ |
Undocumented |
Instance Variable | adopt |
Undocumented |
Instance Variable | be |
Undocumented |
Instance Variable | check |
Undocumented |
Instance Variable | disks |
Undocumented |
Instance Variable | dry |
Undocumented |
Instance Variable | hostname |
Undocumented |
Instance Variable | hv |
Undocumented |
Instance Variable | instance |
Undocumented |
Instance Variable | needed |
Undocumented |
Instance Variable | nics |
Undocumented |
Instance Variable | os |
Undocumented |
Instance Variable | pnode |
Undocumented |
Instance Variable | secondaries |
Undocumented |
Instance Variable | src |
Undocumented |
Method | _ |
Checks validity of disk-related arguments. |
Method | _ |
Checks validity of disk template. |
Method | _ |
Check validity of VLANs if given |
Method | _ |
Set nodes as in the forthcoming instance |
Method | _ |
Reads the export information from disk. |
Method | _ |
Use export parameters as defaults. |
Method | _ |
Removes degraded disks and instance. |
Method | _ |
Revert the instance parameters to the default values. |
Method | _ |
Run the allocator based on input opcode. |
Instance Variable | _old |
Undocumented |
Inherited from LogicalUnit
:
Method | __init__ |
Constructor for LogicalUnit. |
Method |
|
Raise AssertionError if the LU holds some locks of the given level. |
Method |
|
Notify the LU about the results of its hooks. |
Method | owned |
Return the list of locks owned by the LU at a given level. |
Method |
|
Extend list of nodes to run the post LU hook. |
Method | release |
Return a request to release the specified locks of the given level. |
Method |
|
Undocumented |
Constant | HTYPE |
Undocumented |
Instance Variable | add |
Undocumented |
Instance Variable | cfg |
Undocumented |
Instance Variable | dont |
Undocumented |
Instance Variable |
|
Undocumented |
Instance Variable |
|
Undocumented |
Instance Variable |
|
Undocumented |
Instance Variable |
|
Undocumented |
Instance Variable | op |
Undocumented |
Instance Variable | opportunistic |
Undocumented |
Instance Variable | opportunistic |
Undocumented |
Instance Variable | proc |
Undocumented |
Instance Variable | recalculate |
Undocumented |
Instance Variable | rpc |
Undocumented |
Instance Variable | share |
Undocumented |
Instance Variable | tasklets |
Undocumented |
Instance Variable | wconfd |
Undocumented |
Instance Variable | wconfdcontext |
Undocumented |
Instance Variable | wconfdlocks |
Undocumented |
Method | _ |
Helper function to expand and lock an instance. |
Method | _ |
Helper function to declare instances' nodes for locking. |
Declare LU locking needs for a level
While most LUs can just declare their locking needs at ExpandNames time, sometimes there's the need to calculate some locks after having acquired the ones before. This function is called just before acquiring locks at a particular level, but after acquiring the ones at lower levels, and permits such calculations. It can be used to modify self.needed_locks, and by default it does nothing.
This function is only called if you have something already set in self.needed_locks for the level.
Parameters | |
level:member of ganeti.locking.LEVELS | Locking level which is going to be locked |
Returns the OS scripts environment for the helper VM
Parameters | |
instance:objects.Instance | instance for which the OS scripts are run |
script:string | script to run (e.g., constants.OS_SCRIPT_CREATE_UNTRUSTED) |
Returns | |
dict of string to string | OS scripts environment for the helper VM |
Prepare the LU to run again.
This method is called if the Exec failed for temporarily lacking resources. It is expected to change the state of the LU so that it can be tried again, and also change its locking policy to acquire more resources to have a better chance of suceeding in the retry.
Run OS scripts
If necessary, disks are paused. It handles instance create, import, and remote import.
Parameters | |
feedback | function used send feedback back to the caller |
iobj:objects.Instance | instance object |
Runs the OS scripts inside a safe virtualized environment.
The virtualized environment reuses the instance and temporarily creates a disk onto which the image of the helper VM is dumped. The temporary disk is used to boot the helper VM. The OS scripts are passed to the helper VM through the metadata daemon and the OS install package.
Parameters | |
feedback | function used send feedback back to the caller |
instance:objects.Instance | instance for which the OS scripts must be run inside the virtualized environment |
Updates the OS parameter 'os-install-package' for an instance.
The OS install package is an archive containing an OS definition and a file containing the environment variables needed to run the OS scripts.
The OS install package is served by the metadata daemon to the instances, so the OS scripts can run inside the virtualized environment.
Parameters | |
feedback | function used send feedback back to the caller |
instance:objects.Instance | instance for which the OS parameter 'os-install-package' is updated |
override | if supplied, it overrides the environment of the export OS scripts archive |
Reads the export information from disk.
It will override the opcode source node and path with the actual information, if these two were not specified before.
Returns | |
the export information |
Use export parameters as defaults.
In case the opcode doesn't specify (as in override) some instance parameters, then try to use them from the export information, if that declares them.
Removes degraded disks and instance.
It optionally checks whether disks are degraded. If the disks are degraded, they are removed and the instance is also removed from the configuration.
If disk_abort
is True, then the disks are considered degraded and removed, and the instance is removed from the configuration.
If disk_abort
is False, then it first checks whether disks are degraded and, if so, it removes the disks and the instance is removed from the configuration.
Parameters | |
feedback | function used send feedback back to the caller |
disk | True if disks are degraded, False to first check if disks are degraded |
instance:objects.Instance | instance containing the disks to check |
Returns | |
NoneType | None |
Raises | |
errors.OpPrereqError | if disks are degraded |