Reason trail implementation for "shutdown"
Opcode-specific implementation of the reason trail for the instance shutdownoperation.
Signed-off-by: Michele Tartara <mtartara@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
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.
Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>Reviewed-by: Helga Velroyen <helgav@google.com>
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.
Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>...
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.
Make burnin compatible with the reason trail
The burnin uses its own option list, different from the one of all othercommand line programs, and uses it as a parameter to a function that nowrequires the "--reason" option to be present.
This commit updates the burnin option list to be compatible with the reason...
Reason trail implementation for instance reboot
This commits allows ganeti to correctly forward the reason trail informationregarding instance reboot.
Signed-off-by: Michele Tartara <mtartara@google.com>Reviewed-by: Helga Velroyen <helgav@google.com>
Add "reason" as a common parameter for all the RAPI calls
Also, this add an infrastructure for having parameters common to all theRAPI calls.
Add infrastructure for adding common RAPI parameters
Some parameters can be common to all the RAPI calls: this commitadds the possibility of specifying them just once, instead ofmanually adding them to the classes describing each call.
Signed-off-by: Michele Tartara <mtartara@google.com>...
Add job_id and index to the reason trail
The reason trail will contain an item indicating the job_id and theindex number of the current opcode inside the job queue.
Add the reason trail to the opcodes
The reason trail is available for all the opcodes, and as such it isinitialized as a generic option.
Add a field to store the reason trail in OpCodes
The reason trail will be available for all the OpCodes, so the field thatis to contain it has to be added to the OpCode base class.
Provide "--reason" as a parameter for all commands
Add function for extending the reason trail
Noded functions will have to extend the reason trail specifying whatoperation is being executed.
This commit adds a function for doing that (will be used by future commits).
Add an opcode name conversion function
Add a function to convert an opcode class name to a source string for thereason trail, factoring out the code in common with the existing _NameToIdfunction.
Add function for storing the reason trail of an instance
We are interested in storing the reason trail for operations that changedthe state of instances. This commit adds a function to do this.
Also, the GetInstReasonFilename() function name is prepended with an...
Add function for getting the timestamp in nanoseconds
The timestamp is returned as an integer number of nanoseconds since the Unixepoch.
Add TMaybeList as a new type for parameters
This will be used as the type for the reason trail parameter.
Add constants for the reason trail implementation
A few constants are required, describing the source reason of the opcode.
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.
Display UUIDs and names in gnt-instance info
Modify gnt-instance client to display the UUID and namefields of instances disks and NICs.
Signed-off-by: Christos Stavrakakis <cstavr@grnet.gr>Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>Reviewed-by: Helga Velroyen <helgav@google.com>
Add Disks and NICs to _AllUUIDObjects
Since disks and NICs have UUIDs, they must be consideredto _AllUUIDObjects.
Support quering for devices names and UUIDs
Extend instance queries to list 'uuid' and 'name' fields of instance'sDisks and NICs.
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>...
Implement renaming Disks and NICs
Implement renaming Disks and NICs in LUInstanceSetParams. Remove codethat checked that changing disk mode was the only disk modificationsupported. Also, handle case of 'None' value for 'name' parameter.
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...
Support UUIDs and names when handling NICs/Disks
Handle UUID and name fields when creating/managing NICs and Disks. Also,export NICs and Disks names to instance hooks environment.
Signed-off-by: Christos Stavrakakis <cstavr@grnet.gr>Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>...
Add IDISK_NAME and INIC_NAME constants
Declare IDISK_NAME and INIC_NAME constants and add them to theIDISK_PARAMS_TYPE and INIC_PARAMS_TYPE.
Add uuid and name slots to Disk/NIC ConfigObjects
This patch adds "uuid" and "name" slots to Disk and NIC ConfigObjects.
Merge branch 'devel-2.7'
Removes the 'sharedfile' storage type
Since storage type are supposed to represent the underlying technologyof disk templates, the storage type 'sharedfile' is superfluous, becausetechnically both disk templates 'file' and 'sharedfile' use the file system....
Consistency checks for config wrt disk templates
This patch adds consistency checks for the configuration regardingdisk templates. In particular, it checks that the list of enableddisk templates is not empty, does not contain any bogus templates,and that all instances use actually enabled disk templates....
gnt-instance: no instance creation with disabled templates
This patch makes sure that no instances can be created which usedisk templates which are not enabled on the cluster.
Signed-off-by: Helga Velroyen <helgav@google.com>Reviewed-by: Michele Tartara <mtarara@google.com>
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.
gnt-cluster init: enabling of disk templates
This patch enhances 'gnt-cluster init' to accept a list of disk templatesto be enabled. It removes the list of enabled storage types.
gnt-cluster modify: verify instance's disk template usage
Adds a verification step to 'gnt-cluster modify' to make sure that nodisk template is disabled that is currently in use by at least one instance.
Signed-off-by: Helga Velroyen <helgav@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.
gnt-cluster info: report enabled disk templates
Add reporting of the currently enabled disk templates to'gnt-cluster info'.
Add enabled disk templates to cluster cfg
This patch adds constants for enabling disk templates to the constants,and the cluster configuration in haskell and python. It removes theobsolete preference list for enabled storage types.
Properly update iv_name of disks while changing templates
Trasforming the disk of an instance from DRBD to plain did not properlyupdate the iv_name of disks, leaving it to None.
This commit modifies _ConvertDrbdToPlain to properly set the iv_namevariables....
Check minimum size of networks on creation
When creating a network, so far no size constraints were checked.We now limit the size of a network to a /30 or bigger, althoughtecnically, the ipaddr library supports even /32 networks.
Limit the size of networks to /16
This patch introduces an upper limit to the size of the networks that canbe created.
Signed-off-by: Helga Velroyen <helgav@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Fix job queue directory permission problems
If split users are used, the queue directory could only be accessedby masterd, but also confd needs to be able to read it, e.g. when itis queried as part of "gnt-job list"
This commit fixes the permissions in such a way to allow proper access rights....
The disk size of a diskless instance is 0, not None
For diskless instances it is still reasonable to sum up the disk usageof all the (zero) disks, resulting in the empty sum. This uniformityalso has the advantage that iallocators (like hail) do not have to do...
Postpone non-urgent TODO from 2.7 to 2.9
gnt-group info uses a revised format
The code is more modular, the output is more similar to "gnt-cluster info" and is YAML-compliant.
gnt-node info uses a revised format
The code is more modular, and the output is YAML-compliant. QA has beenupdated to reflect the new format.
Remove unused code
After changing the way gnt-xxx info print their output,cli.FormatParameterDict() is not used anymore.
Refactor out function to format instance policy
The new function can be used for group-level instance policies. Support forroman numeral formatting has been dropped to make the code simpler. Forother info items it's already unsupported, and it's not exactly documented...
Fix help string for gnt-group info
Restrict instance move to templates based on local files
Moving an instance is done by copying over the disks. Restrictthis to disk templates that are copyable. This avoids accidentaluse on, e.g., the sharedfile template.
Signed-off-by: Klaus Aehlig <aehlig@google.com>...
Introduce a constant for the copyable disk templates
This list contains the disk templates suitable for movingan instance by copying the files. A requirement is thatthey're not accessed externally or shared between nodes;in particular, sharedfile is not suitable....
Do not _RemoveDisks after failed _CreateDisks
Now that _CreateDisks cleans up after itself in case of failure,do not clean up at call sites, as there we have to overapproximatethus potentially causing data loss.
Make _CreateDisk clean up partially created disks on failure
_CreateDisk used to just throw an exception if _CreateBlockDev failedleaving the caller in the state that some disks were created, withoutprecise knowledge which. Usually, the clean up then overapproximated...
Fix typo in an error message
Add option --new-primary to gnt-instance modify
Extend gnt-instance modify by a new parameter --new-primarythat sets the pnode paramter of the opcode.
Signed-off-by: Klaus Aehlig <aehlig@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Make LUInstanceSetParams handle pnode parameter
If pnode is set LUInstanceSetParams now sets the primary nodeaccordingly. Unless force is set, it is verified that the instanceis no longer running on the old node.
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).
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.
Configuration is verified on load
If there are errors in the configuration when master daemon is started,they are now logged and reported. Previously they were logged sometimes atstartup, and when performing any change to the configuration.
Refactor cli.CreateIPolicyFromOpts()
The code relative to instance specs has been moved into a differentfunction. This in preparation for further patches to have a more clear codestructure.
Remove duplicate filling of instance policy
Instance policy fields were manually filled in CreateIPolicyFromOpts() andthen filled again by the caller. Now they are filled once inside thefunction.
gnt-instance info uses a revised format
The code is more modular and the output is YAML-compliant. QA updated totake advantage of it.
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).
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...
Remove use of deprecated function
cgi.parse_qs() is deprecated in python 2.6 and substituted byurlparse.parse_qs().
This patch modifies the code to use the new function.
gnt-cluster modify: limit storage type consistency check
This fixes the currently broken Q&A. The consistency checkfor storage types is now only run when the 'enabled_storage_types'are actually changed by 'gnt-cluster modify'.
Check if instances use disk templates that get disabled
When disk templates get disabled via 'gnt-cluster modify', so farwe did not check if any instances still use a disk template of thattype. This patch adds the necessariy check.It also includes adding a map of disk templates to storage types...
Upgrade configuration wrt enabled storage types
This implements an online update of the configuration for when a configurationis loaded that does not yet contain the 'enabled_storage_types' attribute.Note that this will require more changes as dis/enabling of (shared) file...
gnt-cluster init: add enabled_storage_types parameter
This patch extends the 'gnt-cluster init' command to set the listof enabled storage types on cluster creation.
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...
gnt-cluster info: show enabled storage types
This extends the 'gnt-cluster info' command to list the storage typesthat are enabled on the cluster. It also fixes the broken indentationin the 'handleCall' function.
Add 'enabled_storage_types' to the cluster config
This patch adds the cluster's new field 'enabled_storage_types'to the configuration objects in python and haskell.
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....
Trivial merge: no conflicts...
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.
Update "FIXME" string in RAPI
We are not ready for this change yet. Let's push it to 2.8.
Fix typo 'VolumeN' in bdev.py
Signed-off-by: Helga Velroyen <helgav@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
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.
Add user and group for the monitoring agent
This commit adds the user and group variables for the monitoring agent in allthe configuration files where they are required.
rapi client: add target_node to migrate instance
This allows migrating to any node, as it is already possible forfailover, when instances are externally mirrored.
Signed-off-by: Daniel Krambrock <danielk_lists@z9d.de>Signed-off-by: Guido Trotter <ultrotter@google.com>...
Make diskless instances externally mirrored
This addresses Issue 237.
Mirroring no disk is a no-op. As such we can treat them like mirroredinstances, since the data they need (none) will be present on all nodes.
This is definitely enough to failover or migrate instances with a manual...
Fix migrate/failover -n for ext mirror storage
This fixes issue 396.
- Fix a wrong comment that mentions drbd8 when actually the code acts only on externally mirrored instances.- Fix a wrong assert that requires failover/migrate to acquire the NAL on externally mirrored instances: this is the case only when a...
Enable split queries for the network
Now that all fields are implemented, and (I think) behave equivalentto the Python implementation, we can switch on the split queries fornetworks.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Helga Velroyen <helgav@google.com>
Introduce better item getter helper in query.py
And also use it for simple network fields. Currently the Pythonlibrary returns jsnull, which is formatted as 'None' by the Pythonclient, which (IMHO) is not nice, since these fields are strings (someof them) or "other". An undeclared gateway is easier to diagnose when...
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)....
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.
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 policy check for disk templates
Instance disk template is checked against the policy, and disklessinstances aren't checked for the number of disks.
Fix merge 8e09e801 that resulted in duplicated code
A fragment in LUInstanceCreate.CheckPrereq() removed in commit ba147ff8 wasreintroduced in merge 8e09e801 due to a change in df28c49b.
GanetiRapiClient: fix the no_remember option
There was a typo which prevented the correct option from being passed toRAPI
Signed-off-by: Daniel Krambrock <danielk_lists@z9d.de>Signed-off-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>