cmdlib: Extract storage related functionality
Split instance.py further by extracting storage related logical unitsand functions to instance_storage.py.
Signed-off-by: Thomas Thrainer <thomasth@google.com>Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>
Extract query related logical units from cmdlib
All LUQuery* classes are extracted to query.py.
Extract instance related logical units from cmdlib
All LUInstance* classes are extracted to instance.py. Common functionsare moved to common.py if used by non-instance logical units as well.Additionally, helper functions which are only used by LUBackup* and...
Extract node related logical units from cmdlib
All LUNode* classes are extracted to node.py. Common functions are movedto common.py if used by non-node logical units as well.
Extract group related logial units from cmdlib
All LUGroup* classes are moved to group.py. Common functions areextracted to common.py.
Extract cluster related logical units from cmdlib
All LUCluster* classes are extracted to cluster.py. Shared functions areextracted to common.py, helper functions only used by LUCluster* areextracted to cluster.py.
Signed-off-by: Thomas Thrainer <thomasth@google.com>...
Compatibility test for instances
This patch introduces a test to check the compatibilityof the Haskell and the Python representation of instances.
Signed-off-by: Helga Velroyen <helgav@google.com>Reviewed-by: Klaus Aehlig <aehlig@google.com>
Instance generators
This patch introduces and enhances generators forinstances:- 'genInstWithNets' is split into the generation of an arbitrary instance and enhancing an instance with nets- 'genInst' calls 'genInstWithNets' with an empty set of initial networks to provide a reasonable default...
Annotate every arbitrary instance field
The Arbitrary instance of the 'Instance' object is writtenusing the <*> syntax. Since it often uses the 'arbitrary'generator for the instance's fields it is hard to figureout which 'arbitrary' fills which instance field. This...
Generators for disks
This patch adds generators for Disk instances to the Haskelltest code. It uses somewhat more reasonable generators tofill the fields instead of just arbitrary values.'genDiskWithChildren' is a generator that generates a diskwith a specified number of disk children. To avoid shooting...
Disk templates are "allowed" and not "enabled" in ipolicies
The way disk templates were displayed in instance policies became confusingsince the introduction of the enabled_disk_templates cluster parameter.
Fix issue 440.
Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>...
Unit test for FillIPolicy keeping unknown keys
This makes sure that issue 401 doesn't come back.
Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>Reviewed-by: Helga Velroyen <helgav@google.com>
Add reason trail to haskell opcode format
The haskell type definition of opcodes should remain aligned with the pythonone.
Signed-off-by: Michele Tartara <mtartara@google.com>Reviewed-by: Helga Velroyen <helgav@google.com>
Add shelltests for hspace allocation
Both tiered and standard allocations are tested, with a single and a doublemin/max instance specification.
Unit test for cli.FormatPolicyInfo()
We try to parse the string obtained by formatting a policy, and see if weget the same policy.
Add command-line support for multiple specs in ipolicy
Command line options accept multiple min/max specifications in instancepolicies. The output of show-ispecs-cmd is updated accordingly.
Add multiple min/max specs in instance policy
Now instance policies can contain more than one min/max specs. This is themain element of the "Constrained instance sizes" section in the"Partitioned Ganeti" design doc.
This is a big patch, but changing the type of a configuration item requires...
Separate checks for std spec compliance
This is needed to be able to validate the std spec against multiple min/maxspec pairs (appearing in next patches).
Merge branch 'stable-2.7' into stable-2.8
Conflicts: NEWS doc/rapi.rst
Signed-off-by: Klaus Aehlig <aehlig@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Reason trail implementation for "start"
Opcode-specific implementation of the reason trail for the instancestartup operation.
Signed-off-by: Michele Tartara <mtartara@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Reason trail implementation for "shutdown"
Opcode-specific implementation of the reason trail for the instance shutdownoperation.
Add unit tests for cfgupgrade with a real configuration
Test upgrade and downgrade from a realistic 2.7 configuration.
Split functions in cfupgrade unit tests
This makes easier to test real configurations.
Limit specs in ipolicy command lines are always complete
Command line options are brought in line with the specs change of previouspatch. Old options are still allowed in gnt-cluster init, where thesemantic will remain non-ambiguous even after introducing multiple specs....
Refactor tests in ipolicy validation
This makes the code more modular, in preparation for the following patches.
Limit specs in instance policies are always complete
Specs used to specify limits in instance policies are always complete, evenat group level (only the whole limit set can be overridden). This is inpreparation for introducing multiple limits.
Add --ipolicy-xxx-specs options
These options allow to specify whole instance policy specs. This is neededfor the upcoming changes that tend to threat specs as monolithic objects.
Add command to print ipolicy options
The output of this command can be used to create an exact copy of thecurrent instance policy specs. The command could be expanded to print allthe options used to create a group or the cluster.
New CLI input type: list of key/value pairs
This will be used for the new instance specs options.
Allow "default" as a value for ipolicy templates
Previously the string value was being corrupted.
Extend the simulation backend to also simulate a master node
In a simulated cluster as created by the simulation backend tothe htools, make the first node of the first node group the masternode. In this way, hools (like hroller) that require a master node...
Add unit tests for hroller
Add a unit test for hroller in a situation where the orderis completely determined. There are 3 nodes where node 2 has,for each of the other nodes, an instanced shared with it. Sonode 2 has to be a reboot group of its own. There are no more...
Reason trail implementation for instance reboot
This commits allows ganeti to correctly forward the reason trail informationregarding instance reboot.
Remove old "reason" implementation
Remove the useless parts of the old, partial, implementation of the support fortracking the reason of instances state change, before implementing the newreason trail support, as per the design document.
Signed-off-by: Michele Tartara <mtartara@google.com>...
Make hroller insist on finding precisely one master node
As people rely on the master node being the last node of the lastgroup, make hroller fail, if no master node could be found in thecluster. This happens, e.g., if a backend format is used that does not...
Add nic/disk name and UUID fields in Haskell code
Add name and uuid fields to Disk and nic Haskell objects. Also,since they now have an UUID, make them instances of UuidObject.
Signed-off-by: Christor Stavrakakis <cstavr@grnet.gr>Reviewed-by: Helga Velroyen <helgav@google.com>
Add name to INicParams and IDiskParams
This commits adds name to NIC and Disk modification definition.
Signed-off-by: Chris Stavrakakis <cstavr@grnet.gr>Reviewed-by: Helga Velroyen <helgav@google.com>
Update QA tests to check disk and NIC names
Modify existing tests to use the name option for instance disks. Theconfiguration options 'disk' and 'disk-growth' are merged into a single'disks' option, which is a list of dictionaries with 'size', 'growth' and...
Check that device names are unique and valid
Extend the CheckArguments phase of LUInstanceCreate and CheckPrereqphase of LUInstanceSetParams to also check if the name parameters ofdisks and NICs are unique and valid.
Signed-off-by: Christos Stavrakakis <cstavr@grnet.gr>...
Support UUIDs and names when refering to a device
Modify _ApplyContainerMods function to lookup NICs/Disks not only by theirindex inside the container, but also by their UUID or name. Abstract thelookup code in new GetItemFromContainer function.
Make type of identifier in "opcode._TestInstSetParamsModList" to be...
Move HooksMaster out of the mcpu module
We need to do this, so that backend.py doesn't need to import mcpu, andthus indirectly cmdlib. This reduces the size of the node daemon byabout half, which is very important as it is pinned in memory.
This solves Issue 419....
QA: Decision about disk templates to use is more modular
qa_config.IsTemplateSupported() is already used to decide which disktemplates are supported by QA. Enabled templates now are part of thatdecision.
Unit tests are updated.
Adapt test data to changed ipolicy format
The test data for hail allocating a multi-disk instance wasoriginally added in the 2.7 branch. On master the formatof the ipolicy had changed; "min" and "max" are no longertop-level of the ipolicy, but instead below the "minmax"...
Merge branch 'devel-2.7'
Removes obsolete 'enabled storage types'
Since managing of different storage units is now done usingdisk templates and not storage types, we remove the obsoleteenabled storage types.
Signed-off-by: Helga Velroyen <helgav@google.com>Reviewed-by: Michele Tartara <mtarara@google.com>
gnt-cluster modify: modify enabled disk templates
Adds setting of the list of enabled disk templates to 'gnt-cluster modify'.Note that this does not yet include any verification regarding disk templatescurrently used by instances.
Signed-off-by: Helga Velroyen <helgav@google.com>...
Add shelltests verifying hail applies disk ipolicy per disk
We test on two minimal examples, a positive and a negative one, wherethe possibility to allocate a node depends on whether the disk policyis checked on a per-disk level or on the total amount of disk space...
Make the disks parameter available to the constructor
In that way, tools building on Instance will benefit from the correctedverification semantics of the instance policy on disk space.
Properly export errors while reading job list
In case of problems while reading the job list from disk (such as permissionerrors) confd would silently fail, writing a warning on the log file butsending an empty list and no error message to the client....
Fix a bug in the Runtime tests
A group name was erroneusly inserted in the list of user names.
Add parameter pnode to OpInstanceSetParams
This parameter will be used to set the new primary nodeof an instance, assuming that the disks have been movedby other means (outside ganeti's control).
Unit tests for config.ConfigWriter.VerifyConfig()
The test is aimed mostly at instance policies, which changed recently.
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.
cfgupgrade: Add --downgrade option
It's now possible to go back to the previous stable version. Unit testsprovided.
This is mostly useful during development, when going from master tostable/devel.
Unit test for cli.CreateIPolicyFromOpts()
Useful for subsequent patches.
Generic function to print data for gnt-xxx info
The function produces a human-readable output, which is also a valid YAMLfile, from an intermediate data structure. This will be used by "gnt-xxxinfo" commands. The output of "gnt-xxx info" was almost YAML-compliant, and...
Fix bug in rlib2 unit tests
The "queryargs" parameter of the init function of rlib2 classes shouldbe a dictionary, as defined in the ResourceBase parent class (inlib/rapi/baserlib.py).
In the rlib2 and baserlib unit tests, when the queryargs parameter is not...
gnt-cluster modify: dis/enabling storage types
This patch extends the 'gnt-cluster modify' command to manipulate the listof enabled storage types. Note that this currenlty does no validationwith respect to whether or not there are instances currently using a storage...
Add the core of the monitoring daemon
This commit adds the core infrastructure of the monitoring daemon,and integrates it in the build and test systems.
The actual functionality of the monitoring daemon is still completelymissing.
Add Mond to the list of possible daemons
Also, add its logfiles and extra log files.
Signed-off-by: Michele Tartara <mtartara@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Add infrastructure for allowing additional logfiles
Some daemons will need more than the single logfile that is currentlyallowed. This patch introduces the infrastructure to allow this.
Make gnt-node list -o(p|s)inst_list output stable
Currently, both the Python and Haskell code return the internalinstance list unsorted, which means the output can vary depending onthe phase of the moon (well, the Haskell code actually uses internallya tree, sorted by the instance name, but it's implementation detail)....
Expand TestHelper to allow non-underscore prefixes
HLint 1.8.28 requires us to always add "ignore CamelCase", which canbe problematic sometimes (e.g. when using OverloadedStrings). Let'sexpand TestHelper to also support less-standard 'caseFooBar' names, so...
Change to CamelCase format in Test/Ganeti/Objects.hs
This is in preparation for using OverloadedString extensions in thisfile, which conflicts with hlint 1.8.28's handling of annotations.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Helga Velroyen <helgav@google.com>
Add simple Ip4Address/Ip4Network types
This patch adds some very simple IPv4 address/network types, and usesthem in the 'Network' config object.
We need these in order to properly compute the reserved IP addresses,without depending on an external library (which I haven't found, by...
Unit tests for objects.InstancePolicy + a fix
Tests for: objects.InstancePolicy.CheckParameterSyntax() objects.InstancePolicy.CheckDiskTemplates() objects.InstancePolicy.CheckISpecSyntax()
Instance policies with an empty disk-template list now are reported....
Unit tests for objects.FillIPolicy() + small fix
IPOLICY_DEFAULTS is now a legal policy (the disk-templates entry was a setinstead of a list, before).
Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Fix upgrade of policy in objects.Cluster
Unknown elements were silently removed on startup. This means that asoftware upgrade could result in lost configuration information ifcfgupgrade wasn't run promptly.
Added unit test for Cluster.UpgradeConfig() to cover this case....
Fix instance policy checks for default back-end parameters
Policy violations of back-end parameters that used the cluster defaultvalue were not reported in cluster-verify.
Unit tests for cmdlib._GetUpdatedIPolicy()
Not 100% coverage, though.
Fix policy check for disk templates
Instance disk template is checked against the policy, and disklessinstances aren't checked for the number of disks.
Conflicts: Makefile.am (curl changes and new hs directories)...
Expand Haddock to run over test files as well
This patch does multiple enhancements to the way we build the Haddockdocs, motivated by the fact that if we don't run Haddock over testfiles as well, bad formatting can be submitted and will accumulateover time (without any checks)....
Switch LispConfig double comparison to relative error
This further improves the comparison for "non-trivial" numbers. Without this patch, there are still cases where the absoluteerror is too big, and we need to switch to relative error.
Concept has been taken from...
Make the XmParser config test runtime more consistent
Currently, the test uses a frequency of 5 string/5 double/1 list forgenerating Arbitrary instances of ListConfig. However, the list casehas simply a "choose (1, 20)" `vectorOf` arbitrary, which means it...
Improve output of the XmParser config test
Currently, this tests and its helper function 'isAlmostEqual' usesplain booleans to signify failures, which means you can't really debuga failed test. The patch changes the call chain to use annotatedproperties all through, which results in messages like:...
Fix node partial name matching in Haskell code
This implements QffHostname and fixes the node listing (as well asexport listing when filtering on node name).
This bug was hidden by the fact that node listing with "gnt-node listaa" works if you don't have live queries (as it was originally), as...
Fix bug in group queries related to node/instance fields
Since we use the primitive string type for group UUIDs, the groupfields have a bug where we pass the group name as filter for nodetests, whereas the nodes themselves use the group UUID. This results...
Rename/make uniform the other query entities
Following the new naming style introduced in Exports.hs, this patchrenames the other resources to export non-qualified names (fieldMap asopposed to nodeFieldMap), and to use qualified module imports.
Also fixes a haddock issue in a docstring....
Add export lists for files which didn't have them
Two test helper files didn't have export lists (lost during the splitof tests). This patch finally reintroduces them, to hopefully make theexport list saner and with fewer changes for purely-internal changes....
Fix Haskell compatibility tests with disabled file storage
When file storage is disabled at ./configure time, we shouldn't passopcodes containing DTFile/DTSharedFile/StorageFile to Python forvalidation, as they will fail.
This patch implements this by simply tweaking the Arbitrary instances...
Allow rpc.MakeLegacyNodeInfo to parse non-LVM results
'MakeLegacyNodeInfo' is not the best place for this, but we'd have toduplicate it if we wanted a LVM-less version, so the easiest is to addan optional parameter that allows it to accept/skip LVM-less results....
Test AsyncStreamServer with abstract unix sockets
This was meant to be since "the beginning" but was never submitted assomehow it failed with python 2.4. Now that the minimum python versionhas been increased it can be added.
Signed-off-by: Guido Trotter <ultrotter@google.com>...
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”....
Fix style violations in commit 4a90bd4, small changes
- Commit 4a90bd4 contained a rather large number of style violations: - Indentation/sequence formatting - Wrapping of long lines - Docstrings whose first line was wrapped - A stray backslash in a docstring...
RAPI: Add flag to require authentication
Most RAPI resources do not require authentication for the “GET” method.In some setups it can be desirable to always require authentication.This patch adds a command line parameter to always require it.
Some unrelated minor typos in the “ganeti-rapi” man page are also fixed....
Remove test of obsolete getNetworkUuid method
This will remove the tests for the getNetworkUuid method.The method will be obsolete after the changes regardingidentification of networks by UUID and not name are mergedinto master. Will send another patch for removing the...
Simplify RPC error cases
This patch removes the node from the RPC error constructursCurlLayerError and OfflineNodeError. The rationale is that we anywayreturn tuples (node, result), and removing this duplication allowssimplified signatures/calls in the execution of RPC calls....
Add two utility functions for handling Either lists
These two functions permit operating in bulk on only the Left or Rightvalues in the original list, then reassembling the list back in theoriginal order.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Michele Tartara <mtartara@google.com>
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.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>
qa_config: Add repr for instance/node classes
Having a readable representation makes debugging easier.
Test "GetNodeInfo" for Xen hypervisor
This patch adds unit tests for success and failure of the “GetNodeInfo”method for the Xen hypervisor abstractions.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Helga Velroyen <helgav@google.com>
QA: Add validation for cluster name
baserlib: Make "_OPCODE_ATTRS" public
"_OPCODE_ATTRS" will also be used in the Sphinx extension.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Helper to retrieve access permissions for RAPI resource
Merge similar code into a helper function.
Status change reason support for Reboot
Add support to the Reboot command for specifying the reason for the laststatus change.
Some features are implemented as functions, even if used only once, becausethey will be used by the future patches introducing reason support for all...