Move the hooks file mask into constants.py
This will allow reuse of the same mask for multiple validations.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Security issue: add validation of script names
This patch unifies the search for external script to always go throughutils.FindFile and implements in that function a restriction on validchars in file names and (additionally) that the passed name is the...
Improve LUQueryNodes for lockless case
In most uses of LUQueryNodes, we don't take a lock. This means that theinstance data is not protected across GetInstanceList andGetInstanceInfo, and this can lead to instances not existing anymore.
Switching to GetAllInstanceInfo means that we get a single,...
Ship rapi.rst/rapi.html in the dist archive
Patch 4352bf6 changed RAPI docs to RST from the previous SGML format(the last file to be converted to RST).
However, it didn't add rapi.rst to the docrst Makefile variable, and assuch rapi.html was neither build nor shipped in the archive. We fix this...
Fix burnin's verbose mode
The timestamp need special formatting, which was done for the internalbuffer storage but not for the messages logged in verbose mode. Thispatch unifies the formatting for these two cases.
Signed-off-by: Iustin Pop <iustin@google.com>...
Final NEWS update and version increase for 2.0.4
QA passed successfully, let's try to have a release.
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....
Fix the confusing ssh/hostname message in node add
Before, it used to say:
ssh/hostname verification failed node1.example.com -> hostname mismatch, got node2
Now it says for wrong hostnames (maybe too verbose):
ssh/hostname verification failed (checking from node1.example.com): hostname...
Add man page for ganeti-cleaner
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Update NEWS file for version 2.0.4
We don't bump up the version yet, pending more QA tests.
Automatically cleanup _temporary_ids at save
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>(cherry picked from commit 34d657bae4361b9d6fd8c6314dc7cca57b51c773)
Separate the computation of all config IDs
We will need this in another place, so we abstract the 'compute allcurrent IDs' functionality into a separate function. We also change thename of the _ComputeAllLVs to _AllLVs to match the other _All*sfunctions....
Change config upgrade to be explicit
Currently the config upgrade is done at each object instantiation, thatmeans that ganeti-noded will run UpgradeConfig on all objects receivedremotely (instances, disks, nics). This is not so good, so this patchchanges it so that only the ConfigWriter runs this method at...
Merge commit 'origin/next'
Fix gnt-job info entry in gnt-job(8)
It currently reports "cancel" in its syntax, which is obviously acut&paste error.
Signed-off-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Fix gnt-node modify online help
This completes what was began in commit862b1b2b4c698cec8ad816793172fac9aa7f4cdf
locking: Don't swallow exceptions
This is an indentation bug.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Guido Trotter <ultrotter@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)....
scripts/gnt-node: fix a help string
gnt-node modify says it wants an "<instance>". Changing it to"<node_name>" as for the other commands.
Signed-off-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
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...
Extend gnt-debug with more debugging options
This patch extends gnt-debug to be able to submit multiple copies of theinput jobs and job contents, in order to simplify testing. It also addsa timing mode, and splits the execution into separate submit and...
Return cluster tags from LUQueryClusterInfo
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Olivier Tharan <olive@google.com>
Add script to clean archived jobs after 21 days
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.
Fix unittest breakage due to new test file
Fix /proc/drbd parsing in presence of gaps
In case there are gaps in /proc/drbd related to the minors sequence,this can lead to empty lines (see the attached data file). In this case,we currently fail to parse the file correctly.
The patch fixes this by skipping empty lines in...
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>
repair-size: ensure child disks have sane sizes
While this patch doesn't do a full match of on-disk size to config-sizefor child devices, it does a sanity check (for DRBD only) that the childsize is not less than the DRBD size. While this would be a strange...
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)
Fix small typo in gnt-node
The iallocator option is '-I' not '-i'.
Simplify handling of boolean args in rapi
This patch replaces hardcoded boolean-type args withbool(_checkIntVariable). There should be no other cases of this left, Ithink.
Fix checks in LUSetNodeParms for the master node
There was a check already in the LU for the master node, however iswasn't correct. This patch disallows any role changes on the master nodevia LUSetNodeParms (and as this LU can't change anything else, it...
Improve the example startup script
Currently, the supplised script has two issues: - it doesn't use start-stop-daemon --start correctly, leading to messages like "ganeti.errors.GenericError: /var/run/ganeti/ganeti-rapi.pid contains a live process" in the logs...
Fix insserv dependencies
(import of a Debian patch)
This patch removes xend from the list of dependencies.
Ganeti doesn't need xend running to startup, it will only need it later(and only if xen is used as virtualisation technology). It also removes'Xen' from the description in the init script....
Fix a typo in InitCluster
Signed-off-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Iustin Pop <iustin@google.com>(cherry picked from commit 022c3a0b36cb60644b6861ff27ad59202883963c)
Ignore results from drained nodes in iallocator
Since drained nodes could be (partially or fully) broken in iallocator,we ignore results from these nodes when building the cluster map inpreparation for sending it to the script.
This is a cheap change for the stable branch; ideally we should not...
Ship the ethers hook
doc/examples/hooks/ethers has been added without being shipped in thereleased tarball. Putting a stop to this.
Fix yet another bug in LURepairDiskSizes
This is a result of broken copy-paste, and because needed_locks is not adict right here it will error out.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Ethers hook, compatibility with old lockfile
Remove "-l" option since some ancient systems ship a version of lockfile-progsnot supporting it.
Signed-off-by: Luca Bigliardi <shammash@google.com>
Remove a few unused imports from noded/masterd
Signed-off-by: Guido Trotter <ultrotter@google.com>
Fix a bug in LURepairDiskSizes
The same old story: disks need SetDiskID before being sent to remotenodes.
Upgrade be/hv params with default values
From time to time we're adding new be or hv parameters. With this patchmissing parameters get set to the default value when loading the clusterobject. This patch version also considers the case when hv/be params...
Implement the KERNEL_PATH parameter for xen-hvm
For the xen-hvm hypervisor, the KERNEL_PATH parameter is needed buttoday is hardcoded to a constants in the xen hypervisor library (argh!).
This patch moves this to a hypervisor constant with the default value...
Move HVM's device_model to a hypervisor parameter
This moves yet another hardcoded value to a hypervisor parameter. Iremoved the 64/32 difference as it doesn't seem valid to me - it's moreof a local site config rather than arch config.
objects: add configuration upgrade system
Add a very basic configuration update mechanism to objects.An object can define the UpgradeConfig method, which will be called atinit time, and use it to fill in missing defaults in the configuration.In the future we may want to make it more complex, for example adding...
Add cluster-init --no-etc-hosts parameter
If --no-etc-hosts is passed in at cluster init time we set a newparameter in the cluster's object to false, and avoid adding nodes tothe hosts file. The UpgradeConfig function is used to set the value toTrue, when upgrading from an old configuration version....
Merge branch 'master' into next
Update NEWS and version for 2.0.3 release
example ethers hook: use lockfile-progs
Rather than writing our own locking routing, use the one implemented bythe lockfile-create program.
ethers hook lock: use logger not echo
Overwrite debugging 'echo's
Signed-off-by: Luca Bigliardi <shammash@google.com>Signed-off-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
ethers hook: reduce the probability of data loss
The hook was exiting immediately if lock was not acquired, entering a timedloop to have more chances when acquiring the lock.
Signed-off-by: Luca Bigliardi <shammash@google.com>Signed-off-by: Guido Trotter <ultrotter@google.com>...
devel/upload: revert rsync -p
The permissions replications also will change the permissions on the /and /usr directories, which is bad. This reverts it to the originalbehaviour.
export: add meaningful exit code
Currently ‘gnt-backup export’ always returns exit code zero, even in theface of complete failure during backup (only failure to stop/start theinstance will cause job failure and thus non-zero exit code). This isbad, since one cannot script the backup....
Fix detecting of errors in export
This should fix issue 61, by explicitely calling bash (which is is now anon-explicit dependency) and setting the pipefail command.
Implement gnt-cluster check-disk-sizes
This patch adds a new opcode and lu for checking disk sizes. Currentlyit does only top-level disk verification, and also doesn't checkprimary/secondary node size mismatches (these two are added as TODOs inthe Exec() function of the LU)....
rpc: add rpc call for getting disk size
Note that this exports the disk size as bdev returns it, in bytes. Thevalue will be converted to MiB in cmdlib.
bdev: Add function for reading actual disk size
This patch adds a GetActualSize for block devices that returns theactual disk size. It is done using blockdev (and stat for file storage).
While this could be done via reading /sys/block/N/size, that is not as...
Implement --ignore-size in activate-disks
This patch modified OpActivateDisks, LUActivateDisks and gnt-instanceactivate-disks to support and pass this option to_AssembleInstanceDisks.
The patch is quite trivial I think; there should be no issues from it...
Add ignore size support in _AssembleInstanceDisks
This patch adds an optional parameter to _AssembleInstanceDisks thatallows ignoring of size information by making a copy of the diskstructure and setting the size to zero.
Add a objects.Disk.UnsetSize() method
This method recursively resets the size of the disk and its children tozero.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
bdev: allow ignoring of size in Assemble()
This patch changes the DRBD8 class (the only one to use the size inAssemble) to ignore the size in Assemble when a zero size is passed.This will allow activation of disks even when the size recorded in theconfiguration is wrong....
Fix instance import net option
This is identical to dc30b0e4 but applied to gnt-backup. Thanks to userocaner for catching it.
Simplify the devel/upload script
Instead of multiple uploads to each node, this script copies everythingas needed to the temporary directory, exactly as to be installed in thedestination machine, then runs only one rsync per host.
This is more dangerous (we can break /etc now), but for development...
Add a Copy method to object.ConfigObject
This small patch adds a simple Copy method that is can be used for'throw-away' copies of objects.
Add “gnt-job watch” command
This command can be used to follow the output of a job. It's usefultogether with the --submit parameter for other commands.
jqueue: Fix error when WaitForJobChange gets invalid ID
When JobQueue.WaitForJobChange gets an invalid or no longer existing job ID ittries to return job_info and log_entries, both of which aren't defined yet.
Signed-off-by: Michael Hanselmann <hansmi@google.com>...
jqueue: Update message for cancelling running job
Extend call_node_start_master rpc with no_voting
When the parameter is set to True and start_daemons is also True,ganeti-masterd will be started with the new --no-voting --yes-do-itoptions.
This new option is set to True only on masterfailover, when no_voting is...
lvmstrap: Change diskinfo to use GenerateTable
This way the produced table is formatted nicely.
Signed-off-by: Stephen Shirley <diamond@google.com>Signed-off-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Get rid of constants.RAPI_ENABLE
This constant is unused, except in qa. Removing it since it's always True.
This patch also removes the unused qa_rapi.PrintRemoteAPIWarningfunction, and removes a comment about temporary constants "until we havecluster parameters"....
Remove references to utils.debug
Various modules set it to True when called in debugging mode, but theutils module supports no such global.
ganeti-rapi, replace hardcoded exit value
substitute exit(1) with exit(constants.EXIT_FAILURE).Also fix a wrongly indented line.
Add the bind-address option to ganeti-rapi
noded: Abstract hard-coded sys.exit value
On machines without the ssl file noded exists '5'.Changing this to constants.EXIT_NOTCLUSTER.
Also utils.GetNodeDaemonPort hasn't risen errors.ConfigurationError fora while, so removing that try/except block....
Add an example "ethers" hook
This hook can be used to update /etc/ethers with instance's macaddresses. A dhcp server on the nodes can then serve to the instancestheir correct address. (This has been tested with dnsmasq's dhcpimplementation)
burnin: move batch init/commit into a decorator
Many burnin steps initialize the batch queue at the beginning and commitit at the end of their operation. This patch moves this code to adecorator, in order to reduce redundant code.
burnin: move instance alive checks to a decorator
Many burn steps to a manual check of instance aliveness, via duplicatecode. This patch moves this code to a decorator.
burnin: Implement retryable operations
Some burnin steps are idempotent: e.g. reinstalling an instance (fromburning p.o.v.) can be done multiple times without any side-effects thatwould affect later burnin steps. As such, failing the whole burninprocess due a reinstall failure is undesirable....
Ignore vim swap files
burnin: fix removal errors hiding real errors
A long-standing bug in burnin makes errors during the removal phase(e.g. because an import has failed, or because the initial creation hasfailed) hide the original error.
This patch suppresses removal errors if we are already in ‘has_err’...
backend: Only build once the list of upload files
The list of upload files is built currently at every UploadFile() call.This patch moves it to a separate variable which is initialized onlyonce.
This won't make much difference but I regard it as cleanup....
Fix gnt-instance reinstall
Commit 55efe6dabe48e5c37dc1ff6099e0bb8afde7a468 "Convert instancereinstall to multi instance model" actually broke instance reinstall forsingle-instance cases. This one-liner fixes it.
Fix a couple of epydoc warnings
It seems epydoc needs fully-qualified references, and doesn't deal withrelative ones (not even in the current module) if there are anyambiguities.
There are other epydoc warnings, in the rapi docstrings, but those areleft as-is as they're removed in 2.1....
job queue: fix loss of finalized opcode result
Currently, unclean master daemon shutdown overwrites all of a job'sopcode status and result with error/None. This is incorrect, since theany already finished opcode(s) should have their status and resultpreserved, and only not-yet-processed opcodes should be marked as...
Switch gnt-debug submit-job to JobExecutor
Currently gnt-debug submits jobs individually, but in 2.1 JobExecutoruses the optimized SubmitManyJobs luxi call and as such should be usedwhenever multiple jobs need to be submitted.
This patch converts gnt-debug submit-job to use it and also removes an...
gnt-instance batch-create: use the job executor
This small patch changed the batch create functionality to use the jobexecutor instead of single-job submits.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>...
Convert instance reinstall to multi instance model
This patch converts ‘gnt-instance reinstall’ from single-instance tomulti-instance model; since this is dangerours, it's required to pass“--force --force-multiple” to skip the confirmation.
Modify cli.JobExecutor to use SubmitManyJobs
This patch changes the generic "multiple job executor" to use the manyjobs submit model, which automatically makes all its users use the newmodel.
This makes, for example, startup/shutdown of a full cluster much more...
Add a luxi call for multi-job submit
As a workaround for the job submit timeouts that we have, this patchadds a new luxi call for multi-job submit; the advantage is that all thejobs are added in the queue and only after the workers can startprocessing them....
job queue: fix interrupted job processing
If a job with more than one opcodes is being processed, and the masterdaemon crashes between two opcodes, we have the first N opcodes markedsuccessful, and the rest marked as queued. This means that the overall...
Fix an error path in job queue worker's RunTask
In case the job fails, we try to set the job's run_op_idx to -1.However, this is a wrong variable, which wasn't detected until theslots addition. The correct variable is run_op_index.
Add slots on objects in jqueue
Adding slots to _QueuedOpCode decreases memory usage (of these objects)by roughly four times. It is a lesser change for _QueuedJobs.
ganeti.initd: Pass $*_ARGS to programs when restarting them
Optimizie OpCode loading
This patch converts the opcode loading to a pre-built map (at importtime) instead of iteration over the globals dict at each call.
Microbenchmarks show that this should be around three times faster, andburnin still passes.
Yet another fallout from the pylint fixes
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Olivier Tharan <olive@google.com>
Fix another issue with hypervisor_name change
Update NEWS and version for 2.0.2 release
Improve the description of node flags in man page
[iustin@google.com: slightly reworded the explanation for offline andchanged the commit message]Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Iustin Pop <iustin@google.com>