Hs2Py constants: update Python references to autoconf
Update Python references to all constants that used to point to thegenerated 'lib/_autoconf.py', which has been superseeded by theHaskell counterpart 'src/AutoConf.hs'.
Signed-off-by: Jose A. Lopes <jabolopes@google.com>...
Hs2Py constants: update Python references
Update references of Python constants in the previous patch to fetchtheir values from the generated Haskell to Python constants.
Signed-off-by: Jose A. Lopes <jabolopes@google.com>Reviewed-by: Klaus Aehlig <aehlig@google.com>
Update references of the Python constants that were introduced in theprevious patch.
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>
Display node names instead of node UUIDs
Display resolved node names instead of node UUIDs in a couple ofwarnings and log messages.
Only serialize dynamic_params on demand
To make sure that the dynamic_params field is not serialized by accidentto the configuration file only include it in the serialization whenexplicitly asked for.
Signed-off-by: Thomas Thrainer <thomasth@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 typo
Fix typo in comment.
Hs2Py constants: update 'SF_*' references
Update references to storage field Python constants to fetch theirvalues from 'lib/_constants.py'.
Update references to the Python constants generated in the previouspatch.
Fix conflicting path values from 'configure'
Because the Hs2Py constant generation infrastructure is transitional,there are two generated 'autoconf' modules, namely, 'src/AutoConf.hs'and 'lib/_autoconf.py'. However, conflicting values were beinggenerated for Haskell and Python concerning the variables...
Merge branch 'stable-2.9' into master
Update Python references to all constants added in the previous patch,which are the constants associated with the Haskell types declared in'Ganeti.Types'.
Fetch 'randomUuidFile' from 'ConstantUtils'
In 'Ganeti.Utils', update the reference to 'randomUuidFile' to fetchthe value from 'Ganeti.ConstantUtils' instead of the Python to Haskellgenerated constant. This allows breaking the dependency of'Ganeti.Utils' on the constants module, which in turn will allow...
Hs2Py constants: add xen related constants
Add xen related constants, such as, 'xenBootloader' and 'xenCmdXm' tothe Haskell to Python constant generation.
Hs2Py constants: add 'devConsole' and syslog related
Add 'devConsole' and syslog related constants to the Haskell to Pythonconstant generation.
Fix strings invalid with newer lint versions
Generating ASCII characters via a supported but not official escape sequenceleads to a "Anomalous backslash in string" error in newer pylint versions. Thispatch fixes the issue.
Signed-off-by: Michele Tartara <mtartara@google.com>...
Update Python references to exit code constants
Update Python references to exit code constants to take their valuesfrom the generated 'lib/_constants.py'.
Update Python reference to 'DAEMONS_LOGBASE'
Update Python reference of 'DAEMONS_LOGBASE' to fetch its value fromthe generated 'lib/_constants.py' module.
Flip dependency between Haskell types and constants
Before this patch, Haskell types, such as, 'GanetiDaemon' and'GanetiGroup', and related functions were taking their values fromHaskell constants. However, given that the role of Haskell to Pythonconstants is to leverage Haskell and its typesystem, it makes sense to...
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.
Signed-off-by: Thomas Thrainer <thomasth@google.com>Reviewed-by: Klaus Aehlig <aehlig@google.com>
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.
Update reference to Python constants
Update reference to 'DAEMONS_PORTS' and related constants that areused on the Haskell side to construct the 'daemonsPorts' constant.
Update references to Python constants
Update references to the Python constants introduced by the previouspatch.
Inconsistent auto repair related constant
In 'lib/constants.py', fix inconsistency in the value of'AUTO_REPAIR_TAG_SUSPENDED'. Fixes issue 569.
Update constant references
Update Python user separation constants to reference the generatedmodule 'lib/_constants.py' instead of 'lib/_autoconf.py'.
Haskell to Python constants: Update 'ADMINST_ALL' reference
Update constant 'ADMINST_ALL' to take its value from the generated'lib/_constants.py' module.
Fix module documentation
Fix 'lib/_constants.py.in' documentation to be consistent with othermodules.
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>
Auto-upgrade of disks' config wrt LD-renaming
This patch adds auto-upgrade functionality to the diskobjects with respected to the switch from LD constantsto DT constants. Unit tests are provided.
Signed-off-by: Helga Velroyen <helgav@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Update Python constants references to '_constants.py'
Update Python constants 'ADMINST_{DOWN,UP,OFFLINE}' to take theirvalues from the Haskell generated module 'lib/_constants.py'.
Signed-off-by: Jose A. Lopes <jabolopes@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Setup constant generation infrastructure
Setup a transitional Haskell to Python constant generationinfrastructure. This infrastructure is transitional and Pythonconstants will not be migrated to Haskell all at once. Instead, someconstants will be incrementally pulled from Python and moved to...
Fixing renaming of DISK_LD_DEFAULTS
This fixes the somewhat over-eager renaming ofDISK_LD_DEFAULTS to DISK_DT_DEFAULTS, which clasheswith another occurence of DISK_DT_DEFAULTS. Thispatch just undoes the renaming and additionally fixesa test regarding shared file storage....
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...
CLI: actually remove the --no-drbd-storage option
This removes the '--no-drbd-storage' option completelyfrom the command line interface. The hugepages designdoc still had a left-over reference to --no-lvm-storage,which is removed in this patch as well....
cluster init/modify: set helper without DRBD being enabled
The logic around the DRBD usermode helper so far was thatsetting it was only possible when DRDB was not explicitelydisabled. This patches changes it in a way that it isconsistent to how Ganeti handles the volume group name....
objects.py: upgrade config
Upgrading the config with respect to the DRBD usermodehelper was so far based on a guess whether or not DRBDis enabled by checking if there are any DRBD instancesrunning. This check can now be replaced to look at thelist of enabled disk templates in the cluster's...
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.
Signed-off-by: Helga Velroyen <helgav@google.com>...
cluster init: deprecate --no-drbd-storage
Whether or not a particular type of storage is enabledor not is determined by the list of enabled disk templatesin the cluster's configuration. This makes the option'--no-drbd-storage' obsolete, because it is subsumed by...
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.
Signed-off-by: Helga Velroyen <helgav@google.com>Reviewed-by: Thomas Thrainer <thomasth@google.com>
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....
gnt_cluster.py: unit test for usermode helper
This patch factors out the functions in gnt_cluster(related to cluster init and cluster modify) whichdeal with setting / determining the drbd usermode helperto make them more testable. Unit tests for the extracted...
bootstrap.py: unit tests for setting the usermode helper
This patch factors out the function that checks the DRBDusermode helper in bootstrap (cluster init) in order to makeit more testable. It also contains the unit tests. Otherwise,no functional changes....
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'.
Lint improvements to regexps
Fix some regular expressions so that they pass lint checks with newer versionsof pylint.
Signed-off-by: Michele Tartara <mtartara@google.com>Reviewed-by: Helga Velroyen <helgav@google.com>
Add name for the Parameter ND_OVS
That was forgotten when the parameter was added.
Signed-off-by: Klaus Aehlig <aehlig@google.com>Reviewed-by: Michele Tartara <mtartara@google.com>
Prepare GetLinuxNodeInfo for testing
The names of the input files are not hardcoded anymore, but they are now defaultparameters.
No changes for the callers, but it's now possible to test the function moreeasily.
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 parameters for OpenvSwitch to gnt-node
Extend gnt-node by parameters for OpenvSwitch. --ovs Flag to enableOpenvSwitch, --ovs-name for the name of the OpenvSwitch and --ovs-linkfor the interface to connect to.
Signed-off-by: Sebastian Gebhard <sege@fs.ei.tum.de>...
Add RPC functionality for creating OpenvSwitches
This patches adds the needed RPC functions in order to create theOpenvSwitches on the nodes.
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...
Backend: Create openvswitches on the nodes
This is the functionality to create the OpenvSwitches on the nodes.Parameters are given via opcode and checked as well as extended withthe defaults.
Signed-off-by: Sebastian Gebhard <sege@fs.ei.tum.de>Signed-off-by: Klaus Aehlig <aehlig@google.com>...
Add params for OpenvSwitch to ndparams
This patch introduces the needed fields for OpenvSwitch parametersinto ndparams and also provides the default values.
The parameters are:ND_OVS: boolean, to show whether OpenvSwitch is enabled or notND_OVS_NAME: the name of the OpenvSwitch to create...
Fix bug in NodeD and RapiD usage strings
The strings did not comply with the style guide, and were not diplayedcorrectly either.
Signed-off-by: Michele Tartara <mtartara@google.com>Reviewed-by: Klaus Aehlig <aehlig@google.com>
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>
Signed-off-by: Thomas Thrainer <thomasth@google.com>Reviewed-by: Helga Velroyen <helgav@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.
Typo fix in lib/server/noded.py
Signed-off-by: Sebastian Gebhard <sege@fs.ei.tum.de>Reviewed-by: Guido Trotter <ultrotter@google.com>
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...
bootstrap: restrict ipolicy to enabled disk templates
With this patch, on cluster creation, the initial instancepolicy's list of allowed disk templates will be modifiedin a way that it does not contain any disk templates whichare not enabled cluster-wise....
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.
Disable pylint warning to fix build
The _CheckLUResult method gets overridden in a subclass which actuallyrequires the self parameter, so ignore the pylint remark about it.
Add possibility to access locked LU in tests
This features is useful to test (private) methods of LU's during tests,where those methods rely on the LU being completely initialized andlocking already performed.
An initial version of unit tests for LUClusterVerifyGroup makes use of...
Fix TINicParams type predicate
Change the value type of the 'TINicParams' dictionary predicate from'Maybe NonEmptyString' to 'Maybe String' to be compatible with theHaskell definition.
Signed-off-by: Jose A. Lopes <jabolopes@google.com>Reviewed-by: Thomas Thrainer <thomasth@google.com>
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
Add unit test for LUClusterQuery
Unit-test LUClusterQuery. Some changes in the mocked clusterconfiguration are made, because the configuration was not completelyvalid before.
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 LUClusterActivateMasterIp
In order to properly assert the called RPC method, eq is implementedon ConfigObject as well.
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
Fix batch creation of instances
During batch creation of instances the 'reason' field in opcodes is setto None (but the field is present). This caused problems when adding areasons to the reason trail.
Setting the default value for the 'reason' field to the empty list fixes...
Support multi instance allocs without iallocator
If all instances in the multi allocation request have already theirprimary and secondary node set, there is no need for an iallocator. Thusdon't require it in this case and omit the call to it all together....