Provide an inverse to UnescapeAndSplit
With utils.UnescapeAndSplit, we have a function to parsearbitrary non-empty string lists encoded as strings. Alsoprovide the appropriate encoding function.
Signed-off-by: Klaus Aehlig <aehlig@google.com>Reviewed-by: Michele Tartara <mtartara@google.com>
Specify the intent-to-upgrade path
During a Ganeti upgrade, 'gnt-cluster upgrade --to' documents thefact that an upgrade is going on in a file, in case of a power failureon the master node. Specify the full file name in pathutils.
Signed-off-by: Klaus Aehlig <aehlig@google.com>...
Hardcode default access mode to kernelspace
Hardcode constants.KERNELSPACE as the default access method forKVM disk templates, rather than allowing a change to the RBD defaultaccess mode to affect all disk templates for KVM.
At some point in the future it might make more sense to have this...
Handle scenarios where access is not set
It should not be possible to reach _GenerateKVMRuntime without havingthe access method set, but if it does happen this commit makes surethe default value is used anyway.
Signed-off-by: Raffa Santi <rsanti@google.com>...
Add an upgrade command to gnt-cluster
This command will coordinate the switching to a newGaneti version across the cluster. This has becomepossible by the new layout that allows several Ganetiversions to be present at the same time.
Provide the DIRVERSION as a constant
Depending on configure options, the version string used in the nameof the version specific directory differs. Provide this string alsoas a constant, as it is needed for the upgrade procedure, in order tobe able to roll back....
Provide time constants related to upgrades
During upgrades, gnt-cluster needs to wait for all jobsin the queue to finish. Provide constants for timeout andpolling interval.
Signed-off-by: Klaus Aehlig <aehlig@google.com>Reviewed-by: Jose Lopes <jabolopes@google.com>
Add option to redist-conf while queue is drained
Add a new option to 'gnt-cluster redist-conf' allowing to ignore a drainedstate of the Ganeti queue. This is needed (until we implement the fine-grainedqueue control) during upgrades, as here we have to redistribute the configuration...
Provide means of submitting jobs to a drained queue
During an upgrade, the job queue needs to be drained in order to avoidnew jobs coming to the cluster. Nevertheless, the upgrade processneeds to carry out some maintenance, like redistributing the new...
Expose sharedir in pathutils
This path is needed to construct the link targetfor $(sysconfdir)/ganeti/share for a different version.The latter will happen in the automated upgrade procedure.
Provide path to ensure-dirs in pathutils
Provide the canonical path to cfgupgrade in pathutils
This is the version-independent path for cfgupgrade, that willalways refer to the cfgupgrade of the currently installed version.
Expose the list of online nodes at ssconf
Ganeti's ssconf contains the list of nodes currently consideredonline. Expose this data at the ssconf interface.
Also export PKGLIBDIR in pathutils
Add predicate whether to call cfgupgrade --downgrade
Provide a predicate that, given the current version and theversion to go to, tells whether it is appropriate to callcfgupgrade --downgrade.
Add utility function to recognize upgrade ranges
Upgrading is possible within the same major version to any equalor higher minor version. Downgrading is possible within the samemajor version to the previous minor version. Moreover, automaticupgrades are only supported from version 2.10 onwards. Add a utility...
Also provide the program version
Conceptionally, the versions of the program, the protocols, and theconfiguration are three different things, even though, currently thereis a tight coupling. So export the version as well, as the upgradesare designed to make decisions based on the version....
Add utility function to parse version strings
The new 'gnt-cluster upgrade' command will get a Ganeti version asargument. So provide a function able to parse it.
Check validity of the access protocol parameter
Add Userspace RBD support in KVM
Signed-off-by: Santi Raffa <rsanti@google.com>Reviewed-by: Thomas Thrainer <thomasth@google.com>
New method GetUserspaceAccessURI in storage class
Returns a hypervisor specific URI for RBD template when userspaceaccess is requested.
Signed-off-by: Santi Raffa <rsanti@google.com>Signed-off-by: Thomas Thrainer <thomasth@google.com>Reviewed-by: Thomas Thrainer <thomasth@google.com>
Define 'access' disk-parameter type
Add the "access" parameter to the RBD configuration. Fix test brokenby this change.
Merge 'EvacNode' and 'NodeEvacMode'
Merge 'EvacMode' and 'NodeEvacMode' which are associated with theduplicated constants 'IALLOCATOR_NEVAC_*' and 'NODE_EVAC_*'. Thismerge moves the type 'EvacMode' to 'Ganeti.Types' in order to avoid acircular dependency between 'Ganeti.HsConstants' and...
Remove duplicate 'IALLOCATOR_NEVAC_*' constants
Constants 'IALLOCATOR_NEVAC_*' are duplicates of 'NODE_EVAC_*' and areno longer being used so they can be removed. Fixes issue 583.
Signed-off-by: Jose A. Lopes <jabolopes@google.com>Reviewed-by: Klaus Aehlig <aehlig@google.com>
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....
Add soundhw support to XEN hypervisors
This allows XEN hypervisors to enable sound support, if the hostmachines has required support. This has been tested only up to thepoint of making sure the xen config file has the requiredconfiguration values as per:...
Add cpuid support to XEN hypervisors
Ease instance migration between heterogeneous nodes by letting systemadministrators hide CPU capabilities as needed.
Add MonD's latest API Version in lib/constants.py
Extract the version number from MonD's own file into the constants file, so thatis can be accessed from other parts of the system as well (e.g.: to performqueries over the MonD protocol).
Signed-off-by: Spyros Trigazis <strigazi@gmail.com>...
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.
Signed-off-by: Thomas Thrainer <thomasth@google.com>...
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...
Merge branch 'stable-2.9' into master
Merge branch 'stable-2.8' into stable-2.9
Move 'BuildVersion' to 'lib/utils/version.py'
Functions 'BuildVersion' and 'SplitVersion' are no longer needed bythe constants and, given that they are not constants, they should bemoved elsewhere. Since they are only used by 'cfgupgrade' and tests,these functions are moved to 'lib/utils/version.py' and references to...
Hs2Py constants: update Python references
Update references to constants that were previously in the generated'lib/_autoconf.py' and since the previous patch have been included inthe Hs2Py constant generation.
Signed-off-by: Jose A. Lopes <jabolopes@google.com>...
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'.
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>
Make QmpMessage a proper container
Newer pylint versions complain that QmpMessage is not a proper container becauseit does not implement the len() and delitem() methods. This commitimplements them.
Also, tests are added.
Signed-off-by: Michele Tartara <mtartara@google.com>...
Update references of Python constants in the previous patch to fetchtheir values from the generated Haskell to Python constants.
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.
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'.
Fix corner-case in handling of remaining retry time
Consider a remaining time of 0 as already timed out. Otherwise,there is no guarantee that calling utils.Retry with timeout 0will call the function precisely once; it might run in timeshorter than the resolution of timer....
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...
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.
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...
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.
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>...