utils.SetupLogging: Return function to reopen log file
This function can be used from a SIGHUP handler to reopen log files.Initial, simple unittests are included.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: René Nussbaumer <rn@google.com>
Introduce re-openable log record handler
This patch adds a new log handler class based on the standard library'sBaseRotatingHandler. This new class allows the log file to be re-opened,e.g. upon receiving a SIGHUP signal. The latter will be implemented in...
Add RAPI resource for instance console
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Export console information as query field
This makes it possible to get the console information via a LUXI query.
Fix instance list for instances running multiple times
If for some reason (e.g. failed migration) one instance is runningon multiple nodes the output can become inconsistent. To get that errorand make it consistent between runs we make the call on the secondary...
Fix unittest breakage on Python 2.4/2.5
Commit 70b0d2a29 broke unittests on Python 2.4 and 2.5. Turns out thatPython 2.6 and above allow classes to be passed as custom test runners,whereas earlier versions don't.
Signed-off-by: Michael Hanselmann <hansmi@google.com>...
Ensure all resources are used by RAPI client
Check for duplicate RAPI URIs and handlers
RAPI client: Wrap /2/redistribute-config resource
RAPI client: De-/activating instance disks
Add unittest for RAPI client's ModifyInstance
Merge branch 'devel-2.4'
Rename QRFS_* to RS_*
This patch renames QRFS_* to RS_* fields so they can be used in otherplaces (i.e. LUs) without confusion, as this was initially meant forquery operations.
Signed-off-by: René Nussbaumer <rn@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
query: Add alias support in _PrepareFieldList
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: René Nussbaumer <rn@google.com>
query: Change internal result computation
While looking at the query library, I realized that while we have fivefield statuses, making this a 5-dimensional space, four of them areshrunk to a single possible value (None). Hence it should be possible toconvert this into a single value space plus extra 4 special constants....
KVM: Perform network configuration in Ganeti
This patch introduces network configuration for KVM in Ganeti.
There are three problems with having KVM perform network configuration via ifupscripts: a) Ganeti never gets to know the tap interface that is associated with an...
Rename OpGetTags and LUGetTags
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: René Nussbaumer <rn@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Rename OpTestJobqueue and LUTestJobqueue
Check consistency of the class names and OP_ID
As the class names should be now consistent with the OP_IDs, we add acheck for wrongly-defined OP_IDs.
However, the future removal of the hand-coded OP_IDs will render thisobsolete, so this check is introduced just to make sure that the...
Rename OpStartupInstance and LUStartupInstance
Rename OpMigrateInstance and LUMigrateInstance
Rename OpReinstallInstance and LUReinstallInstance
Rename OpRenameInstance and LURenameInstance
Rename OpSetInstanceParams and LUSetInstanceParams
Rename OpShutdownInstance and LUShutdownInstance
Rename OpAssignGroupNodes and LUAssignGroupNodes
Rename OpRenameGroup and LURenameGroup
Rename OpCreateInstance and LUCreateInstance
Rename OpVerifyCluster and LUVerifyCluster
Rename OpExportInstance and LUExportInstance
Bump version for Ganeti 2.4.0~beta1
Update the version in all necessary places. Update NEWS with releasedate.
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>
Fix typos in RAPI docstrings, add unittest
This patch fixes a number of typos and standardizes RAPI resourcedocstrings. A unittest is added.
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...
Add tests for objects.Instance
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 RunningTimeout to utils.algo
utils: Move code manipulating /etc/hosts to separate file
Fix utils.io unittest
“import signal” was missing, but of course it didn't show during mytesting.
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.
Add unit tests for CheckAssignmentForSplitInstances
Signed-off-by: Adeodato Simo <dato@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Expose OpAssignGroupNodes over RAPI and RAPI client
Validate RAPI resource paths
To stay consistent, RAPI resources should only use a restricted set ofcharacters. No uppercase, no “_”, etc. This is enforced by this patch.
utils: Move hashing-related code into separate file
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.
Add unit test for ganeti.rapi.client's ModifyGroup
This was forgotten in f18fab7.
Signed-off-by: Adeodato Simo <dato@google.com>Reviewed-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:...
Fix syntax error with Python 2.4
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...
Support query of node field 'powered'
This field is based on OOB support and is only available if there's oobsupport for that node.
Signed-off-by: René Nussbaumer <rn@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
ganeti.query_unittest.py: add tests for group queries
ganeti.query_unittest.py: test lock fields too
Additionally, change TestQueryFields.testSomeFields() to handle lists offields shorter than 20 elements.
Merge branch 'devel-2.3'
Convert “gnt-debug locks” to query2
Locks can now be queried using “Query(what="lock", …)” over LUXI.
cfgupgrade: Check master name, clarify question
- Check hostname and abort if it doesn't match contents of “ssconf_master_node”, can be overridden using “--ignore-hostname” parameter.- Clarify confirmation question and don't mention instances anymore....
RAPI: Add resource to grow instance disk
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
Improve opcode summary tests
Test full summary instead of just format.
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...
Add unittests for ht module
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.
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())'...
Ensure temp files from RunCmd tests are removed
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
Move QueryFields to query module
Also replace “sorted” with “utils.NiceSort” now that it supports a keyfunction.
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...
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...
Improve jqueue unittests
- Verify job file updates- Ensure queue lock is released while executing opcode
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...
Add some unit tests for ConfigWriter.AddNodeGroup()
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.
query: Add definition for instance queries
Group operations: update ganeti.rapi.client with all node group operations
Group operations: expose add/remove/rename in RAPI
utils: Add function to find duplicates in sequence
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Adeodato Simo <dato@google.com>
locking: add nodegroup lock level
This also changes masterd to initialize the ganeti's manager with thecurrent list of nodegroup uuids, and updates unittests
Signed-off-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Querying node groups: RAPI support
This implements /groups and /groups/%s RAPI end points.
Signed-off-by: Adeodato Simo <dato@google.com>Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Add OpQuery opcode
Add node query definition
This includes a bunch of helper functions which can be helpful for otherqueries, too. Unittests are included.