Use node UUIDs for executing LU hooks
LUNodeAdd, the only LU using a node name still, is changed to overwritePreparePostHookNodes() and use node UUIDs only as well.This allows to remove the support for 3-tuples as results ofBuildHooksNodes() and removes the translation to node names....
Fix the test that checks for the order of instance's nodes
The test checks if the first node in the tuple is the primary node, butbecause it names the node so that it's the least one alphabetically, thetest always succeeds. This fixes the test.
Signed-off-by: Petr Pudlak <pudlak@google.com>...
Merge branch 'stable-2.9' into stable-2.10
Modify test to reflect RAPI operation changes
A rlib2 unittest tested for the wrong behaviour, and this patch changesthe inputs and expected values to account for this.
Signed-off-by: Hrvoje Ribicic <riba@google.com>Reviewed-by: Klaus Aehlig <aehlig@google.com>
Assign unique filenames to filebased disks
With the new format for cmdline arguments, the user is able to add adisk to an instance at a specific index. But filebased disks' filenameshave the form "{0}/disk{1}" where '{0}' is the file_storage_dir and'{1}' is the index of the disk. So if an instance has 3 disks and we...
query: fix detection of master in _GetNodeRole()
Commit 1c3231aa changed the invocation of _GetNodeRole() to pass themaster node by UUID and not by name, but didn't change theimplementation to compare the nodes by name. As a result, the masternode (which is also a master candidate) would always fall through to the...
Ensure that all the hypervisors exist in the config file
All the hypervisors are supposed to exist in the config file, but it might notbe so after upgrades from old versions. This patch ensures that all the missinghypervisors are added with their default values to the config file....
Fix testEncodeInstance test input
The input of the testEncodeInstance test was not adherent to the actual formatof the Ganeti configuration file: kvm has no HV_BLOCKDEV_PREFIX, and "hvparams" inside an instance should only contain the values of the hypervisor parameters,...
Merge branch 'stable-2.8' into stable-2.9
Add support for blktap2 file-driver
Newer Xen versions use blktap2 instead of blktap. This patch adds supportfor it in Ganeti.
Fixes Issue 638.
Signed-off-by: Michele Tartara <mtartara@google.com>Reviewed-by: Thomas Thrainer <thomasth@google.com>
Update tests
Update hypervisor unit tests.
Partial cherry-pick from d2e4e099e4248832fef8ed7b0755d01bd4178e3a
Signed-off-by: Jose A. Lopes <jabolopes@google.com>Reviewed-by: Michele Tartara <mtartara@google.com>
Introduce --hotplug-if-possible option
This will be useful for an external entity using RAPI thatwants to modify devices of instances.
The common use case for that is:"I want to add a NIC/disk to an instance. If it is runningthen try to hotplug the device. If not, then just add it to config."...
Allow instances to obtain externally reserved IPs
The administrator should be able to assign an externally reserved IPto a Ganeti instance manually, if desired. Currently this is notsupported. External reservations should act as holes in the pool andnot just as IPs already used by someone outside of Ganeti....
Don't allow optional node parameters
Ganeti does not support optional fields in parameters(hypervisor-params, disk-params, etc.). OpenVSwitch related nodeparameters were the exception to this rule, which caused numerousproblems related to import/export and (de-)serialization....
Fix docstring for ganeti.storage.filestorage_unittest.py
Signed-off-by: Santi Raffa <rsanti@google.com>Signed-off-by: Klaus Aehlig <aehlig@google.com>Reviewed-by: Klaus Aehlig <aehlig@google.com>
Check if hotplug is supported in CheckPrereq
Introduce new RPC hotplug_supported that invokes the correspondinghypervisor's method which checks if hotplug is generallysupported. Call this RPC early in CheckPrereq() and abort ifhotplug is not supported. Currently only KVM hypervisor with...
Hs2Py constants: add 'daemonsExtraLogbase'
Add constant 'daemonsExtraLogbase' to the Haskell to Python constantgeneration and update Python reference.
Signed-off-by: Jose A. Lopes <jabolopes@google.com>Reviewed-by: Klaus Aehlig <aehlig@google.com>
Add unittests for Hotplug support
Try base InstanceSetParams tests that modify instance'sdevices with hotplug=True.
Add some unittests for kvm hypervisor regarding runtime filemanipulation. Based on a sample runtime file search forspecific disk and nic entries based on their UUID....
Hotplug: cmdlib support
Hotplugging is done by functions invoked by ApplyContainerMods(). Inorder hotplugging to take place the --hotplug option must be passedotherwise the modifications will take place after reboot.
NIC hotplug supports add, remove and modify. The modify is done by removing...
Return link_name in blockdev_assemble rpc
Until now this RPC returned only dev_path. Since we use it inhotplug we have to know the simlink of the device so that wepass it to the corresponding hypervisor command and include itin block_devices entry in runtime files....
Fix unit test regarding recent changes in node_info RPC
This fixes a unit test in instance_storage_unittest.py,which was affected by the recent change in the RCP'node_info'.
Signed-off-by: Helga Velroyen <helgav@google.com>Reviewed-by: Hrovje Ribicic <riba@google.com>
Move orphaned unit tests to cmdlib/cluster_unittest.py
Through some merge from 2.9 to master, some unit testsin the file ganeti.comdlib.common_unittest.py wereno longer referenced in the Makefile and as such notrun anymore. With the introduction of the cmdlib test...
Merge branch 'stable-2.9'
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>
Add unit tests for LUBackupPrepare
This patch adds unit tests for LUBackupPrepare.
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....
cfg auto update: match ipolicy with enabled disk templates
This patch fixes issue 599. The problem was that with 2.9,a sanity check was introduced that made sure that theipolicies' set of disk templates is a subset of thecluster-wide enabled disk templates. In order to make...
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...
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.
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.
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....
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...
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...
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>...
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...
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 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.
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.