Refactor ispecs in ipolicy structures
Minimum and maximum instance specs are put together into a single elementof the instance policy. This is in preparation for introducing multiplemin/max specs.
Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>...
QA: Fix assertion
The assertion was always true because "all" was missing.
Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>Reviewed-by: Helga Velroyen <helgav@google.com>Reviewed-by: Michele Tartara <mtartara@google.com>
gnt-instance info uses a revised format
The code is more modular and the output is YAML-compliant. QA updated totake advantage of it.
Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>Reviewed-by: Helga Velroyen <helgav@google.com>
gnt-cluster info uses a revised format
The code is more modular and the output is YAML-compliant.
Added function in QA that uses PyYAML to parse the command output, and QAis updated to take advantage of it (instead of using lots of complicatedREs).
QA: Extend cluster QA wrt enabled storage types
This extends the QA scripts to test the changes in 'gnt-cluster init','gnt-cluster info', and 'gnt-cluster modify' with respect to enabledstorage types.
Signed-off-by: Helga Velroyen <helgav@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Add constants for storage types to constants.py
This patch adds the currently known and used storage methods to theconstants.py file. Note that storage types are different from disktemplates. For example both disk templates, drbd and plain, use lvmstorage types....
Fix QA: skip reinstall for diskless instances
Diskless instances cannot really be reinstalled, not even through RAPI.
Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Merge branch 'devel-2.7'
Add QA for instance creation with policy violation
When instance policy is violated, creation fails.
Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Add QA for policy-instance interactions
Violations on policy changes are checked.
Add QA for cluster policies
qa_cluster.TestClusterSetISpecs() is exported as it will be used in futuretests.
Fix restoring default instance specs in group policies
"default" was not accepted as a valid input value for instance specs ingroup policies, due to a bug introduced in 2cc673a3e (and released with2.6.0). Added QA for this and another similar case.
Fix QA with disabled file storage
Currently QA tries to use “gnt-node list-storage” with all storagetypes, but when file storage is disabled this will fail.
The patch changes it so that if file storage is disabled, we test thatindeed fails, and otherwise we include it in the regular tests....
QA: Support diskless instances
This is an initial implementation of diskless instances.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>
QA: Compare ipolicy directly with None
If a value was set to numeric 0, the parameter wouldn't be passed to thecommand.
QA: List all ipolicy options in example configuration
This makes it easier to know what options are available.
QA: Update assertion for diskless instances
QA: Disable reinstall test for diskless instances
QA: Fix dictionary formatting
Make it match the style guide.
QA: Disable drbd-offline test if no DRBD instance is used
If “instance-add-drbd-disk” is not enabled it usually also means to notuse DRBD at all.
QA: Disable RAPI tests for virtual clusters
The QA script connects to the RAPI daemon. In virtual cluster setups thedaemon is usually listening on a local interface not reachable from theoutside.
QA: Add virtual cluster support to queue drain test
The path to the queue drain file must use the virtual node path.
QA: Disable copyfile test for virtual clusters
This test will need some more work for virtual clusters. Disable it inthe meantime.
QA: Disable OOB tests for virtual clusters
They do not work properly at the moment.
QA: Update virtual node's RAPI users file
The file is located below the virtual node directory.
QA: Read virtual node's RAPI certificate
The virtual node prefix must be added to the path.
qa_os: Disable checks for virtual clusters
The OS definitions are not virtualized. Tests configuring different OSdefinitions on different nodes don't work properly.
qa_instance: Virtual cluster support for instance list
Use path of virtual node when retrieving ssconf's instance list.
qa_daemon: Virtual cluster support
Use virtual node path when removing the watcher status file.
qa_utils: Support virtual cluster for backup files
“qa_utils.BackupFile” is always called with the path for a normal node.In virtual clusters the node prefix path must be added.
qa_utils: Virtual cluster support for SSH commands
In virtual clusters, all “gnt-*” and “ganeti-*” commands requireenvironment variables to be set for the virtual cluster root directoryand node name. The “cmd” script generated by “vcluster-setup” is awrapper setting those variables....
qa_config: Support callable test checks
Until now all tests depended on simple AND/OR conditions. With theintroduction of virtual cluster support, some tests can only run ifvirtual clusters are not in use (e.g. not yet supported or notpossible). Instead of introducing more logic for enabling/disabling...
QA: Add config entries for virtual cluster
If these new options are set, a virtual cluster is created and used.Virtual clusters consist of 1..N virtual nodes on a single physical (orvirtual) node. The design of virtual clusters is described in“doc/design-virtual-clusters.rst”....
qa_config.AcquireNode: Use sort key function
Use a sort key function instead of using a comparing function (“cmp=…”).The latter is not supported in Python 3 and using a sort key function iseasier.
qa_config: Add repr for instance/node classes
Having a readable representation makes debugging easier.
QA: Add validation for cluster name
QA: Acquire instance via method
Also make “used” a property.
QA: Set disk template directly via instance object
Use a method on the instance object instead of going through“qa_config.GetInstanceTemplate”. This provides for better encapsulation.
Remove qa_config.GetInstanceNicMac
Call the wrapped instance method directly.
QA: Use constants for disk templates
Disk template names shouldn't be hardcoded.
Fix a merge issue in 3c296f56
Lines removed in devel-2.7 (250a9404) weren't removed in the merge withmaster.
QA: Support additional arguments for initialization
In some scenarios it can be useful to add more arguments to “gnt-clusterinit”, such as “--no-drbd-storage”, if DRBD is not installed.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
qa_utils: Fix order of arguments passed to _AssertRetCode
QA: Remove dictionary-like interface from config objects
These are no longer used.
QA: Drop dictionary support from qa_utils._GetName
This is no longer needed now that instance/node objects in QA haveattributes. Use a helper function instead to retrieve an entity'sidentifying attribute.
Signed-off-by: Michael Hanselmann <hansmi@google.com>...
QA: Convert instances from items to attributes
The new objects support attributes. Item access (like a dictionary) isgoing away in a couple of patches.
QA: Convert nodes from items to attributes
The new objects support attributes, which are cleaner thandictionary-style access. Item access (like a dictionary) is going awayin a couple of patches. Also, pylint is better at checking attributesthan dictionary entries....
QA: Release nodes through method
Instead of having a module-level function in “qa_config” to release anode, a new method on node objects is used.
"exclusive_storage" cannot be changed on single nodes
There's never been support for a configuration where nodes in the same nodegroup have different values of the exclusive_storage flag. This patchdisables the possibility to change the flag for individual nodes....
QA: Convert nodes to objects
Up until now nodes were stored as a dictionary. The keys were hardcodedin a lot of places and entries modified directly.
This patch introduces a new class for nodes in QA named “_QaNode”. Itstill supports accessing details via dictionary syntax, but that will be...
QA: Release instances through method
Instead of having a module-level function in “qa_config” to release aninstance, a new method on instance objects is used.
QA: Convert instances to objects
Up until now instances were stored as a dictionary. The keys werehardcoded in a lot of places and entries modified directly.
This patch introduces a new class for instances in QA named“_QaInstance”. It still supports accessing details via dictionary...
QA: Release instance in ganeti-qa
Release instances directly from “ganeti-qa” instead of doing so in thethree tests removing instances. This is in line with how nodes arereleased and makes it easier to find and debug double-release issues.
QA: Stop using "in" operator for node
The new configuration object for nodes will not support it anymore.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Helga Velroyen <helgav@google.com>
QA: Support entity objects in qa_utils._GetName
This is a temporary solution until nodes and instances are converted toobjects with attributes.
qa_config: Simplify IsTemplateSupported
The same code can be written in a single expression. The earlier patchnamed “Refactor storage of runtime exclusive storage flag in QA”provided the unit test.
Refactor storage of runtime exclusive storage flag in QA
This is a follow-up for “qa_config: Remove exclusive storage flag fromconfig”. Instead of storing the flag in a module-level variable it isnow stored within the new QA configuration class and unit tests are...
Refactor QA configuration code
Ever since its introduction (sometime before commit cec9845 in September2007), the QA configuration was stored in a dictionary at module-levelin “qa/qa_config.py”. The configuration was loaded, verified andevaluated using module-level functions. Since then the configuration has...
qa_config: Remove exclusive storage flag from config
Commit 6a0f22e added the ability to track the status of the cluster-wideflag for exclusive storage. It did so in a way which modifies thein-memory configuration dictionary. This patch changes the code to use a...
Redirect output for gnt-* list/list-fields commands
This enabled the redirection; QA output after this patch should becomemuch much smaller (on a 'quick' QA, we are left with ~0.5MB output onstdout and 64MB redirected output).
Signed-off-by: Iustin Pop <iustin@google.com>...
Add function to execute QA commands with redirected output
Some QA commands generate non-trivial output: for a full QA, the gnt-*list commands generate more than 300MB of data. To make the QA logsmore parseable by humans, we need support for redirecting output of...
Implement option to skip logging of QA commands
This patch adds an optional kwarg that allows skipping the "Command:…" line in QA output. This is helpful if we only need to run somemaintenance actions, that are QA-related and not Ganeti-related.
QA: Clean up after "instance-remove-drbd-offline" test
This test used to leave a node with orphan logical volumes and unused DRBDminors. Now, the expected leftovers are cleaned up after the test, andcluster-verify is run.
qa_config: Remove useless "options" variable
It is only used in one place and not necessary.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
QA: Run instance tests with different cluster configurations
Instance tests are run with or without the exclusive-storage flag set. Moreconfigurations can be added easily.
Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
QA: Instance tests check the configuration before running
Instance test functions check the current configuration, and they will runthe actual tests only if the configuration supports them. This will beused for refactoring in following patches.
QA: Use lists of nodes as argument to instance tests
Some instance test functions took two node arguments, some took one, andsome took two but the second argument could be None. This patch makes suchfunctions uniform by using a list of nodes as an argument. This simplifies...
QA: Refactored launching of the various instance tests
The code launching instance tests for "plain" and "drbd" templates has beenunified. In this way it's easier to add more templates, and to re-use the sametests with different configurations.
QA: Run cluster-verify after instance tests
We want to make sure that instance operations don't leave the cluster in abad state. The "instance-remove-drbd-offline" test leaves some debrisbehind, so it's been moved to the last position.
QA: Added functions to allocate/free N nodes at once
These make possible to simplify the logic of tests requiring morenodes. Used in the following patches.
QA: Added exclusive_storage to qa_config
QA configuration now tracks the state of the exclusive_storage flag atcluster level. This will be used to selectively enable tests according tothe configuration.
Also, it's now possible to specify the initial value of the...
QA fix: TestInstanceExportWithRemove() updates configuration
When the instance is removed from the cluster by this test, it's also freedin the QA configuration.
QA cleanup: Removed instance-disk-failure test
The test was broken, out of sync with the rest of the code, and prone tocrashes. Until someone does a better job, it's better to remove thetest. This simplifies further refactoring.
QA: Added disk template to config
The disk templates used by the instances are tracked in the QAconfiguration. This will be used to selectively enable tests according tothe configuration.
QA: Better initialization of a global dictionary
The global 'cfg' variable is initialized to an empty dictionary, so thereis no more need to disable some pylint checks.
QA: Cluster-verify reports shared PVs with exclusive storage
Exclusive storage forbids sharing PVs between unrelated LVs. This is a testthat cluster-verify correctly report such cases.
Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>...
QA: Added constants for LVM volumes
The LVM volume group becomes a configurable parameter, and a prefix forlogical volume names used in tests is introduced as a constant.
QA: Templates incompatible with exclusive storage reported
Cluster-verify should report instances whose disk template is notcompatible with the exlusive storage setting.
QA: Uniformity check for exclusive_storage in cluster-verify
Cluster-verify should report nodes in the same nodegroup with differentvalues of the exclusive_storage flag.
QA: Test for basic features of exclusive storage
Check that creation of instances doesn't trigger any error.
QA: Added function to read cluster configuration fields
This function will be used in following patches.
QA: Added function to check cluster-verify result
Now it's possible to check that cluster-verify reports all the expectederrors, instead of simply checking that it fails.
Network QA
This adds a script for the QA of 'gnt-network'. So far itcovers adding/removing and connecting/disconnecting networks.
Signed-off-by: Helga Velroyen <helgav@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Fix syntax error in QA's sample config
The additional comma makes this file invalid JSON.
Merge branch 'devel-2.6'
QA: Use instance name for rename test
Reported in issue 341. In some setups the instance live in a differentnetblock from the cluster. Therefore a the configuration-global “rename”name shouldn't be used for them. Instead another instance name is used....
QA: Factorize retrieving non-existent groups from config
Also add a check to make sure there are enough groups defined.
QA: Support master-netdev and default NIC parameters
Requested in issue 337.
The parameter “bridge” was not documented and is therefore silentlyreplaced with “master-netdev”. A note is added to “qa-sample.json”describing how comments work.
This is a cherry-pick of master commit...
QA: Do not pass "--bridge" to "gnt-cluster init"
Commit ec0652a (June 2009) removed the option.
This is a cherry-pick of master commit784537390cd5b1c4f5f8fb9401a62eb23acce39b
Fix QA for --offline semantics modification
The previous patch series made it simpler to deal with ERROR_up offlineinstances, but didn't fix qa, that had the old expectations. This fixesthat, and adds more testing about the expected behavior.
Signed-off-by: Guido Trotter <ultrotter@google.com>...
Replace frozenset with compat.UniqueFrozenset
This is not a trivial s/frozenset/compat.UniqueFrozenset/, but ratheronly replaces “frozenset” where appropriate. Most of the places are“static” information that doesn't change after the module has beenloaded....
Remove some unused Python code
This patch removes code which is no longer used due to refactoring:
- http.InitSsl, last usage removed in commit 33231500 (“Convert RPC client to PycURL”)- rapi.baserlib.MakeParamsDict, last usage remove in commit 4e5a68f8...
Fixes and improvements to comments
Some fixes, added more information in a few points, removed a stale (5+year old) TODO comment.
Fixes to pass pep8 (make lint)
Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>Reviewed-by: Iustin Pop <iustin@google.com>