History | View | Annotate | Download (601.4 kB)
Fix type of 'node_whitelist' request parameter
If opportunistic_locking is used, then 'node_whitelist' parameter passedto the allocator is set to the LU's owned node locks. However, LU owned_lockshas type of 'set' while IReqInstanceAlloc expects type of...
Run pre-migrate hooks on primary node too
Signed-off-by: Constantinos Venetsanopoulos <cven@grnet.gr>Reviewed-by: Guido Trotter <ultrotter@google.com>
Verify that templates are compatible with exclusive storage
cluster-verify reports instances with disk templates not compatible withexclusive storage but that are running on nodes with the exclusive storageflag set.
Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>...
cluster-verify checks uniformity of PV sizes
When exclusive_storage is set, cluster-verify complains if the size of PVsis not uniform across a node group.
Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
add-node checks PVs
add-node now performs a few checks on LVM before adding a node to thecluster.
Moved checks within LUClusterVerifyGroup
Almost all instance-specific checks have been moved from the Exec method tothe _VerifyInstance method. This cleans up Exec, which was becoming too bigeven for pylint…
cluster-verify checks that PVs are not shared
When exclusive_storage is set, cluster-verify complains if PVs are sharedamong unrelated LVs.
cluster-verify checks uniformity of exclusive_storage flag
The value of the flag should be the same for nodes within the same group.
Add locking to _NetworkQuery
Make use of _GetNames() to get the final network UUIDs.Get networks info after having aquired the locks. Refactorthe code to use new local variables:
- "network_uuids" returned from _GetNames() - "all_networks" that are the latest network info...
Add "use_locking" parameter to network query opcode
This was extracted from a patch by Dimitris Aragiorgis with the subject“Add locking to _NetworkQuery”. The rest of the patch did no longerapply and will require more work.
Signed-off-by: Michael Hanselmann <hansmi@google.com>...
Fix LUInstanceRecreateDisks with iallocator
Recent iallocator changes (commit fb60bc6a, “iallocator: Add nodewhitelist”) broke the parameter validation for LUInstanceRecreateDisks(the other LUs were manually fixed already):
$ gnt-instance recreate-disks -I hail --dry-run instance3...
Add the gnt-storage client
Add a new client called 'gnt-storage'.The client interacts with the ExtStorage interface, similarly tothe way gnt-os interacts with the OS interface.
For now, only two commands are supported: 'info' and 'diagnose'.
'diagnose' calculates the node status of each provider on each node,...
Merge branch 'devel-2.6'
Merge branch 'stable-2.6' into devel-2.6
No conflicts, really trivial.
LUs raise an error if they cannot handle exclusive_storage
This happens when the exclusive_storage flag is set, and the requestedoperation is incompatible with the flag or not yet supported.
Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Refactor checks for a new template in LUInstanceSetParams
All the checks have been moved to a private method, so as to makeCheckPrereq() smaller and more readable (pylint was complaining about it).
Call node_info RPCs with the exclusive_storage flag
The flag is read from the configuration and passed to the RPC.
Add exclusive_storage parameter to node_info RPC
The flag is passed to the low-level functions that need it, but it's notyet used. Also, RPCs get just a default value for now.
Improve assertion message in LUClusterVerifyGroup
In issue 240 this assertion fails. While reproducing was not possiblewith the master branch, having a more verbose message can't hurt.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Call blockdev_create RPCs with the exclusive_storage flag
Add exclusive_storage parameter to blockdev_create RPC
The flag is passed to the low-level functions that need it, but it's notyet used.
Added class to contain information about a PV
This makes the code more readable and easier to upgrade.bdev.LogicalVolume.GetPVInfo and the code that depends on it have beenrefactored to use the new class.
utils.CheckVolumeGroupSize() has been moved to lib/utils/lvm.py, where more...
Improve network query algorithm
Similar to commit 572a277. Directly iterate over “self.wanted” insteadof iterating through all networks and checking if they're wanted.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Change network error text
This error is thrown if a network name already exists, not if thenetwork itself (e.g. “1.2.3.0/24”) is defined.
Format network field "group_list" in client
The field is now a list of tuples containing the group name, mode andlink.
Adjust LUInstanceSetParams wrt the `ext' template
Initial support for the `ext' template in gnt-instance modify.Take care of all needed checks in CheckArguments and CheckPrereqswrt ExtStorage Providers and ext-params.
ExtStorage disk addition and specification of arbitrary ext-params...
Multiple ExtStorage Providers and ext-params
Add support for passing parameters to the ext template (ext-params).Take advantage of disk-params, that don't seem to make much sense inthis template (ExtStorage Providers are not predefined and we don'tknow their needs) and use them to pass the ext-params dynamically to...
Implement the External Storage Interface
With this commit we introduce the External Storage Interfaceto Ganeti, abbreviated: ExtStorage Interface.
The ExtStorage Interface provides Ganeti with the ability to interactwith externally connected shared storage pools, visible by all...
More style updates for network-related code
Error message formatting, else/if merging to elif, docstrings.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Helga Velroyen <helgav@google.com>
cmdlib: Additional opportunistic locking check
If opportunistic locking is requested in the opcode, but no iallocatoris used (not specified or no default), an error will be raised.
One more offline+shutdown fix
Currently gnt-instance shutdown --force of an offline instanceresets the offline status. Which of course is bad and completelyunintended. Fix. (caught by the new qa tests)
Signed-off-by: Guido Trotter <ultrotter@google.com>...
Fix network LUs use of error code in OpPrereqError
Currently, most network LUs simply use EINVAL instead of correct errorcodes; this patch tries to adjust the obvious cases.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
_NetworkQuery: Simplify statistics computation
The code can loop directly over “self.wanted”, saving a lookup. Anexplicit loop is also replaced with a generator.
cmdlib: Factorize network conflict detection
LUNetworkConnect and LUNetworkDisconnect had very similar code to detectconflicts between instance's network interfaces and networks. This codefactorizes the common part and does some cleanup:
- Remove single-letter variable for lambda (“l”)...
cmdlib: Replace period with colon in error message
Replace frozenset with compat.UniqueFrozenset
This is not a trivial s/frozenset/compat.UniqueFrozenset/, but ratheronly replaces “frozenset” where appropriate. Most of the places are“static” information that doesn't change after the module has beenloaded....
Remove some unused Python code
This patch removes code which is no longer used due to refactoring:
- http.InitSsl, last usage removed in commit 33231500 (“Convert RPC client to PycURL”)- rapi.baserlib.MakeParamsDict, last usage remove in commit 4e5a68f8...
Allow shutting down offline instance
If an instance is offline we definitely shouldn't start it up.But shutting it down, should it be up by mistake is not "that" bad.Still, we only allow it with --force, as it still performs an action onan instance we shouldn't touch. This should make everybody happy....
Allow running instances to be put online
If an instance is running (eg. ERROR_up) and at the same time offline,there's no way to either shut it down or reonline it. This allowsonlining it. Offlining is still disabled for running instances.
Fixes and improvements to comments
Some fixes, added more information in a few points, removed a stale (5+year old) TODO comment.
Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Make LUNetworkAdd pass _VerifyLocks()
LEVEL_NODE_ALLOC should be aquired too if LEVEL_NODE is ALL_SET.
Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>Reviewed-by: Michael Hanselmann <hansmi@google.com>
_DeclareLocksForMigration: Fix non-DRBD locking issue
When non-DRBD disks are used for an instance,“lu.needed_locks[locking.LEVEL_NODE]” is set to “locking.ALL_SET” (whichis None). The assertion will then fail as None evaluates to False.
Reported by Constantinos Venetsanopoulos....
LUOobCommand: Always declare NAL in shared mode
Doing so avoids triggering an assertion in mcpu which cross-checks thenode lock and node allocation lock acquisition mode.
Fix two logging messages in TLReplaceDisks
Commit f0f8d060 (“Show old primary/secondary node on diskreplacement”) added two wrong uses of feedback_fn, which results inlog entries such like these:
"log": [ [ 7, [1351258326, 466214], "message", "Replacing disk(s) 0 for instance 'instance1.example.com'"...
Fix an small but quite nasty typo
Introduced in commit d4752785.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Very very very basic openvswitch support
This is a "better than nothing" support, just for kvm and just joiningthe machine to the opevswitch bridge with the right command.
Signed-off-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Iustin Pop <iustin@google.com>...
Pass check_ip and not hostname.ip to _ComputeNics
This should be done because in the case of --no-name-check thereis no 'hostname.ip' attribute, causing an execution error.'check_ip' is always set (in CheckArguments) even if --no-name-checkis passed in the command line....
Read watcher pause using RPC, not directly
The master daemon should not directly read files written by the nodedaemon. This patch adds a new RPC to read the watcher pause file andchanges the master code to use it.
Fix TypeError when unsetting OS parameters
When all OS parameters should be unset (“gnt-os modify -H -xen-pvmfoo”), a TypeError was raised. This fixes issue 311.
Add error code for temporary lack of resources
When an instance creation uses opportunistic locks, the iallocator mightnot be able to find an allocation solution if not enough node locks (ora suboptimal subset thereof) were acquired. As per the design document...
cmdlib: Use locked nodes as node whitelist
Also actually start using opportunistic locks (if requested).
cmdlib: Node whitelist support for allocation request
Forward the node whitelist to the iallocator plugin.
_ExportQuery: Use node allocation lock
Block instance allocations when all node locks will be acquired.
LUBackupExport: Use node allocation lock
LUBackupRemove: Use node allocation lock
LUInstanceMultiAlloc: Use node allocation lock
Avoid conflicts between instance allocations.
LUInstanceRecreateDisks: Use node allocation lock
LUNodeSetParams: Use node allocation lock
LUNodeQueryvols: Use node allocation lock
LUOobCommand: Use node allocation lock
If no node names are given, all node locks are acquired.
Locking related fixes for networks
Use GetNetwork() only when having already aquired the lock,i.e. in CheckPrereq().
In LUNetworkConnect/Disconnect do not include Network info in Hooksenvironment, so that network locking can be avoided if conflictsare not checked....
Use new util function for mac_prefix validation
Use new NormalizeAndValidateThreeOctetMacPrefix() util function inLUNetworkAdd/LUNetworkSetParams to validate network's MAC prefix.Additionally, move the check in CheckArguments() in the case ofLUNetworkAdd....
LUClusterRedistConf: Use node allocation lock
All node locks are acquired.
LUClusterRepairDiskSizes: Use node allocation lock
This opcode acquires all node resource locks, which conflicts withinstance allocations.
LUGroupVerifyDisks: Use node allocation lock
See comment in code.
LUClusterVerifyGroup: Use node allocation lock
LUInstanceReplaceDisks: Acquire node allocation lock
If the lock was acquired in the first place (only when an iallocator isused), it is released as soon as possible.
LUInstanceChangeGroup: Acquire node allocation lock
Changing instances' groups shouldn't conflict with instance allocations.
Acquire node allocation lock during node query
If locking is used (usually by ganeti-watcher), node allocations must betemporarily blocked.
Fix locking mistake introduced in commit 5cc1f88
The node resource locks were not set correctly on instance import.
LUClusterSetParams: Use node allocation lock
All resources are acquired and opportunistic instance creations wouldfail. Also add a TODO.
LUInstanceCreate: Acquire node allocation lock
Opportunistic locks are not yet used. This patch changesLUInstanceCreate to acquire the node allocation lock to avoid conflictswith other opcodes acquiring many node locks.
Acquire node allocation lock for failover/migration
See code for an explanatory comment. The lock is released as soon aspossible.
Use GetMultiInstanceInfo in LUNetwork* opcodes
LUNetworkConnect/Disconnect looks up a nodegroup's instances forconflicting IPs. To do so, use GetNodeGroupInstances() andGetMulitInstanceInfo().
Additionally, check if the correct locks were acquired.
Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>...
Support opportunistic locks in mcpu/LUs
Similar to “share_locks”, a new dictionary containing booleans for eachlocking level is added to “cmdlib.LogicalUnit”. Logical units wanting tomake use of opportunistic locks will be able to configure thisdictionary accordingly....
LUNetworkAdd: Log warning when needed
In case conflicts are checked, log warnings if nodes' IPs cannotbe reserved.
Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Use constants.IP4_VERSION in LUNetworkAdd
Fix locking in networks
Ensure that locks are held only if needed.
Add conflicts_check in OpNetworkAdd. This is needed if we want tocheck whether nodes/master IPs are included in network.
Depending on conflicts_check value, we have to hold node/instance locks...
Rename OpTestAllocator.allocator to iallocator
This makes the OpCode more consistent with the other opcodes. Thedownside is incompatibility when upgrading from 2.6, but since this isa test opcode it shouldn't be problematic.
Signed-off-by: Iustin Pop <iustin@google.com>...
Fixing crash when removing disks
This bug was introduced by my commit "Check ispecs against ipolicy oninstance modify", because I did not filter for the 'add' action. Thus itwould try to read the size parameter also when removing disks.
Signed-off-by: Helga Velroyen <helgav@google.com>...
Fix build after commit 9b7e05a
Commit 9b7e05a didn't quite work as expected: glm.is_owned expects alocking level, not a lock name.
LUNodeQueryStorage: Use node allocation lock
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Michele Tartara <mtartara@google.com>
cmdlib: Don't pass processor to _ComputeNics
The execution context ID can be passed right away.
cmdlib.LUInstanceRename: Another assertion for BGL
Check whether the BGL is actually held instead of just testing“REQ_BGL”.
cmdlib: Stop using proc.Log*
The Log* functions are re-exported through the LU. Inline use of stringformatting (“%”) was converted to additional arguments to Log* (unlike“feedback_fn”, these functions support it). Some punctuation has beenremoved from messages, as well as some small re-wordings....
cmdlib: Use CommaJoin where appropriate
Don't use inline versions of CommaJoin.
LUNetwork*: Build dictionaries right away
… instead of constructing an object, only to fill it separately.
Replace dict() with {}
The network patches and an existing test added function-call baseddict construction as opposed to literal sintax.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Michele Tartara <mtartara@google.com>
cmdlib.py: don't use GetHypervisor
In cmdlib we must only use the hypervisor class, and never instantiateit. As such we have to call GetHypervisorClass instead, to avoidgetting an instance of it.
This fixes Issue 316, because init is not called from masterd...
Make ipolicy violations a warning
So far, when running 'gnt-cluster verify' on a cluster whichhas instances that violate the instance policy, thoseviolations were shown as an error. This patch makes them awarning.
Small style fixes (' vs ") in network code
This is just trivial fixes; I think I caught all of them.
Remove delayed iallocator call in TLReplaceDisks
By setting the “delay_iallocator” parameter one could delay the call tothe instance allocator. This was not used for some time now, but thecode was still there.
cmdlib: Merge duplicated code for TLMigrateInstance
LUInstanceFailover and LUInstanceMigrate use TLMigrateInstance and hadthe essentially same code for expanding names and declaring locks. InLUInstanceMigrate.ExpandNames there was a mistake which led to node...
Fix lint error about too many variables
Lint complains about too many variables in the CheckPrereqmethod. While I think that this method/class would needsome refactoring in general, at least this patch makes lintshut up for now.
Check ispecs against ipolicy on instance modify
When modifying an instance, so far the specs were not checked againstthe ipolicy. This patch fixes this issue.
Note that for backend parameters which have a minimum and a maximumvalue (currently only memory), it checks both limits against the...
Fix _ComputeNics to include network slot
This bug was introduced after rebasing master branch.
Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>Reviewed-by: Iustin Pop <iustin@google.com>
Fixes to pass py-apidoc (make commit-check)
Fixes to pass pep8 (make lint)
Fixes to pass pylint (make lint)
Check for existing networks/groups in Network LUs