KVMHypervisor, fix a bug in MigrateInstance
This was introduced as a typo in commit7e66c35b5685525538dd65dd3dff75b5346d30d7 while removing duplicate codefrom the KVM hypervisor.
Signed-off-by: Guido Trotter <ultrotter@google.com>
Fix backend.{Start,Stop}Master
Commit c26a6bd21c17641f718369caed88ae16947fa774 changed GetMasterInfonot to return a tuple anymore, but didn't update its two callers inbackend.py, which were trying to extract the values from the secondtuple element. This causes a stack trace in node-daemon.log....
Merge branch 'next' into branch-2.1
Merge branch 'master' into next
Update NEWS and version for 2.0.1 release
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
gnt-{instance,backup}(8) --nic is actually --net
Fix a typo in the man pages that used the wrong option name.
Signed-off-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Fix hooks unittests after RPC result changes
Patch "Simplify the RPC result framework in backend.py" changed allRPCs, and thus the hooks results where also changed. This needs changesto the hooks unittests too.
Signed-off-by: Iustin Pop <iustin@google.com>...
Small whitespace change
Some indentation was wrong, and pylint rightfully complained.
Simplify RPC call result check in cmdlib.py
Now that all results are the same, we can even more simplify thehandling in cmdlib more. Almost all if result.RemoteFailMsg()…constructs are similar, and we resurect the RpcResult.Raise() functionto take a message argument, which it will process and raise an...
Simplify the RPC result framework in backend.py
Since now all functions fail via _Fail, the return True, … is redundantas all normal return paths have it, and thus the True value can be addedin the ganeti-noded handler.
This means that all functions can now forget about the special result...
Convert all backend function to exception
Instead of returning (False, msg) from rpc endpoints, we raise alwaysexceptions (the non-endpoint, internal functions can remain as is). Thismeans that the error paths are agnostic to how the failure is signalled...
Simplify usage of backend._FindDisks
Since all users of _FindDisks now return new-style results, we cansimply make it raise an exception and not deal with the status field.
Pre-compute error status in RpcResult
Since now all RPCs have the new style result type, we can pre-computethe error message at RpcResult() init time and not wait until it'srequested.
Implement result-type restriction in ganeti-noded
Since all rpc calls were converted, we can now: - enforce result type to (status, data) - convert all unhandled exceptions to (False, str(err))
This makes sure that all unhandled errors are reported to rpc users....
Remove old invalid-os related functionality
We no longer need OS objects to be able to represent invalid OSes. Thiscleans up the code handling those cases.
Big rewrite of the OS-related functions
Currently the OSes have a special, customized error handling: the OSobject can represent either a valid OS, or an invalid OS. The associatedfunction, instead of raising other exception or failing, create customOS objects representing failed OSes....
Convert the jobqueue rpc to new style result
This patch converts the job queue rpc calls to the new style result.It's done in a single patch as there are helper function (in both jqueueand backend) that are used by multiple rpcs and need synchronizedchange....
Convert the file storage rpcs to new style result
This patch converts all three file-storage rpc (create, delete, rename)to new style result. This is done in a single patch as they all use ahelper function which itself needs to/can be converted.
Convert test_delay rpc to new style result
Convert iallocator_runner rpc to new result style
This patch converts this rpc into the new style. Since the functionalready had some error handling, we remove this custom error reportingand replace it with our (new-style) result type. This allows significant...
Convert hooks_runner rpc to new style result
This also converts (and fixes) unittests and mock objects to deal withthis change, and the custom hook verifier in cmdlib.LUClusterVerify.
Convert os_diagnose rpc to new style result
This also removes custom post-processing from rpc.py; since this callhas only one user, it was simple to move it back to the caller.
Convert call_version rpc to new style result
This also cleans up its single use in cmdlib.py.
Convert write_ssconf_files to new style
The patch also adds logging of errors from the ConfigWriter in case theRPC fails (although today we don't have failure modes).
Convert master_info rpc to new style result
This was more tricky as the backend function is used by other functionin backend.py. As such, it must be handled specially - it must raisealways an exception and not simply return False, err.
Convert node_volumes rpc to new style result
Conver node_leave_cluster rpc to new style result
This patch converts this rpc call to the new style result, and alsochanges in the process the meaning of the QuitGanetiException'sarguments and the node daemon rpc call exception handler.
The problem with the exception handler is that we used a two-stage one,...
Convert node_stop_master rpc to new style result
Convert node_start_master to new style result
This is used in multiple places outside cmdlib.py, so it's a moreinteresting patch.
Convert node_verify rpc to new result style
Remove utils.CheckDict since it's no longer used
Only the custom handling in rpc.py for call_node_info used this, so nowit can be removed.
Convert node_info rpc to new style result
This patch also does some cleanup and enforces valid results (withproper type, i.e. int for memory/disk values) from remote node,otherwise we handle the result as failure.
We do this so that we can remove custom processing in rpc.py which is...
Convert node_has_ip_address rpc to new style
This should actually have a function in backend, but it's fine for now.
Convert instance_list rpc to new style result
Since backend.GetInstanceList() is used both as RPC endpoint and asinternal function, it can't return (status, value). Instead it returnsonly valid instance info, and failures are denoted by exceptions; and...
Convert all_instances_info rpc to new result style
Convert instance_info rpc to new style result
Convert instance_os_import rpc to new style result
This changes from a list of booleans to «status, error messages». Thismeans that instead knowing which disk has failed (position based), weget a list of all failures (with details how they failed).
Convert bridges_exist to new style result
This was a very simple (boolean) RPC, so converting it to actually havemore value with the new style results was more difficult.
Convert vg_list rpc to new style result
This doesn't have known failure modes but converting will help later.
We also now call directly utils.ListVolumeGroups() instead of thebackend.ListVolumeGroups() so that we don't have to undo the (status,value) result type....
Convert volume_list rpc to new style result
This is a big change, because we need to cleanup its users too.
The call and thus LUVerifyDisks LU used to differentiate between failureat node level and failure at LV level, by returning different types inthe RPC result. This is way too complicated for our needs....
Convert export_remove rpc to new style
This converts the export_remove rpc to new style result and also fixesand old TODO by adding exception handling (and conversion to failure).
Convert export_list rpc to new style result
This is used in multiple places, so it has a little more changes thanthe previous ones.
Convert export_info rpc to new style result
This also removes some code from ganeti-noded and rpc.py, which shouldnot do such processing of data (and be simply glue code). (Oralternatively they could, if we had better infrastructure).
Convert finalize_export rpc to new style results
This rpc doesn't have explicit failure modes, but once all RPCs areconverted and we can catch and convert expceptions to failure in noded,we will have meaningfull error messages.
Convert snapshot_export rpc to new style
Convert blockdev_snapshot rpc to new result style
This also slightly changes the code in cmdlib that uses it for moreclarity.
Convert blockdev_getmirrorstatus rpc to new style
Fix a wrong function name in backend.DrbdAttachNet
Commit cf8df3f30c2dcd0ab398d835fa9f64d61578a4f7 "bdev: forward-portReAttachNet/DisconnectNet" forward-ported 1.2's bdev.DRBD8.ReAttachNet()to 2.0 while renaming it to AttachNet(), but commit6b93ec9d798ed53089a06bc0ced58ef1d8a9e4b0 "Forward-port DrbdNetReconfig"...
Iallocator: NIC parameters
Xen: NIC parameters
KVM: NIC parameters
OSEnvironment: convert to NIC parameters
rpc: fill in NIC parameters in instances
Remove bridge and default_bridge from objects
These values are deprecated, and not used in 2.1 anymore.The slots are still there to allow auto-upgrading from 2.0.
NIC Parameters: fix hooks environment generation
In order to do that we change the way nics are espected to be passed tothe _BuildInstanceHookEnv function, from (ip, bridge, mac) to (ip, mac,mode, link).
To translate new nics, which have the ip, mac and nicparams fields to...
Remove config.GetDefBridge
Default bridge is now handled with nic parameters, and this function isunused.
QueryClusterInfo: don't show default_bridge
Since default_bridge is deprecated, avoid displaying it when queryingfor cluster information.
config unittests: use nic params
The target test cluster should have nic params, rather than a defaultbridge.
InitCluster: don't set default_bridge
And remove the -b option, as default nic parameters can be used instead.We could support the option, but that would add more code, and sincecluster init is not a frequent operation, it's better to keep the codeclean....
_CheckInstanceBridgesExist: move to NIC parameters
Rather than checking all bridges, we check all links for bridged nics,if any. Since this function is now slightly more complex than before,it's been split into an auxiliary function, and more parameters are...
LUSetInstanceParams: nic parameters
Hooks are dealt with in a later patch in the series.
LUSetInstanceParams: abstract _GetUpdatedParams
There is some duplicated code between hv and be parameters to create theupdated parameters dict. This will need to be done also for nicparameters, so we abstract this functionality in a function.
Signed-off-by: Guido Trotter <ultrotter@google.com>...
LUSetInstanceParams: save cluster
Rather than querying for the cluster multiple times, save it.
LUCreateInstance: NIC parameters
Instance creation is changed to support the new nic parameters.
Add nicparams to the NIC object
Also populate nicparams with a sensible default for imported instances.Unfortunately we don't know if the bridge set up in old nics is thedefault one or not, and we don't have access to the config clusterobject here to verify, so we'll just copy it without questions....
GNT-CLUSTER fix search-tags example
Reported in issue 59.
Fix gnt-instance reinstall
Commit 55efe6dabe48e5c37dc1ff6099e0bb8afde7a468 "Convert instancereinstall to multi instance model" actually broke instance reinstall forsingle-instance cases. This one-liner fixes it.
Fix ConfigWriter._DistributeConfig error handling
Commit 1b54fc6c2fd92b614c029cc5312d02f9f1526253 added a typo (due tocopy-paste) in the error handling path of this function.
Fix node add and RedistributeAncillaryFiles
Commit 28eddce5249f35c2c330a04da07b74950877dcf5 added theRedistributeAncillaryFiles, but it calls it with a wrong parameter and thusmakes node add fail.
This one-liner fixes it.
rpc: Add a simple failure reporting framework
This patch adds a simple failure reporting tool, similar to bdev's_ThrowError. In backend, we move towards the new-style RPC results (oftype (status, payload)) and thus functions which use this style can very...
Show nic parameters in cluster info
Allow modifying of default nic parameters
Allow setting NIC parameters at gnt-cluster init
gnt-cluster init, simplify parameter checks
Don't check for non-existant BE parameters, ForceDictType will do itUse utils.FillDict to populate the defaults
Cluster: add nicparams, and update them on upgrade
This also migrates the default bridge from the cluster object to the nicparams, at load time. Since we don't support changing the default bridgeafter cluster init, this is ok for now. In the future we'll make...
Add NIC.CheckParameterSyntax
This function will be used to check the NIC parameters for validity.Unittests are included.
nic parameters: constants
Introducing the constants used for implementing nic parameters inGaneti, according to the 2.1 design.
Abstract Param upgrade from cluster.UpgradeConfig
A new UpgradeGroupedParams is used to upgrade all the profiles for oneparameter filling in the default values, or creating the whole dictanew, should it be missing. This is used only for beparams, currently,...
Change BEGR_DEFAULT to PP_DEFAULT
This way the same constant can represent the default profile also fornic, disk and OS parameters.
Move FillDict at module level
This way it can be also used by scripts and other object types.
Fix a typo in InitCluster
Convert call_blockdev_removechildren to new result
This patch converts blockdev_removechildren to new result type andslightly changes a message in addchildren to match this (paired)function.
Convert call_blockdev_addchildren to new result
This patch converts the blockdev_addchildren rpc call to the new resultformat.
Convert rpc call_blockdev_rename to (status, data)
This small patch converts the call_blockdev_rename to the new resulttype.
A small makefile rule to create a TAGS file
This helps emacs users ☺
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Enable stripped LVs
This patch enables stripped LVs, falling back to non-stripped if thestripped creation fails. If the configure-time lvm-stripecount is 1,this patch becomes a noop (with an insignificant python-level overhead,but no extra lvm calls)....
Add a lvm stripecount configure parameter
This patch adds a configure-time customizable parameter that will beused to enable stripped LVs. The default of the parameter is 3.
Add more constants for DRBD and change sync tests
This patch adds constants for the connection status, peer roles and diskstatus, and it changes the rules for when the disk is considered as“resyncing” - previously it was only for syncsource/synctarget, but...
2.1 design: non bridged instances support
2.1 design: disk/net parameters
Wait for a while in failed resyncs
This patch is an attempt at fixing some very rare occurrences of messages like: - "There are some degraded disks for this instance", or: - "Cannot resync disks on node node3.example.com: [True, 100]"
What I believe happens is that drbd has finished syncing, but not all...
Assemble DRBD using the known size
This patch changes DRBD disk attachment to force the wanted size, as opposed toletting the device auto-discover its size.
This should make the disks more resilient with regard to small differences insize (e.g. due to LVM rounding). This still works with regard to disk...
Fix two issues with exports and snapshot errors
This patch fixes two issues related to failed snapshots during exports: - first, the error messages used disk.logical_id1, which is a node name for DRBD, and it resulted in strange error messages like...
Set the size on new DRBDs in replace secondary
Currently the code in cmdlib doesn't set the device size to new DRBDdevices in replace secondary, but we need to do it otherwise it getsinitialized to None.
Change the bdev init signatures
This patch changes all the bdev.BlockDev constructors to take anadditional ‘size’ parameter, all the backend functions that call thosefunctions to pass it and also changes backend.BlocdevCreate() to not usethe size passed via the rpc call but instead directly disk.size (this is...
Upgrade be/hv params with default values
From time to time we're adding new be or hv parameters. With this patchmissing parameters get set to the default value when loading the clusterobject. This patch version also considers the case when hv/be params...
Add cluster-init --no-etc-hosts parameter
If --no-etc-hosts is passed in at cluster init time we set a newparameter in the cluster's object to false, and avoid adding nodes tothe hosts file. The UpgradeConfig function is used to set the value toTrue, when upgrading from an old configuration version....
objects: add configuration upgrade system
Add a very basic configuration update mechanism to objects.An object can define the UpgradeConfig method, which will be called atinit time, and use it to fill in missing defaults in the configuration.In the future we may want to make it more complex, for example adding...
Convert UploadFile (and its callers) to new rpc