Use new console information in hypervisor abstraction
This makes use of the new way of returning console information from themaster daemon. Unittests are included.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: René Nussbaumer <rn@google.com>
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
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
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
Signed-off-by: Adeodato Simo <dato@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
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
Signed-off-by: René Nussbaumer <rn@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Conflicts: man/ganeti-cleaner.sgml: Removed man/ganeti-confd.sgml: Removed man/ganeti-masterd.sgml: Removed...
jqueue: Keep jobs in “waitlock” while returning to queue
Iustin Pop reported that a job's file is updated many times while itwaits for locks held by other thread(s). After an investigation it wasconcluded that the reason was a design decision for job priorities to...
Adding gnt-node power * commands
Do the expanding of the node name in ExpandNames
client.gnt_node: Remove unnecessary lambda
Pylint complained that the “lambda may not be necessary”. Turns out itwas right.
Convert “gnt-instance list” to query2
Convert “gnt-node list” to query2
cli: Add infrastructure for query2
A new function for formatting the query results is added,``FormatTable``. This was determined to be easier and safer thanmodifying the existing ``GenerateTable`` function while keepingbackwards compatibility for code not yet converted. The new code makes...
iallocator: Export node group allocation policy
Signed-off-by: Balazs Lecz <leczb@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Adding --node-powered command line flag
Set powered to True for added nodes
Set recorded powered state for OOB calls
Add new Node attribute powered
This is just a state of record field and does not necessaryreflect the reality.
Expose OpSetGroupParams in RAPI and RAPI client
This creates the /2/groups/<name>/modify resource; at the moment, only the"alloc_policy" attribute can be modified.
Add the "alloc_policy" attribute to node groups
This can be set at group creation time and via OpSetGroupParams. The defaultis "preferred", and existing node groups from previous Ganeti version willget the attribute set to this value.
Add modification of node groups (OpCode/LU/CLI)
With this commit, only modification of the "ndparams" attribute issupported.
Signed-off-by: Adeodato Simo <dato@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Introduce OpAddGroup.ndparams and expose in CLI
Fix sorting bug in LUQueryGroups
In LUQueryGroups.Exec(), NiceSort was being applied to group UUIDs, andnot to group names. We use a temporary name to UUID map to sort the listof UUIDs by group name instead.
cmdlib: Sort list of fields for QueryFields
objects: Add custom de-/serializing code for query responses
… and use them in cmdlib.
LUXI: Add Query and QueryFields functions
objects: Add definitions for query requests and responses
Also update description of QueryFieldDefinition.name.
qlang: Add function to build simple filter
This will be used in clients to build the filters for query2.
query: Handle items missing timestamps
In upgraded configurations, some items might miss the “ctime” and/or“mtime” values and need to be handled specially.
Add gnt-cluster modify --master-netdev
Although this might be a dangerous operation, it's still better to allowit rather than requiring a hand-edit of the config file, should it benecessary.
Signed-off-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
cmdlib: Convert instance query to new infrastructure
query: Add definition for instance queries
Fix disk status verification in LUClusterVerify
Commit b8d26c6 added disk status verification, but it has two(different) bugs for not healthy nodes.
For offline nodes, we don't add at all the disk status to theinstance/node dict, with the result that the instance is not present in...
Signed-off-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Merge branch 'devel-2.2' into devel-2.3
Merge branch 'stable-2.2' into stable-2.3
Fix rename for file-backed instances
Currently the code wrongly changes the disk logical/physical idcomponent representing the path from "$storage_dir/$iname/disk$seq" to"$storage_dir/$iname/disk/$seq" (note the additional slash) breaking therename.
Signed-off-by: Guido Trotter <ultrotter@google.com>...
Check payload of OOB execution
Replace GetOobProgram by GetNdParams
This was due to a older review which used GetOobProgram but thenchanged to GetNdParams. Forgot to adjust this in the LU before.
Ensure we just serialize JSON if there is data
Adding missing timeout parameter to rpc interface
Allow rename of instance to same name
This basically is a no-op in ganeti, but forces the execution of theos-specific rename scripts.
Introduce constant for the name of the initial node group
objects.py: fix minor error in NodeGroup.SimpleFillND docstring
The defaults are filled in from the node group defaults, not clusterdefaults (presumably copy & paste error).
constants.py: fix tiny grammar issue in comment
Node query: maintain order as requested
If the client requests certain names, their order should be maintained.This is already done for instance queries. Moving this part into aseparate function allows sharing code.
query: Improve error checking
- Show only field definition, not callback when a result row is inconsistent- Show list of duplicate titles if there are any (module load time)
constants: Clarify comment for QRFS_NODATA
cmdlib: Fix prototype for _QueryBase.DeclareLocks