Fix uses of OpPrereqError without code info
A while back, we did cleanup the code and ensured (manually) that useof OpPrereqError includes an errors.ECODE_* field as secondargument. Since we cannot automate the check for this, it turns outthat more and more such usage has crept over the years, including in...
Front-end and doc to use allocator in recreate-disks
The recreate-disks command no longer requires an explicit list of nodes.
Signed-off-by: Adam Ingrassia <api@google.com>Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Allocator support in recreate-disks LU
This affects only the backend.
Added method to call an allocator for recreate-disks
Ideally this should have used relocation mode, but to due lacking ofsupport in current allocators, allocation mode has been used instead.
Signed-off-by: Adam Ingrassia <api@google.com>Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>...
Support for checking the group of only the primary node
_CheckInstanceNodeGroups behaves in the old way with the default valueof the new parameter.
Signed-off-by: Adam Ingrassia <api@google.com>Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Make error classes more consistent
This removes "pass" from a few definitions, making all errorsconsistent.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: René Nussbaumer <rn@google.com>
Add support for -cpu option in KVM
This adds supports for the (non-validated) cpu parameter to KVM.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Merge branch 'stable-2.6'
Fix setting ipolicy on node groups
On node groups we don't have the std field. However, the InstancePolicyobject always verifies that the std value is within a given range. As wefill it up with defaults if not set (as it happens to be on node groups)and the min value is higher than the default std value (taken from...
Fix --no-headers for the new list-drbd command
Sorry, I forgot that with GenerateTable this needs to be handledmanually. Fixed now and tested in both ways.
(But to be honest, this should be abstracted in GenerateTable, insteadof the 'if' test in all its callers.)...
Add a new gnt-node command list-drbd
This uses confd to query the DRBD minors, which is very special; noother command currently does so.
Since the backend is only implemented in the Haskell version of confd,we have checks that 1) confd is enable, and 2) hs confd is also...
Add a new unused confd query
This is not implemented currently.
Fix a docstring in bdev's DRBD8 class
It seems this was not updated since the move to static minors…
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Agata Murawska <agatamurawska@google.com>
Ensure that disk.params is always defined (and a dict)
Commit cce46164 fixed upgrading from other 2.6 versions, butaccidentally broke upgrading from 2.5 (disk.params was left as None,which breaks FillDict). The simplest way to handle params is to always...
Another small consistency fix with if branches
While looking at the testability of this piece of code, I found anotherconsistency problem. We have two if branches instead of one, withelif's.
Signed-off-by: René Nussbaumer <rn@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Fix inconsistency in the LUXI protocol w.r.t. args
This inconsistency was found during rebalancing. Hbal failed because,Ganeti couldn't load the opcode. After digging through the cause, aninconsistency with the "args" field in the LUXI protocol was triggered...
Fix UpgradeConfig of Disk object regards disk params
This bug was found during disk parameter debugging. While looking at theconfig some values seem present on the disk parameters, but that's notexpected behaviour. This patch fixes this, and also fixes the "broken"...
Allow reinstall even when secondaries are offline
Signed-off-by: René Nussbaumer <rn@google.com>Reviewed-by: Agata Murawska <agatamurawska@google.com>
Ignore offline node errors when removing disks
When we delete DRBD disks from some instance, we do not want to geterrors due to nodes other than that instance's primary being offline.
Signed-off-by: Agata Murawska <agatamurawska@google.com>Reviewed-by: Iustin Pop <iustin@google.com>...
Allow instance disc activation with offline secondaries
Currently, this is not allowed, so one can't run a replace-disks; thisbreaks any non-invasive method of recovering the redundancy of theinstance if its disks are already stopped (but it still works if the...
RAPI regression beparams/memory fix
For compatibility with the old Ganeti version, we want to keep thebeparams/memory field around for another release. This patch fixes thisregression.
Add --wait-for-sync in gnt-instance
Note that this needs (like for the opcode) a new option, with thedefault reverted (False instead of True).
9Add wait_for_sync flag to OpInstanceActivateDisks
This can be used to ensure that after activate-disks has returned, theinstance's storage is consistent; currently there's no programmaticway to do this.
Fix DRBD resize code
There are two bugs in the current resize code, affecting mostly DRBD.
First, due to bugs in old DRBD versions (pre 8.0.14), the code currentlycalls `drbdsetup resize' on both the primary or secondary. However,this is actually wrong per current DRBD (from drbdsetup(8)):...
Fix redistribution of files w.r.t. offline nodes
Currently, _RedistributeAncillaryFiles computes two lists: the list ofonline nodes (for all files redistribution), and the list ofvm_capable nodes, for hypervisor-specific files. However, thevm_capable list includes offline nodes too, leading to warning...
Fix cluster verify error on master-ip-setup script
This error does not show up until we exceed the pool of mastercandidates and have nodes which are not master candidates.
The background is that we check for master-ip-setup script on mastercandidates and expect them not to be on the other nodes. However, we...
Fixed spaces/indentation according to guide lines
Problem introduced by commit 87f0aa4896ac4dfacc9d20bc55b0855282b4d1d4.
Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Fix small bug with a space in the hv_xen module's line
Remove a useless space at the end of the line in a config file.
Signed-off-by: Jack Sitnikov <sitnikove@gmail.com>Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>
Allow param `modify' during gnt-instance modify
With the new gnt-instance modify syntax for addition and removal ofdisks/NICs on arbitrary indexes, we hit an assertion if the userpasses `modify' as one of the disk's parameters. E.g::
gnt-instance modify --disk 2:modify,size=3G instance1...
Add PCI passthrough for hvm xen
This hv parameter allows passing PCI devices to virtual machines.
Signed-off-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Annotate disk params on instance_os_add
We call _OpenRealBD during the process and this needs disk parameters towork. This was reported by Constantinos.
The fix is very ugly though.
Annotate disks upon blockdev_shutdown
Annotate disks on blockdev_remove
This annotates the disks for the blockdev_remove where it isappropriate. It leaves out 2 cases were we can't reliably annotate diskparameters due to lack of knowledge what we should annotate. Those casesaffects only lvs used for drbd, so it doesn't affect the bug reported by...
Annotate disk params on blockdev_getmirrorstatus_multi
This is also related to the bug reported by Constantinos,as we've only one getmirrorstatus_multi call in whole cmdlib, we justannotate them while we are building the disk list.
Signed-off-by: René Nussbaumer <rn@google.com>...
Annotate disk parameters on blockdev_getmirrorstatus
Not annotating them works for DRBD but not for RBD as reported byConstantinos.
Add summary field to OpNodeModifyStorage
Fix bug in instance net changes
_PrepareNicModification returns the invalid type, which triggers anassert resulting in a mysterious error:
Failure: command execution error:
Without any explanation. We fix this by removing the return value from_PrepareNicModification, and instead returning the expected type...
Allow single-homed <-> multi-homed transitions
To change the cluster from single homed to multi homed or vice versa onemust target the master node first, and pass the --force option. Allother nodes then will work as long as they are reachable by the master....
bdev: Fix DRBD error reporting for syncer rate
The function is supposed to return a list, not a string. Without thispatch the error message ends up as “C, a, n, ', t, , c, h, a, n, g, e,…”.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Iustin Pop <iustin@google.com>...
Fix inconsistent punctuation in rapi docs and opcodes
While reviewing the RAPI docs (for commit 003306f9), I realised thatthe punctuation used in RAPI is inconsistent, especially with regardsto definition lists.
This patch changes all such lists to not have punctuation, except for...
Export more information in RAPI group queries
Sadly we don't have a way to test that, for example, all(G|N|I)Q_CONFIG fields are exported in RAPI, so for now we don't testthis; but we should, in the future.
Signed-off-by: Iustin Pop <iustin@google.com>...
Verify the options on diskparameters
This prevents from setting for example drbd options on the plain disktemplate.
Signed-off-by: René Nussbaumer <rn@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Verify user supplied dicts against defaults
This verifies the user (especially in nested dicts) does notprovide a key which is not seen in the defaults dict for that dict.
query: Comparison of timestamps, job IDs
This patch adds the necessary conversions for comparing split timestamps(such as used by jobs) and job IDs (by defining custom converters).Unittests are included.
Signed-off-by: Michael Hanselmann <hansmi@google.com>...
jqueue: Move functions related to job ID to jstore
These don't really need to be in jqueue, and a new function willbe added to convert job IDs to an integer for queries.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: René Nussbaumer <rn@google.com>
query2: Add <, >, <=, >= comparison operators
These can be used, for example, to get jobs submitted after a certaintimestamp.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Fix creation of plain instances with --no-wait-for-sync
As reported on the devel mailing list by Christos Stavrakakis,creation of plain instances is broken when the --no-wait-for-sync flagis passed, because in that case WaitForSync is not called, hence...
Fixed typos, formatting, etc and added a comment
This patch only touches comments and man pages.
Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Fix epydoc raises L{...} usage
For epydoc raise statement, it already expects an exception which willbe hyperlinked; if passing an L{…} construct, it will instead breakthe formatting (the @raise will not be recognised, but merged into theprevious paragraph)....
Merge branch 'stable-2.5' into stable-2.6
Move KVM keymap from GenerateRuntime to ExecuteRuntime
Per issue 243, "side-effects" are GenerateRuntime are bad as theyexecute only on the initial node of the instance. By moving thewrite-out of the keymap file to ExecuteRuntime, it will be done bothat start and at migrate time....
Add the keymap directory to the list of runtime KVM dirs
Commit 4f580fef added the keymap support, but missed that thisdirectory needs to be ensured/created at hypervisor init time.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Improve error message for auto-promote/node modify
This has been reported internally 3-4 times already, and the currentversion (from 8b437a6e) is still not good enough, it seems.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Move the ssconf file prefix constant to constants.py
This way, it can be reused in the Haskell code too.
Fix a type issue and bad logic in cluster verification
Commit 2e04d454 introduced the new offline state for the instancestate, but being a big monolithic patch it sneaked in something thatdoesn't make sense.
The checks for extra instances (either wrongly up or just unknown) are...
Support xl as a xen interface command
xm and xl are mostly compatible, there is just a change in migrate,which for now we simple bridge by comparing the command string.
Also XEN_CMD is now set during configure time. This will then be fixedin Ganeti 2.7 when we make it an hvparams....
Fix GenericCurlConfig when pycurl is linked against nss
Redhat links its pycurl against NSS/ so this check fails and thereforemakes ganeti-watcher unusable.
Even though this seems to fix the problem and works, further testing onthis might be needed.
Document that the disk/hypervisor state is not used
This didn't get completed in time for 2.6, so we document that it'snot working as is. Well, it's not broken, just not used by anything.
Re-wrap some lines in watcher code
These were using exactly 80 chars, and I like them smaller.
_MaybeParseUnit: The elements are dicts not arrays
Make it possible to reset vcpu/spindle ratio to default
Add man page documentation for cpu_mask hv parameter
This is adapted from the design doc.
Also fixes a typo in cmdlib.py.
gnt-group: Adding vcpu/spindle ratio to ipolicy flags
gnt-cluster modify: Add ipolicy for spindle ratio opt
cli: Add ipolicy_spindle_ratio to CreateIPolicyFromOpts
gnt-instance info: Rework beparams listings
This patch reworks the beparams listing to the new style. However, dueto this process the naming of the fields with mixed casing changed tolowercase and is therefore not 100% compatible with the previous versions....
constants: Add FIXME regarding CPU pinning bitfield
Allow units in ipolicy disk/mem CLI changes
This makes "gnt-cluster modify --specs-mem-size max=16g" work. Thedownside (due to how we iterate) is that error messages are not veryclear:
$ gnt-cluster modify --specs-mem-size max=16a Failure: prerequisites not met for this operation:...
Move some ipolicy functions from objects to cli
These are only used in CLI programs to parse command line options andsuch they do not belong in object.py (I will change them more and Idon't want to add more code in objects.py).
Beautify a couple of error messages
Fix _ComputeNewInstanceViolations logic
This function did the opposite: was computing which old instanceviolated the specs but no longer do it now. new - old is the expectedbehaviour.
Beautify disk ipolicy violations in cluster-verify
Currently, we only get:
instance3: ['disk-size value 512 is not in range [1024, 1048576]'
which doesn't explain which disk we are talking about. This patchextends the verification functions to take an additional parameter...
LUInstanceCreate: Run rename script on instance import
If an instance is imported with a different name, network settings may have tobe changed. Since import scripts may not already to the right thing, we decidedto run the rename script. The same technique is already used for inter-cluster...
gnt-group add: Fix diskparam fill
This was a pretty non-obvious bug. A cluster looks sane aftergnt-cluster init, however on a daemon restart the diskparameters had thedefault filled in. The same applies to gnt-group add. This is due to thenature that UpgradeConfig() from NodeGroups did just populate them with...
gnt-group modify: Fix an update issue with diskparams
gnt-group: Add info command
cli: Make FormatParameterDict recursive
This is useful if you have nested parameter dicts like in diskparams.
query: Expose diskparamters through query
gnt-cluster info: Print and format disk parameters
Merge branch 'devel-2.5'
Merge commit 'v2.5.1' into devel-2.5
Remove some duplicate code in the Xen config writing
Should be straightforward; the only difference from before is that wewill remove the 'auto' file even during migration finalise.
Fix gnt-group --help display
Copy-paste mismatch :)
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>(cherry picked from commit 36c70d4ddc508dd1ffdcc806d617d5100f4cb265)
Fix hardcoded Xen kernel path
We already have a ./configure-time variable for this, but it seems tobe actually unused.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>(cherry picked from commit 3c4afa2e93d9499ce39c1aed575dacb549d35083)...
Fix grow-disk handling of invalid units
The reason why grow-disk was doing:
$ gnt-instance grow-disk instance3 0 -64Unhandled Ganeti error: Invalid format
Is because it does it's own ParseUnit call, and doesn't transform thatinto a nicer message.
Accept both PUT and POST in noded
This is a partial cherry-pick from7530364ddbe949bc34fc26f25ba3f5d921beb021 on master:
Currently, noded requires PUT, even though the semantics of the RPCcalls do not match a PUT. We change the code accept both PUT and POST,...
Update synopsis for “gnt-cluster repair-disk-sizes”
Mention that instances can be passed on the CLI when “--help” is used.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Andrea Spadaccini <spadaccio@google.com>(cherry picked from commit eb5ac108d146644200df98b9f90dae003dcea426)...
Workaround changed LVM behaviour
The vgreduce command has changed behaviour from when we initiallywrote the code (2.02.02 versus 2.02.66, 4 years delta):
- if there are LVs which will be impacted, it requires --force- otherwise refuses to proceed, but it still returns exit code 0...
apidoc: Fix some typos and errors introduced by my previous patches
bdev: Add a guard to verify disk parameters are set
LUGroup*: Fix inheritance of disk parameters
bdev: Take the params directly from disk without refill
Special case blockdev_find
Similiar to blockdev_create we sometimes do find on children. This fixesthose cases. However, this is not very nice.
Special case blockdev_create
This is due to the nature of bdev. We spread some logic into cmdlib anddeal for example with it's children recursively. This makes it hard toannotate the disk parameters in a generic way as we don't always dealwith the top most disk. But the disk parameters are depending on the top...
cmdlib: Adding annotation helper for special cases
cmdlib: Remove all diskparams calculations not required anymore
cmdlib: Adapt the rpc calls
The following (blockdev) RPC calls are not converted yet (as they arenot straight forward or need more research):
rpc: Adapt the callbacks to the new encoder type
We change the cmdlib side on the next patch.
rpc: Adding new encoders for annotating disk parameters