List node parameters (if any) in gnt-node info
Signed-off-by: René Nussbaumer <rn@google.com>Reviewed-by: Iustin Pop <iustin@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
List node parameters in gnt-cluster info output
Signed-off-by: René Nussbaumer <rn@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Fix typos in RAPI docstrings, add unittest
This patch fixes a number of typos and standardizes RAPI resourcedocstrings. A unittest is added.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Move FormatParameterDict from gnt_instance.py to cli.py
This function is useful for other cli-tools who need to displaya dict based parameter field.
Signed-off-by: René Nussbaumer <rn@google.com>Reviewed-by: Adeodato Simo <dato@google.com>
gnt-group modify: ndparams not correctly updated
ndparams should delete keys which are reset to default
Signed-off-by: René Nussbaumer <rn@google.com>Reviewed-by: Adeodato Simo <dato@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Remove --master-netdev default value
Since the --master-netdev option is now used both at cluster init and atcluster modify time, it cannot have a default value of DEFAULT_BRIDGE(xen-br0) anymore. As such at cluster init we make the initializationexplicit if another value hasn't been passed. This fixes gnt-cluster...
Add ability to retain specified fds open in RunCmd
Passing tap devices to KVM as file descriptors requires that the respectivefile decriptors remain open during utils.RunCmd execution. To this direction,we add a “noclose_fds” keyword argument to utils.RunCmd, accepting a list of...
objects: Fix off-by-one in error message
For an instance with a single disk the message should be “… disks 0 to0”, not “… 0 to 1”.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: René Nussbaumer <rn@google.com>
utils: Cleanup and sort wildcard imports
Also convert the per-line pylint instructions to one per-moduleinstruction.
utils: Drop RemovePidFile
It's equivalent to a simple RemoveFile now.
utils: Move NewUUID to utils.io
utils: Move more text-related code
utils: Move process-related code into separate file
utils: Move ResetTempfileModule to wrappers module
It's not exactly a wrapper, but this seemed like the best place.
utils: Move RunningTimeout to utils.algo
utils: Move code manipulating /etc/hosts to separate file
utils: Move X509-related code into separate file
utils: Move I/O-related code into separate file
utils: Move code related to file locking into separate file
utils: Move wrappers into separate file
utils: Use function to disable fork
Use a function instead of a variable written by another module.
utils: Change RemovePidFile to take path, not name
This avoids having to monkey-patch the utils module for unittests.Monkey patching is evil and caused a bug while moving code around.
Fix a typo in backend.py
Sorry I thought I did run commit-check but must not have paid attentionto its output. There was a typo in the docstring. This patch fixes this.
Pause/Resume sync accordingly before wiping disk
Add RPC calls for pause/resume sync of devices
Add backend method for pause/resume sync of devices
Make it possible to pause/resume sync of mirrored dev
Fix some doc issues introduced in recent commits
The hooks is due to me not checking the recent patch from David, andthe cli.py change is due to the utils.py split.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Add OpAssignGroupNodes and LUAssignGroupNodes
This operation allows to assign nodes to a group, verifying whetherthe change would leave any mirrored instance split between differentnode groups.
Signed-off-by: Adeodato Simo <dato@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Add `gnt-group assign-nodes` in the CLI
Cluster verify warns if there are split instances
Emit a warning for each instance with a mirrored disk template that hasits primary and secondary nodes living in different node groups.
Expose OpAssignGroupNodes over RAPI and RAPI client
utils: Move logging-related code into separate file
utils: Rename _CloseFDNoErr to CloseFdNoError
This makes it a public function, which is necessary formoving code into separate files.
utils: Move hashing-related code into separate file
utils: Remove unused variables
utils: Split algorithms into separate file
utils: Split Retry & co. into separate file
utils: Move text-related functions into separate file
utils: Move Mlockall into separate file
The unittest file is renamed to match the other utils.* tests.
utils: Move to separate module
This is preparing for splitting the whole units module.
mcpu: Automatically build the DISPATCH_TABLE
While reviewing dato's interdiff for the OpAssignGroupNodes, Irealised that we can do better. This patch replaces the hand-builtDISPATCH_TABLE with one built from the opcode.OP_MAPPING dict.
Signed-off-by: Iustin Pop <iustin@google.com>...
Generalize the OpCode-should-be-in-mcpu test
Currently, the unittest TestDispatchTable in mcpu unittest does ahard-coded approach to test whether an opcode should be included ornot in the mcpu.Processor dispatch table. This is not flexible, so wereplace it with two changes:...
IAllocator: fix breakage for non-vm_capable nodes
Currently, the IAllocator doesn't know that non-vm_capable nodesshould not be queried for hypervisor/instance information.
This patch updates the node data computation to generate basic info,but not the runtime data for such nodes. Furthermore, the...
Use new console information in hypervisor abstraction
This makes use of the new way of returning console information from themaster daemon. Unittests are included.
Introduce verbose opcode result for console
With this patch OpConnectConsole will no longer just return a commandwith arguments, but rather a detailed description about how to connectto an instance's console. Unittests for some parts are included. Another...
luxi.Client: Add function to close connection
Merge branch 'devel-2.3'
Conflicts: lib/cmdlib.py: Trivial...
Remove unused import from client.gnt_instance
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Adeodato Simo <dato@google.com>
gnt-instance console: Improve error reporting
If the SSH command fails, this will give a more detailed errormessage than before.
Increase timeout for connection on remote import
The source cluster has to shut down an instance before it can beexported. Doing so can take a while, but the default connection timeoutis only 60 seconds. Adding the shutdown timeout on the receiving cluster...
List recorded powered state in gnt-node info
Signed-off-by: René Nussbaumer <rn@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Support query of node field 'powered'
This field is based on OOB support and is only available if there's oobsupport for that node.
Convert “gnt-group list” to query2
cmdlib.py: convert LUQueryGroups to query2
cmdlib.py: move _GetQueryImplementation to end of file
_GetQueryImplementation() uses _QUERY_IMPL, which list all query typeimplementations. By moving it to the end of the file, we ensure all suchclasses are defined by the time we list them.
Signed-off-by: Adeodato Simo <dato@google.com>...
query.py: add definitions for node group queries
constants.py: define QR_GROUP resource
ganeti.query_unittest.py: test lock fields too
Additionally, change TestQueryFields.testSomeFields() to handle lists offields shorter than 20 elements.
RPC: mark jobqueue functions as URGENT
Recently, we've seen more and more cases of a specific breakagepattern in Ganeti: master candidates which are semi-alive (as in, theyrespond to ping, they can complete a TCP/SSL handshake, but otherwisethe root filesystem is broken) cause lots of confusion within masterd....
Convert “gnt-debug locks” to query2
Locks can now be queried using “Query(what="lock", …)” over LUXI.
Fix OpSetInstanceParams.disk_template check
When moving the opcode parameters I moved two or three checks from anopcode's CheckArguments function to the type checks. This was one ofthem and unfortunately I didn't notice the parameter can be None.
Signed-off-by: Michael Hanselmann <hansmi@google.com>...
RAPI: Add resource to grow instance disk
Reword "one of hmgt" as "one of h/m/g/t" for clarity
Signed-off-by: Adeodato Simo <dato@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
out of band verification in gnt-cluster verify
This adds the verify tests for out of band management
Adding additional VerifyNode checks to backend
This adds checks for out of band support. The helpers have to exist andthey have to be executable.
baserlib: Add function for filling opcodes
This function makes use of the opcode parameters which now livedirectly in the opcode. A number of RAPI resources can now be simplified.
RAPI: Add resource to modify cluster
Migrate code verifying opcode parameters to base class
This allows the function to be used in other places as well.An optional parameter is added to control whether defaultvalues should be set. Unittests are added, providing fullcoverage.
Improve tests for OP_ID
… by detecting duplicates.
cmdlib: Remove opcode parameters
Remove the parameter definitions and use those from the opcode classesinstead. Small style changes are also made (empty lines, wrapping).
opcodes: Add opcode parameter definitions
This is the first step for migrating them from cmdlib. A metaclass isused to define “__slots__” upon class creation time (not instantiation).
query2: Add new field status “offline”
This allows “gnt-node list” to show the difference between modes markedoffline and nodes with e.g. RPC errors (“(nodata)”). node1 is themaster, node2's node daemon crashed and node3 is marked offline:
$ gnt-node list -o name,offline,dtotal,dfree...
ht.TInt: Exclude boolean values
See inline comment.
Cleanup bootstrap.SetupNodeDaemon
- Code formatting- Use ShellQuote for one argument- Remove variables no longer used after commit 9294514d
Conflicts: man/gnt-instance.sgml: Trivial merge in gnt-instance.rst...
cli: Change “<…>” in query output to “(…)”
This should reduce the amount of damage in case of accidential copy &paste.
jqueue: Fix cancelling while in waitlock in queue
Since the recent change to leave jobs in the “waitlock” status (commit5fd6b6947), cancelling a job while it's back in the queue would break.This patch handles these cases and adds a unittest.
LUInstanceRename: log result of name resolving
While the LU does return the final name, it's useful to log the actualDNS resolving process (input and output) in order to help with thediagnose of failures.
The patch also fixes the docstring of the Exec() function....
Remove utils.FormatTimestampWithTZ
Long story short: time.strftime("%Z", time.localtime()) doesn't work,even though it's documented to be equivalent to time.strftime("%Z").
$ TZ=America/Sao_Paulo python -c 'import time; printtime.strftime("%Z"), time.strftime("%Z", time.localtime())'...
Allow customisation of the disk index separator
As per issue 124, some Xen versions (or packaging) don't deal nicelywith the colon being part of a disk name. Therefore we add aconfigure-time option for customising this.
Note: setting the separator to interesting values like / is not...
utils: Timezone fixes and tests
- Update docstrings to explicitely mention Epoch- Fix timezone bug in FormatTimestampWithTZ, where it would use GMT/UTC when it should use the local timezone- Add unittests for time formatting functions
query: Add wrapper for creating response object
It'll be used for querying locks.
Move QueryFields to query module
Also replace “sorted” with “utils.NiceSort” now that it supports a keyfunction.
cli: Extend message for LUXI timeouts
Point out that jobs already submitted continue to run.
Fix timeout handling in LUXI client
If the socket can't be read in time, it raises “socket.timeout”, forwhich there is special handling code. Unfortunately the exception blockwas in the wrong order and “socket.error” caught it before.
Conflicts: NEWS: Trivial
Merge branch 'stable-2.3' into devel-2.3
gnt-node modify: Adding --node-powered=yes|no
LUSetNodeParams: Add support for powered state
LUSetNodeParams/LUOobCommand respect offline/powered
This patch makes sure we cross verify the state the node isin with our view:
power off -> Node has to be set offlinemodify -O no -> Node has to be powered
Signed-off-by: René Nussbaumer <rn@google.com>...
gnt-node power: Mark also offline when powering off
Signed-off-by: René Nussbaumer <rn@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Conflicts: lib/cmdlib.py: Trivial qa/ganeti-qa.py: Trivial...
utils.NiceSort: Use sorted(), add keyfunc, unittests
This patch changes utils.NiceSort to use the built-in “sorted()” andgets rid of the intermediate list. Instead of wrapping the itemsourselves, a key function is used. The caller can specify another key...
ShutdownInstanceDisks: accept offline secondaries
For secondary node that is offline, we should not consider that thedisk shutdown has failed, as it can never succeed under this clusterstate and (by virtue of the fact that the secondary node is offline)...
RpcResult: simplify some asserts
data ≫ code, eom.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
LUAddNode: default ndparams to empty dict when not provided
Fix gnt-cluster verify with diskless instances
`gnt-cluster verify` was failing with KeyError if there was anydiskless instance in the cluster. This was because _CollectDiskInfo()was not including these instances in the returned dictionary, but theywere expected to be present in LUVerifyCluster.Exec()....
Fix N+1 error message
The error contained a typo and is slightly cumbersome. It changes from:
- ERROR: node a: not enough memory on to accommodate failovers should peer node b fail
to:
- ERROR: node a: not enough memory to accomodate instance failovers should node...
Rename (Op|LU)OutOfBand to (Op|LU)OobCommand