Unify the “--disk-template” option
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Unify the “--no-nics” option
Unify the “--file-storage-dir” option
Unify the “--no-wait-for-sync” option
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Remove RpcResult.RemoteFailMsg completely
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Add an error-simulation mode to cluster verify
One of the issues we have in ganeti is that it's very hard to test theerror-handling paths; QA and burnin only test the OK code-path, sinceit's hard to simulate errors.
LUVerifyCluster is special amongst the LUs in the fact that a) it has a...
Introduce parseable error codes in LUVerifyCluster
Currently the output of cluster verify can be parsed for 'ERROR'messages, but that is the only indication we get (error or no error). Inorder to allow monitoring tools to separate different error conditions,...
Unify the multiple 'verbose' options
Currently multiple files define a 'verbose' option. This patch moves allthese definitions to a single VERBOSE_OPT option which is exported fromcli.py.
Rewrite the lib/cli.py export list
Right now, the export list is a mess, it's not sorted, and the exporteditems are in random places. This patches does grow the length of thelist, but at least it's more clear.
Signed-off-by: Iustin Pop <iustin@google.com>...
Remove RpcResult.failed attribute
It's redundant with RpcResult.fail_msg. This change survived QA, burnin andunittests.
Confd: add primary IPs queries
Extend confd to answer queries about nodes primary IPs and master candidatesprimary IPs.
Signed-off-by: Luca Bigliardi <shammash@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Confd client library
Initial confd client library implementation. This initial version usesasyncore, and supports answers via a callback.
Signed-off-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Abstract AsyncUDPSocket to daemon
This allows this extended asyncore+udp module to be used also in otherdaemons, and in the confd client library
AsyncUDPSocket: Move to a well defined UDP size
Currently we read maximum 4K packets, and don't check packets whensending them. With this patch we move to a well defined maximum size of60K.
Add a magic fourcc code to confd packets
This will make it easier to change the protocol later on
Move fourcc packing/unpacking to main confd module
This way it can be used by the client as well
Fix authorized_keys generation at cluster init
Copy pub_key in authorized_keys.
jqueue: Remove unused run_op_index attribute
Export new lock_status field to gnt-job
Keep lock status with every job
This can be useful for debugging locking problems.
Move OpCode processor callbacks into separate class
There are two major arguments for this:- There will be more callbacks (e.g. for lock debugging) and extending the parameter list is a lot of work.- In the jqueue module this allows us to keep per-job or per-opcode variables in...
Replace last hardcoded 'nodelist' with NV_NODELIST
LUAddNode has this usage remaining, as it's the only other LU to usecall_node_verify (beside LUVerifyCluster).
Treat virtual LVs as inexistent
Currently, “gnt-cluster verify” and “gnt-cluster verify-disks” use thelist of LVs as returned by backend.GetVolumeList to determine whether anLV exists or not. However, LVs can also be ‘virtual’, which is handledcorrectly (i.e. as missing) by the bdev code, but not by this function....
locking: Acquire SharedLock in shared mode in separate function
This is for some more symetry withSharedLock.__exclusive_acquire.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
RpcResult: Fix cases where “failed” wouldn't be set to True
This broke “gnt-instance replace-disks --auto” when the instanceis down.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Olivier Tharan <olive@google.com>
locking: Add level name dict
Merge commit 'origin/next' into branch-2.1
locking: Don't swallow exceptions
This is an indentation bug.
Wrap lines over 80 characters
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Luca Bigliardi <shammash@google.com>
cmdlib: Fix typo in variable name
Move LoadModule function to ganeti.build
It should only be used at build-time.
Add new ganeti.build namespace
This will be used to store build-time Python code.
mcpu: formatting/indenting fix
Small fix for a mistake done by bad editor settings.
Signed-off-by: Luca Bigliardi <shammash@google.com>
Add check for duplicate MACs in instance add
Currently LUAddInstance doesn't check for duplicate MACs, and it failsduring the Exec() phase when trying to add the instance to the config(ConfigWriter checks for this). This patch copies the code fromLUModifyInstance (which already does it)....
Optimise multi-job submit
Currently, on multi-job submits we simply iterate over thesingle-job-submit function. This means we grab a new serial, write andreplicate (and wait for the remote nodes to ack) the serial file, andonly then create the job file; this is repeated N times, once for each...
Add bash completion for --node node1[:node2]
Even more style fixes
KVM hypervisor: Use ReadFile
A few style fixes
Add RAPI resource to redistribute config
Add simple unittest for remote API docs
Move LoadModule function to utils
It can be used by unittests for daemons/* or scripts/*.
utils.CalculateDirectorySize: Don't redefine builtin
Use ReadFile/WriteFile in more places
This survived QA, burnin and unittests.
confd: add cluster master query
confd/querylib: fix docstrings
They were cut&paste from the first example queries, rather thandocumenting the current ones.
Remove SimpleConfigReader.GetHypervisorType
We haven't had that config file entry for a while.
Conflicts: lib/cmdlib.py: Trivial
Return cluster tags from LUQueryClusterInfo
Merge branch 'next' into branch-2.1
Bash completion: Implement dynamic option value completion
Move SimpleConfigReader creation to ConfdProcessor
This will be useful to make ConfdProcessor aware of a config failure,without quitting confd.
Signed-off-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
ConfdProcessor: add disabled state
This is a state the processor will get in, if it fails to load theconfig.
constants: add confd reload and rate limit times
Add errors.InotifyError
SimpleConfigReader: handle stat() errors
Also, catch EnvironmentError, rather than IOError, when trying to readthe file.
Encode the actual exception raised by LU execution
Currently, the actual exception raised during an LU execution (one ofOpPrereqError, OpExecError, HooksError, etc.) is lost because thejqueue.py code simply sets that to a str(err), and the code in cli.py...
Move the luxi error handling into errors.py
Currently the luxi error handling is hardcoded as special encoding onthe masterd-side and special decoding on the client side. This patchmoves it to errors.py such that other parts of the code can reuse thesame encoding....
Remove watcher pause file 1h past end time
Add file to pause watcher for a certain duration
This can be used during maintenance work.
cli._Argument: Remove unused, optional “suggest” parameter
GenerateSecret: specify the length of the secret
Add a parameter to specify the length of the bytes sequence represented by thereturned hex string. Defaulting to 20 so it's compatible with previous SHA1hash.
Signed-off-by: Luca Bigliardi <shammash@google.com>...
cmdlib: Add some messages to LUExportInstance
ganeti-noded: Close listening socket in child
LUDestroyCluster: hooks support
We're going to call hooks from its Exec method so LUDestroyCluster has tosupport them.
LUDestroyCluster: run hooks
Run post hooks on master node before it's removed.
Signed-off-by: Luca Bigliardi <shammash@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
HooksMaster: fix RunPhase logging
In case of complete failure results is empty, return immediately(tnx unittests).
LURemoveNode: no logs running post on removed node
Do not log results from hooks ran on the removed node as now it's done byRunPhase.
HooksMaster: logging hooks in RunPhase
Extend RunPhase so it will log hooks results in POST phase.
rapi: export more static node information
Currently not all static node information is exported over rapi, andthis makes it less complete than gnt-node list. This patch attempts toreduce the difference.
node-remove post on removed node
Run post phase of node-remove on the removed node as well.
HooksMaster: document raised exception
HooksAbort is raised, but not documented.
HooksMaster: list of nodes override
Allow the caller of HooksMaster.RunPhase() to specify an alternative list ofnodes.
Fix error output in LUSetClusterParams
Before: gnt-cluster modify --enabled-hypervisors=xen-hvm,xem-pvm Failure: command execution error: Enabled hypervisors contains invalid entries: set([u'xem-pvm'])
After: gnt-cluster modify --enabled-hypervisors=xen-hvm,xem-pvm...
Add ArgHost class
It expands to the hostnames known by bash.
Re-introduce constants for most often used arguments
Add tools directory to constants
Make all options use cli_option
Change scripts to use new argument definitions
This can be used to generate the bash completion script automatically.In the future it may allow for better command line validation as well.
cli: Add new classes for argument definitions
Add OPMoveInstance and LUMoveInstance
This patch adds a basic version of LUMoveInstance. It doesn't yetsupport iallocator-mode and it's implemented in old-style (non-TL) mode.
Add arbitrary node support to create/remove disks
Currently the cmdlib _CreateDisks and _RemoveDisks always work on theinstance's (current/primary) nodes. This patch extends them to take anadditional target_node parameter denoting that the creation/removal...
Add disk copy support at backend and the rpc level
This uses a simple 'dd if=… | ssh $target dd of=…' method, like theExportSnapshot (which uses the OS export; here we want full disk-levelcopy and not any FS-level changes).
Remove extra argument from HooksMaster class
The mcpu.py:HooksMaster class needs to have a proc attribute/argument toinit in ordet to call its LogWarning method. However, this is availablefrom the 'lu' attribute, so we can remove this dependency.
cmdlib: Fix broken QueryInstanceData for plain instances
Fixes this bug:Failure: command execution error:Can't compute disk status for instX.domain.tld: No error information
Reinsert simple timers in Mainloop
This time we use the standard python sched module, rather than doing itall by ourselves. The scheduler in mainloop can be manipulated directlyby callers, to enter new events.
Signed-off-by: Guido Trotter <ultrotter@google.com>...
Convert the http server/mainloop to asyncore
We can avoid most of the Mainloop.Run() code if we use asyncorefor delivering I/O events, and just concentrate on what's missing inasyncore: singnal handling and timers. This way confd can be ported touse Mainloop as well....
Pass the correct signal to handlers
Mainloop currently calls all handlers with the signal number harcoded tosigchild. Fixing this.
Signed-off-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Olivier Tharan <olive@google.com>
Convert daemon.Mainloop to @SignalHandled
This makes the function a lot simpler, since it used to install twodifferent signal handlers, which are now transparently handled by thedecorator. The code is unindented, but remains unchanged apart from thepart that checks the signal handlers (which is now collapsed toghether)....
Add a new SignalHandled decorator
This decorator can be used to call a function holding with protectionfrom a given signal. The function should accept a dict ofutils.SignalHandler, indexed by signal number, and make use of it.
SignalHandler, only accept list of signals
utils.SignalHandler can accept either a list of signals or a singlesignal, but it's always called with a list. Removing the single signaloption.
Simplify IO waiting in Mainloop
IO is never unregistered in our current usage, so dropping thatfunctionality for now. Also putting the poller outside of the Run()function allows us to avoid the double step of adding tuples to an_io_wait_add queue and adding them later in the main loop....
Remove timers from Mainloop
Timers are currently unused, slightly buggy (for example timeout doesn'tget updated correctly), and unneeded in the current form. Confd willhave timeouts in more simple fashion, and is not a mainloop useranyway.
rapi: Add /2/instances/[instance_name]/info resource
cli: Merge ikv_option and keyval_option into cli_option
Merging them gets rid of two public functions in cli.py and optparse explicitlysupports more than one option type per class.
cli: Use ToStdout/ToStderr instead of print
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Iustin Pop <iustin@google.com>(cherry picked from commit 03298ebe95f393fc77f8acce62e5aa0b95a2bdd0)
Add support for querying the ctime/mtime
This patch adds querying of ctime/mtime for the cluster/nodes/instances.
Add ctime/mtime support to the main ConfigObjects
This patch adds ctime/mtime support to the “main” config objects - theconfig data itself, and the cluster/nodes/instances objects.
These are not added on auto-upgrade, but rather should be migrated if it...
Add utils.FormatTime and a simple unittest
We don't format with subsecond-precision.