Add unit tests for LUBackupPrepare
This patch adds unit tests for LUBackupPrepare.
Signed-off-by: Thomas Thrainer <thomasth@google.com>Reviewed-by: Helga Velroyen <helgav@google.com>
Add unit tests for LUBackupQuery
This patch adds unit tests for LUBackupQuery.
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...
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...
Rename entities of unit test for MakeLegacyNodeInfo
This is a small preparation step for the next patch.It just renames the key/value constants for the unittest of MakeLegacyNodeInfo, because they were ratherundescriptive and thus made changes to the test cumbersome....
Add test suite for some names in 'AutoConf'
Add test suite for some names in 'AutoConf' to test whether the valuesgenerated from 'configure' and the 'Makefile' are valid filepaths,user names, group names, among others. Fixes issue 601.
Signed-off-by: Jose A. Lopes <jabolopes@google.com>...
Move unit tests for --file-storage-dir to cmdlib/*
There were some unit tests for the '--file-storage-dir'option of 'gnt-cluster modify' still left in the unittest file ganeti.cmdlib.cluster_unittest.py.With the introducion of the unit test framework for...
Correct properties of the cluster's file storage dir
This patch does:- Rename the haskell opcode parameter 'pGlobalFileStorageDir' and 'pGlobalSharedfileStorageDir' to 'pClusterFileStorageDir' and 'pClusterSharedfileStorageDir', respectively, because...
Move disk template unit tests to test/py/cmdlib/
This patch moves some unit tests related to dis/enablingdisk templates from ganeti.cmdlib.cluster_unittest.pyto cmdlib/cluster_unittest.py to utilized the new cmdlibunit test framework.
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...
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...
iallocator: use lookup by disk template
So far, the iallocator requested storage informationabout all enabled disk templates but discarded all butthe LVM information, even if it was allocating spacefor a non-LVM instance. With this patch, it now onlyasks for the one that is relevant for...
utils/storage.py: storage info lookup by disk template
This patch improves the handling of storage informationbefore and after a call to the RPC 'node_info'. Itadds a function to not only call for all storageinformation on the cluster (as it is used right now),...
Downgrade 'vif_script'
This patch adds removing the 'vif_script' attributefrom the cluster's config when downgrading from 2.9to 2.8. Adaption of the unit test is included.
Signed-off-by: Helga Velroyen <helgav@google.com>Reviewed-by: Klaus Aehlig <aehlig@google.com>
Downgrade 'xen_cmd'
This downgrades the cluster's hypervisor parameters for thexen hypervisors with respect to the 'xen_cmd' attribute.A unit tests is provided.
Add test cluster config for version 2.9
This adds a cluster config example for version 2.9 tothe test data collection. It will be used in subsequenttests.
Remove superfluous import of 'errors'
Provide utility function to check a configuration version
In order for 'gnt-cluster upgrade --resume' to determine whether the configurationis already upgraded, it needs to compare whether a configuration version is compatiblewith a Ganeti target version. Provide a utility function for this....
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>
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...
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.
Signed-off-by: Klaus Aehlig <aehlig@google.com>Reviewed-by: Jose Lopes <jabolopes@google.com>
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...
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.
Add tests specific to the user/kernelspace access feature
Check that the validation procedures don't accept invalid valuesand also don't choke on valid values.
Signed-off-by: Santi Raffa <rsanti@google.com>Reviewed-by: Thomas Thrainer <thomasth@google.com>
Add Userspace RBD support in KVM
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...
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....
Disable hlint camelcase on test module
Add test for mond-data mock file
Test if the input file imported with the --mond-data option isparsed properly.
Signed-off-by: Spyros Trigazis <strigazi@gmail.com>Signed-off-by: Michele Tartara <mtartara@google.com>Reviewed-by: Michele Tartara <mtartara@google.com>
Prevent lint error in mocked classes
Accessing private methods of parent classes is bad, but it is sometimes the bestapproach for classes mocking them for testing reasons.Selectively disable the related lint error just for the few functions that needto do it....
Fix indentation for newer lints
Newer versions of pylint are more strict regarding indentation rules. Thiscommit fixes a couple of indentations that they consider wrong.
Signed-off-by: Michele Tartara <mtartara@google.com>Reviewed-by: Jose A. Lopes <jabolopes@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...
Haskell test modules contain functions which have names containingunderscore. Add hlint annotation to disable this check.
Signed-off-by: Jose A. Lopes <jabolopes@google.com>Reviewed-by: Klaus Aehlig <aehlig@google.com>
Merge branch 'stable-2.8' into stable-2.9
Signed-off-by: Klaus Aehlig <aehlig@google.com>...
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...
HUnit test for 'buildVersion'
Add 'HUnit' test for 'buildVersion'.
Signed-off-by: Jose A. Lopes <jabolopes@google.com>Reviewed-by: Thomas Thrainer <thomasth@google.com>
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.
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>...
Fix cfgupgrade test wrt. downgrading physical_id
The physical_id field can't be recreated during downgrades, so don'texpect it to be during the test.
Signed-off-by: Thomas Thrainer <thomasth@google.com>Reviewed-by: Jose A. Lopes <jabolopes@google.com>
Remove physical_id field from disks during upgrade
The physical_id field is no longer supported in disk objects, so removeit during upgrades.
Remove physical_id from config mock
Disk objects no longer support the physical_id field, so remove it frommocked disk objects.
Fix tests related to the physical_id field
Remove all references to the physical_id field of disk objects in tests.
Add additional tests for utils.Retry
Also have some tests where the time the various components(inspecting the time function, calling the function, etc) havea non-trivial time. Also, have two tests demonstrating thatthe number of retries actually depends on the amount of time...
Make retry tests independent of actual time
Even in the tests, real time is used. While, generally, the assumptionsabout execution time are pretty safe, in some rare circumstances, e.g.,on machines with extremely heavy load they do not hold true, thus rendering...
Hs2Py constants: add constants from 'Ganeti.Types'
Add to Hs2Py constant generation all constants that are defined by theHaskell defined declared in 'Ganeti.Types'. This patch also fixes atype inconsistency between Haskell and Python, namely, the constant...
Further tests for LUNodeAdd
This patch adds tests for the remaining functionality of LUNodeAdd.
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>
Add unittests for OpenvSwitch in LUNodeAdd
This patch adds node_unittest.py containing the framework for unittesting LUNodeAdd.At this point, only test setup and tests for OpenvSwitch areimplemented.
Signed-off-by: Sebastian Gebhard <sege@fs.ei.tum.de>...
Replace more IPs with reserved adresses
Recently, some IP addresses were changed to TEST-NETs from RFC 5737.This patch changes some more occurences of wrong IPs and replaces them.
TEST-NET-1 is used for primary_ips, TEST-NET-2 for networks and TEST-NET-3 for...
Mock RPC for unit tests
This patch enables patching the rpc module to create a mocked versionwhich can be used to mock a rpc.DnsOnlyRunner(). This is needed forunit testing LUNodeAdd, as it need to run RPCs against nodes not yetpresent in the configuration....
Fix example IPs and hostnames in tests
Our tests are a form of documentation, and hence should useIPs from the TEST-NET ranges according to RFC 5737. They definitelyshould not use real public IP addresses.
Similarly, example host names should be from one of the reserved...
Add shelltest for the --ignore-dynu option of hbal
In the example, we have two nodes and 6 instances, all using externalstorage. There are four small instances on one node, and two biginstances, requiring twice the amount of resources of a small instance,...
Add unit test for LUInstanceQuery and -QueryData
This patch provides rudimentary unit test coverage for LUInstanceQueryand LUInstanceQueryData.
Signed-off-by: Thomas Thrainer <thomasth@google.com>Reviewed-by: Klaus Aehlig <aehlig@google.com>
Add unit tests for LUInstanceMigrate and -Failover
This patch adds rudimentary unit test coverage for LUInstanceMigrate andLUInstanceFailover.
Add unit tests for LUInstanceChangeGroup
This patch provides unit test coverage for LUInstanceChangeGroup.
Add unit tests for LUInstanceSetParams
This patch adds unit tests for LUInstanceSetParams. It does not provide100% coverage, but covers a significant portion.
Fix testMasterNetmask in TestLUClusterSetParams
The netmask was previously wrongly given as a bitmask, now it's given asthe net prefix length.
Haskell to Python constants: more constants
Wrap 'Set' in 'ListSet' for the opcodes
In what Haskell to Python opcodes are concerned, a Haskell 'Set' istranslated into a Python 'list'. In other words, currently, opcodesthat handle sets of parameters are actually handling lists becausethis is how sets are currently encoded. This patch introduces a new...
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>
Fix tests regarding DISK_LD_DEFAULTS
This fixes two remaining issues regarding the renamingof DISK_LD_DEFAULTS:
- The keys of the map DISK_LD_DEFAULTS cannot be comparedto DISK_TEMPLATES right away, because there are nodefaults for the diskless template. This patch adjusts...
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...
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....
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 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...
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....
Add unit test for GetLinuxNodeInfo
The function was not unit tested previously.
Signed-off-by: Michele Tartara <mtartara@google.com>Reviewed-by: Helga Velroyen <helgav@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...
Adapt tests for merged changes in IPolicy handling
The enabled disk templates in IPolicies are stricter checked after themerge from 2.9, so adapt the tests to follow those changes.
Add unit tests for LUInstanceMultiAlloc
This patch adds unit test coverage for LUInstanceMultiAlloc.
Signed-off-by: Thomas Thrainer <thomasth@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Add unit test for LUInstanceRename
This patch adds unit test coverage for LUInstanceRename.
Add basic unit tests for instance import
This patch adds basic unit tests for instance import inLUInstanceCreate. It does not provide full coverage though.
Introduce GetMockLU and reduce use of _FakeLU
Introduce a new method of creating a mocked LU for tests, and reduce theuse of the legacy _FakeLU class.
Add unit tests for LUInstanceRemove and -Move
This patch adds unit test coverage for LUInstanceRemove andLUInstanceMove.
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...
Add unit test for LUGroupVerifyDisks
This patch adds unit test coverage for LUGroupVerifyDisks.
Add unit test for LUGroupEvacuate
This patch adds unit test coverage for LUGroupEvacuate.
Add unit tests for LUGroupRename
This patch adds unit test coverage for LUGroupRename.
Add unit tests for LUGroupRemove
This patch adds unit test coverage for LUGroupRemove.
Add unit tests for LUGroupSetParams
This adds unit test coverage for LUGroupSetParams.
Add unit test for LUGroupQuery
Provide unit test coverage for LUGroupQuery.
Add unit tests for LUGroupAssignNodes
Add unit test coverage for LUGroupAssignNodes, including the splitinstances check.
Add unit tests for LUGroupAdd
Provide unit test coverage for LUGroupAdd.
Move TestLUGroupAssignNodes to group_unittest.py
While moving the test, it is adapted to the new test framework.
Add test for LUClusterVerifyDisks
This LU only creates additional jobs as result, so this is a trivialunit test.
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
Signed-off-by: Thomas Thrainer <thomasth@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...
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.