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
Signed-off-by: Michael Hanselmann <hansmi@google.com>...
query: Add wrapper for creating response object
It'll be used for querying locks.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Move QueryFields to query module
Also replace “sorted” with “utils.NiceSort” now that it supports a keyfunction.
Merge branch 'devel-2.3'
Conflicts: NEWS: Trivial
Merge branch 'stable-2.3' into devel-2.3
gnt-node modify: Adding --node-powered=yes|no
Signed-off-by: René Nussbaumer <rn@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
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.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: René Nussbaumer <rn@google.com>
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.
Signed-off-by: Adeodato Simo <dato@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
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.
Signed-off-by: Adeodato Simo <dato@google.com>...
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)
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Adeodato Simo <dato@google.com>
constants: Clarify comment for QRFS_NODATA
cmdlib: Fix prototype for _QueryBase.DeclareLocks
Group operations: update ganeti.rapi.client with all node group operations
Group operations: expose add/remove/rename in RAPI
Group operations: CLI code for add/remove/rename a group
Also, minor update to the 2.3 design doc, which was indicating the removeoperation would be `gnt-group del` and not `gnt-group remove` (the latterbeing consistent with gnt-node and gnt-instance)....
Group operations: OpCode and LU for renaming a group
Group operations: OpCode and LU for removing a group
Group operations: OpCode and LU for adding a group
Expose new node group attributes in CLI and RAPI
config.py, objects.py: more node group support
In particular:
- add AddNodeGroup and RemoveNodeGroup in config.py
- refactor _UpgradeConfig to make use of _UnlockedAddNodeGroup
- add support for objects.NodeGroup in ConfigWriter.Update; add missing...
Adding new OpCode for OOB
Register OpCode and Logical Unit in mcpu.py
Adding new Logical Unit for OOB
cmdlib: Don't sort list of nodes if names are given
This makes _GetWantedNodes consistent wit _GetWantedInstances.
utils: Add function to find duplicates in sequence
hv_kvm.py: fix some lint issues introduced in 4b784cf
- break as couple lines that were longer than 80 characters - fix a couple "comma not followed by a space" - fix an unused variable warning
locking: add nodegroup lock level
This also changes masterd to initialize the ganeti's manager with thecurrent list of nodegroup uuids, and updates unittests
Remove bridge NIC slot
This has been deprecated and unused since 2.1.
kvm: Make _GetKVMVersion() return integers
The current code returns the major, minor and rev portions of the version ofKVM as strings. Returning them as integers makes it easier to compare.
Signed-off-by: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>...
kvm: Improve network syntax and tests
The current syntax when defining a NIC uses a pair of arguments, like this:
-net tap,vlan=0 -net nic,vlan=0,model=virtio
When using this pair, internally KVM will create a VLANState structure to sendethernet frames between the guest NIC and the host tap device. This is...
Make snapshots multi-vg aware
Currently, the Snapshot() function of LogicalVolume returns only thelogical volume path, with the assumption that we only have one VG. Butwith the recent changes, it makes more sense to return the full data (vgand lv) from it, so as to not require computing it in the master....
config.py: add error code to OpPrereqError
This adds a errors.ECODE_NOENT for OpPrereqError in LookupNodeGroup.
Signed-off-by: Adeodato Simo <dato@google.com>Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
config.py: replace "node group" with "nodegroup"
Though code uses "nodegroup" as data member name, strings that will beread by the user should use "node group" (with a space), since "nodegroup" is not a word.
Make rpc.call_lv_list() VG-aware
Changes to backend.GetVolumeList():- now accepts a list of VGs instead of one VG- returns LV names in the form "vg_name/lv_name"
Corresponding changes are done in: VerifyDisks, VerifyNode,LUCreateInstance (for both disk creation and adoption cases)...
cmdlib: fix typos in the docstring for LogicalUnit
opcodes: document OP_DSC_FIELD in OpCode and OpCode.Summary()
Signed-off-by: Adeodato Simo <dato@google.com>Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
locking: Clarify message for removed locks
Just being told that a lock doesn't exist can be confusing. One casewere this happens is when a job (e.g. instance modify) waits for a jobremoving the instance (e.g. export with remove).
Querying node groups: add luxi.REQ_QUERY_GROUPS
This also updates masterd.py.
Querying node groups: add client/gnt_group.py
This implements `gnt-group list`.
Querying node groups: RAPI support
This implements /groups and /groups/%s RAPI end points.
Querying node groups: LU/Opcode
This adds opcodes.OpQueryGroups and cmdlib.LUQueryGroups.
impexpd: Disable OpenSSL compression in socat if possible
This uses an option only available in patched socat versions. Moreinformation is available from the INSTALL update included in thispatch.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>...
Adding RPC infrastructure to call oob
Adding backend functionality to call oob helper
Adding ndparams to gnt-cluster init|modify and man page
This is reverting the revert and adaption to fix the issue which causedthe revert
Conflicts: Makefile.am
config.py: need explicit %-formatting in errors.OpPrereqError.
Trivial style fixes
Add missing closing brackets and fix a typo.
cmdlib: Add base for query classes
LUQueryNodes: Convert to new query model
Add OpQuery opcode