Add possibility to compress to OpInstanceCreate
OpInstanceCreate now supports the 'compress' option. It allows to enablecompression during instance imports.
Signed-off-by: Thomas Thrainer <thomasth@google.com>Reviewed-by: Klaus Aehlig <aehlig@google.com>
Honor compress parameter in remote backups
Use the specified compression mode not only for local exports, but alsofor remote ones.
Support import with compressed instance moves
Support compressing instance data while sending it to the target node oninstance imports.
Add local compression to OpBackupExport
OpBackupExport is extended by a compress parameter. This parameter(either 'none' or 'gzip') controls if instance disks are compressedbefore being sent over the network to the destination node.
Signed-off-by: Thomas Thrainer <thomasth@google.com>...
Add possibility to compress to OpInstanceMove
OpInstanceMove now supports the 'compress' option. It allows to enablecompression for intra-cluster instance moves.
Use import-export daemon for intra-cluster moves
This unifies the inter- and intra-cluster moves and the backup code, soless code needs to be maintained.
Also fix failing tests for LUInstanceMove by following the code changesin the tests.
Use cluster variable consistently
The cluster object is already retrieved from the configuration, so useit consistently in LUInstanceMove.CheckPrereq().
Correct comments
Correct comments which confuse the target node with the secondary nodeof an instance in LUInstanceMove.
Add unit tests for LUBackupExport
This patch adds unit tests for LUBackupExport.
Signed-off-by: Thomas Thrainer <thomasth@google.com>Reviewed-by: Helga Velroyen <helgav@google.com>
Use node names in LUBackupQuery
The result of LUBackupQuery has to be indexed by node name rather thanby node UUID, otherwise the automatically constructed filter won'treturn any results.
Make 'gnt-node list-storage' use default storage type
Currently, when no explicit storage type is given, the'gnt-node list-storage' command defaults to file storagewhether or not file storage is enabled on the clusteror not. This patch fixes it by defaulting to the default...
Make 'gnt-cluster modify' respect the order of templates
This fixes a bug where the order of enabled disk templateswas not respected when manipulating it with 'gnt-clustermodify'.
Signed-off-by: Helga Velroyen <helgav@google.com>Reviewed-by: Klaus Aehlig <aehlig@google.com>
Streamlining handling of spindles and default templates
This rather lenghy patch comprises a couple of refactoringsto achieve the following goals:- 'gnt-node info' should only report space information about spindles, when exclusive storage is enabled on the node...
Fix typos and indentation for cluster.py
This patches fixes a typo and some indentation errorsthat were accidentally introduced by premature pushingof the patch series "Improvements on disk templates, inparticular file storage".
Signed-off-by: Helga Velroyen <helgav@google.com>...
Make GetDiskTemplateSets output disabled disk templates
This patch extends the 'GetDiskTemplateSets' function toalso output the list of disk templates that were enabledbefore this operation, but will be disabled afterwards.This patch also includes code to check for instances using...
Rename GetEnabledDiskTemplates to include disabled ones
This patch solely renames the functions_GetEnabledDiskTemplates* to _GetDiskTemplateSets, becausein later patches, we will refactor it to not only outputdisk templates that are or get enabled, but also the ones...
Check for running instances when disabling templates
This patch introduces a function to be used in'gnt-cluster modify' when disabling a couple of disktemplates. It checks whether there are still instancesrunning that use these templates.
Merge branch 'stable-2.9' into master
Use 'DTS_LVM' when possible
This patch replaces all usages of the utility function'GetLvmDiskTemplate' by the new 'DTS_LVM' constantto make it consistant with the usage of other DTS_*constants.
Additionally, it provides a unit tests to ensureconsistancy between DTS_LVM and the mapping of disk...
Rename LDS_DRBD to DTS_DRBD
This patch renames the constant 'LDS_DRBD' to 'DTS_DRBD'to make it consistent with the renaming of LD_* constantsto DT_* constants.
Signed-off-by: Helga Velroyen <helgav@google.com>Reviewed-by: Thomas Thrainer <thomasth@google.com>
Check validity of the access protocol parameter
Replace 'IALLOCATOR_NEVAC_*' with 'NODE_EVAC_*'
Replace uses of 'IALLOCATOR_NEVAC_PRI', 'IALLOCATOR_NEVAC_SEC','IALLOCATOR_NEVAC_ALL', and 'IALLOCATOR_NEVAC_MODES', with'NODE_EVAC_PRI', 'NODE_EVAC_SEC', 'NODE_EVAC_ALL', and'NODE_EVAC_MODES', given that these constants are repeated....
Use secondary IP when moving instances
All data traffic usually goes over the secondary network, butgnt-instance move didn't. This patch corrects this problem by using thetarget nodes secondary IP as move target.
Honor disks_active of instance when adding disks
Adding a disk to an instance used to leave the disk behind activated, nomatter how the disks_active flag of the instance was. This changes makesure that new disks are only active if the other disks of the instance...
Wait for disk sync when adding a disk
When creating an instance, gnt-instance waits for instance disks tosync. Inconsistently, this was not the case for adding a disk to aninstance. This patch changes the default behavior to wait for sync whenadding a disk, but honor the --no-wait-for-sync option which...
Fix some wrong indentations in the code
Fix all instances of pep8's error: "E128 continuation line under-indented forvisual indent".
Signed-off-by: Michele Tartara <mtartara@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Fix RPC call to blockdev_getdimensions
The parameter format for call_blockdev_getdimensions has changed in aprevious patch. Here, the correct parameter format is used for the RPCcall.
Signed-off-by: Thomas Thrainer <thomasth@google.com>Reviewed-by: Jose A. Lopes <jabolopes@google.com>
Remove physical_id field from disk object
The 'physical_id' field of disk objects is no longer used, so remove it.Also, all references are removed together with the code which made surethat the physical_id is up to date when transmitted over RPC.
Replace physical_id with dynamic_params
The disk field 'physical_id' has to be kept up to date whenever a diskobject is sent to a node via RPC. This is done with the SetDiskID methodmanually, which is a source of bugs.
This patch replaces the use of 'physical_id' with a new field names...
Fix incorrect conflict resolution in lib/cmdlib/instance.py
Between the last two merges, nothing happened on stable-2.9. Theonly change on stable-2.8 that touched lib/cmdlib/instance.py isff34fb97. So make sure, the net change since the last merge tothis file is that of the said commit. This also fixes the doclint...
Merge branch 'stable-2.8' into stable-2.9
Add a default to file-driver when unspecified over RAPI
The file-driver value, used by file-based instances, had a default value whenan instance was being created over the CLI, but not when the instance wascreated through the RAPI.
This patch introduces a default value for the remote API and, while doing so,...
Fix lint errors in fix keyerrors patch
This patch fixes one lint error introduced by my recent patch tofix keyerrors in lib/cmdlib/node.py.
Signed-off-by: Sebastian Gebhard <sege@fs.ei.tum.de>Signed-off-by: Klaus Aehlig <aehlig@google.com>Reviewed-by: Klaus Aehlig <aehlig@google.com>
Fix keyerrors in cmdlib node
This patch fixes potential key errors in the OpenvSwitch implementationin cmdlib/node.py. The checks in that file expected to have a ndparams dictwith certain keys to be present. This should not be the case as it willresult in KeyErrors when those keys are not present....
Use RpcResult.Warn where appropriate
Those two occurrences of warnings can be replaced the RpcResult.Warnmethod, which is done in this patch.
Remove unneeded except block
The validation of the opcodes already checks the size parameter for theright type, so this except block is not required.
Rename variable to reflect its content
Rename the "node" variable to "node_uuid" as that's the content itactually receives.
Replace literals with constants
In "lib/cmdlib/node.py", in lines 1315-1316, 1354, and 1359-1370,replace string literals with constants. Fixes issue 558.
Signed-off-by: Jose A. Lopes <jabolopes@google.com>Reviewed-by: Michele Tartara <mtartara@google.com>
Replace LD_* constants with DT_* constants
LD_* constants are basically like DT_* constants, exceptfor that both file and shared file were mapped to file.In order to not having to maintain three slightly differentsets of disk-related constants (DT, LD and ST), we merge...
cluster modify: deprecate --no-drbd-storage
As in the previous patch, the option '--no-drbd-storage'is deprectated, because it is subsumed by the non-inclusionof 'drbd' in the list of enabled disk templates.
cluster verify: check drbd helper only when drbd enabled
This change makes sure that 'gnt-cluster verify' onlychecks for the DRBD usermode helper, if DRBD is actuallyenabled.
cmdlib/cluster.py: unit tests for usermode helper
This patch factors out the functions that deal with settingand modifying the DRBD usermode helper in cluster.py inorder to make them more unittestable. The unit tests areprovided as well. No functional changes otherwise....
Simplify '_CheckOutputFields'
Function '_CheckOutputFields' was receiving three field sets, two ofwhich were simply being merged together. This was complicated andunnecessary. This patch simplifies '_CheckOutputFields' to takesimply two field sets....
Add 'SF_NODE' to 'VALID_STORAGE_FIELDS'
Constant 'SF_NODE' is a storage field and, therefore, should be in'VALID_STORAGE_FIELDS'. This patch fixes this and also reference tothese constants, namely, in 'cmdlib' and 'qa'.
Signed-off-by: Jose A. Lopes <jabolopes@google.com>...
Check right disk template in inst set params
While checking the parameters of the opcode for LUInstanceSetParams, thealready set disk_template was checked instead of the new one in theopcode. This patch fixes this bug.
Add OpenvSwitch functionality to LUNodeAdd
This patch adds functionality to LUNodeAdd to - check the arguments given. It will warn if no physical link is given and fail if OpenvSwitch is not enabled, but parameters are given - call the RPC to configure OpenvSwitch on the node...
Add unit tests for LUInstanceCreate and move tests
- Move instance related tests to instance_unittest.py- Adapt moved tests to the new test framework where appropriate- Add unit test coverage for LUInstanceCreate - Only instance creation is covered yet, no imports...
Allow instance mods if only osparams are given
osparams are now recognized as changes, so changing only those withoutother changes works too now.
(cherry picked from commit 5eae613c2e1e65101c5d5f7d2e8ffd7cc6edc7d5)
Use node UUIDs for locking instead of node names
LUInstanceMultiAlloc used node names instead of node UUIDs to lockrequired nodes. This patch fixes this bug.
Signed-off-by: Thomas Thrainer <thomasth@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Fix a node name vs. UUID bug in instance import
This patch fixes a bug where node names were incorrectly used as nodeUUID's.
Use node UUID for locking in LUInstanceMove
This LU (incorrectly) used the node name for locking. This patchcorrects this error.
Signed-off-by: Thomas Thrainer <thomasth@google.com>Reviewed-by: Michele Tartara <mtartara@google.com>
Fix IPolicy violation check in LUGroupSetParams
cfg.GetMultiInstanceInfoByName returns a list of tuples, not a list ofinstance objects which is required by ComputeNewInstanceViolations.This patch fixes this type error.
Extend unit tests for LUClusterVerifyGroup
- Add tests for additional Verify* methods- Converted test for VerifyFiles to the new test framework- Added possibility to prepare the LU in a test class before actually executing the test method with it
Revert "Display node name instead of UUID in error message"
This reverts commit fbff213691328562cc4029f3babaa2e72e2012c4.When running hooks, the node name is used to identify nodes, not (aswrongly assumed in the patch) the node UUID.
Display node name instead of UUID in error message
The hooks callback in LUClusterGroupVerify misinterpreted the key in thenode result as name instead of node UUID. This patch fixes this, whichleads to more user friendly error messages.
Use node name in error message
CheckNodeNotDrained displayed only the node UUID if the node is drained.In order to provide a more helpful error message, use the node nameinstead.
ClusterSetParams: move vg-name checks from to CheckPrereq
This fixes a bug in the logic of 'gnt-cluster modify'.Some checks that should better be done in 'CheckPrereq'were actually done in 'Exec'. This lead to a strangebehavior in case the execution failed, because an...
gnt-group add/modify: ipolicy vs disk templates
This patch adds a consistency check between the ipolicy'slist of allowed disk templates with the cluster-wideenable disk templates when a new node group is addedor a group is modified.
It also fixes a bug in gnt-group where the list of allowed...
Move Ipolicy utility function to cmdlib/common.py
Since the check of consistency between an ipolicy andthe list of enabled disk templates will not only beneeded on cluster modification, but also on groupmodification, we move the respective function and its...
gnt-cluster modify: ipolicy vs enabled disk templates
This patch adds a check to LUClusterSetParams whichensures that the list of allowed disk templates is asubset of the list of cluster-wide enabled disktemplates. Unit tests are included.
gnt-cluster modify: factor out ipolicy check
This refactors the LUClusterSetParams to do all ipolicysanity / validity checks in a separate functionin order to increase testability. No function changesotherwise.
Fix opcodes and parameters
Add unit test for LUClusterSetParams
Some changes to the test framework were performed while writing thistest: - Extended builder for disks - Introduced builder for NICs - Fixed bugs in RpcResultsBuilder
Use ConfigWriter.GetMasterNodeInfo() consistently
This shortcut method to get the node object of the master node directlymakes the code more readable and concise. Therefore, use it everywherewhere appropriate.
Add unit test for LUTestAllocator
Additionally to adding unit tests for LUTestAllocator, the testframework was adapted for its requirements.
Remove unneeded checks
Those checks are already covered by the "types" in the opcodes, soremove them.
Initial version of cmdlib test framework
The initial version of the cmdlib test framework is able to execute LU'swith the following components mocked:
A base test class is provided which makes it easy to execute opcodes and...
Merge branch 'stable-2.9'
Merge branch 'stable-2.7' into stable-2.8
Add Python opcode generation
Move constants to the appropriate module
Move constants ALLOCATABLE_KEY and FAILED_KEY to the constants module.
Signed-off-by: Jose A. Lopes <jabolopes@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Add predicates to test Python types in opcodes
Add helper functions to test Python types, which are used by opcodeparameters and return values.
Include VCS version in `gnt-cluster version`
Also print the VCS version in the output of `gnt-cluster version`. Thismakes the VCS version also available over RAPI, etc.
Fix formatting of instance names in config verify
Instance object were incorrectly treated as instance UUID's which causedan exception to be raised. Using the names of the instance objectsdirectly fixes this problem.
Fix verify config if a node has no instances
Do not try to provide a fake instance UUID called "no instances", astrying to get the name for would fail and raise an exception.
Check for luxid permission during verify config
confd no longer needs access to the noded certificate file, but luxiddoes. Change the check to use the right user.
Check disk template in right dict when copying
Due to the structure of the code this condition can't possibly be true.We have to look in the new_diskparams dict instead, otherwise it'd bepossible to try to update a non-existing entry.
(The same patch is in stable-2.7 as 106441d already)....
Add cleanup parameter to instance failover
Most of the code is shared with instance migrate, so we actually only needto add the parameter and pass its value along the the common code.
Also, tests and harep are updated to support the right set of options to...
gnt-cluster verify: consider shared file storage
This patch enhances 'gnt-cluster verify' in a way that itnow validates the acceptance and existance of the sharedstorage directory.
gnt-cluster modify --shared-file-storage-dir
This patch introduces to 'gnt-cluster modify' the option'--shared-file-storage-dir' to change the default directoryfor instances using shared file storage at cluster runtime.
Bootstrap: factor out and prepare shared-file-storage
This patch makes 'gnt-cluster init' use the'--shared-file-storage-dir' option to set the defaultshared file storage dir. Additionally, it performs thesame sanity and validity checks for the path as for...
Extend gnt-instance show to show vlan parameter
Extensions for "gnt-instance show" to output the vlan parameter whichwas introduced by my recent patch series.This is done by extending the nic object that is used to output theinfo. Every other occurrence of this object is adopted as well....
Rename VALID_STORAGE_TYPES to STORAGE_TYPES
For consistency, this patch renames 'VALID_STORAGE_TYPES'to 'STORAGE_TYPES', because the set of valid disktemplates is also just names 'DISK_TEMPLATES'.
Signed-off-by: Helga Velroyen <helgav@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
gnt-cluster {init, modify} --file-storage-dir
This patch implements consistent usage and behavior ofthe --file-storage-dir option in 'gnt-cluster init'and 'gnt-cluster modify'. It includes a bunch of unittests as well.
Additionally, it enables the previously written unit...
Always return tuples in Expand*Name
ExpandNodeName and ExpandInstanceName now always return a tuple. If thenode/instance was not found, (None, None) is returned. This fixes bugswhere callers blindly assign the return value of those methods tomultiple variables without checking if it was None....
Fix KeyErrors with network mode and vlan
This patch fixes some KeyErrors that were introduced by the vlan implementationand showed up when certain parameters were missing:gnt-cluster init without network modegnt-isntance add without vlan
Signed-off-by: Sebastian Gebhard <sege@fs.ei.tum.de>...
Support VLAN parameter during instance creation
If VLAN parameter is present, check its format:either .<id>[:id], :id[:id...], or just id.
GenerateDiskTemplate: Proper check for valid disk templates
This patch makes an FileStorageError to be risen with aproper error message instead of just an assertion in casethe given disk template is not a valid disk template atall.
Fix conflicts check in LUNetworkDisconnect
The function _NetworkConflictCheck expects a list of instances aslast argument, not a list of pairs of instance names and instances.
Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>Signed-off-by: Klaus Aehlig <aehlig@google.com>...
Merge branch 'stable-2.8' into master