storage: Add operation for “vgreduce --removemissing”
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
storage: Add new function to execute operations
cmdlib: Add function to list all instances on node
cmdlib: Use common function to list instances on node
This will be used by another new function, too.
cmdlib: Make TLReplaceDisks._FindFaultyDisks global
It'll be used for repairing storage units.
gnt-node: Use helper function to convert storage type
Remove obsolete ConfigObject.__setitem__
setitem is used to emulate container objects. We don't use this, andthe method is not used in a couple of normal operations (add/removeinstance, add/remove disk).
Signed-off-by: Iustin Pop <iustin@google.com>...
Implement instance recreate-disks
This can be used for a 'plain' type instance when the underlying storagewent away, to recreate the storage (and reinstall) instead of removingthe instance and readding it.
TLReplaceDisks: Refuse changing secondary for specific disks
We move all disks anyway.
rapi: Add /2/instances/[instance_name]/replace-disks resource
rlib2: Remove leftover DOC_URI constant
Merge commit 'origin/next' into branch-2.1
gnt-instance replace-disks: Add new --auto option
cmdlib: Add new automatic disk replacement mode
TLReplaceDisks: Simplify argument checking logic
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...
InstanceIpToNodePrimaryIpQuery
This implements CONFD_REQ_NODE_PIP_BY_INSTANCE_IP, and maps instance ipsto primary node ips.
Signed-off-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
querylib: abstract a couple of common errors
Rather than composing them every time, we'll keep "ready-made" tuplesfor unknown entries and internal errors (which is, yet, unused)
SimpleConfigReader: add IP address lookup helpers
Add the following functions to SimpleConfigReader:GetInstanceByIp, nic ip -> instance nameGetNodePrimaryIp, node name -> node primary ipGetInstancePrimaryNode, instance name -> primary node
For the first one we precalculate the _ip_to_instance, so we don't have...
Add NodeRoleQuery
This implements CONFD_REQ_NODE_ROLE_BYNAME.
Remove unused imports from confd files
confd.server and daemons/ganeti-confd import a few modules they don'tactually use. Clean them up.
Signed-off-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
ConfdProcessor fix init docstring
The message is an error deriving from some code moving/refactoringhappening before the initial submission
Add constants for a ping confd request
Implement confd queries
We'll start with a simple ping query, which returns ok if it gets noquery argument, and an error if it gets any. Also non-implemented queryare handled by the base ConfdQuery class, so we don't have tospecial-case them in ConfdProcessor anymore....
ConfdProcessor: move verification to init
During a query execution we currently verify whether we have that querysupported in our dispatch table. Since it's an error not to have itanyway, we move this verification to the class creation, erroring out...
Add a missing node role
Apart from being a master, a candidate, offline or drained, a node canhave one more state: none of those. Adding back the normal, nice,healthy "just" a node! :)
Add a common error code for confd
If we standardize common error codes, clients can make use of them toreact, rather than trying to parse error strings.
SimpleConfigReader.GetNodeStatusFlags
Adding a way to retrieve the three node status flags, all in one go,from SimpleConfigReader. Non-existing nodes are handled by returning"None".
Design-doc: update RedistributeConfig changes
Rewrite the part which discusses the global list of files to be distributedupdating with the description of what is going to be implemented. Just readbelow..
Signed-off-by: Luca Bigliardi <shammash@google.com>...
rapi: Add /2/nodes/[node_name]/storage/modify resource
rlib2: Import rapi
This fixes ganeti-rapi which was broken in commit 7a95a954.
rapi: Add /2/nodes/[node_name]/storage resource
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Ship the ethers hook
doc/examples/hooks/ethers has been added without being shipped in thereleased tarball. Putting a stop to this.
Constants: config directories cleanup
Use variables already defined.Introduce ganeti CONF_DIR.
Signed-off-by: Luca Bigliardi <shammash@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Ssconf IP lists: change separator
Use " " instead of ",".
Signed-off-by: Luca Bigliardi <shammash@google.com>
Map Node/IP in ssconf IP lists
Map the node hostname with its primary/secondary ganeti IP in ssconf.In this way a node can discover which are its IPs simply grepping ssconf files,thus avoiding checks depending on network configuration.
Ethers hook, compatibility with old lockfile
Remove "-l" option since some ancient systems ship a version of lockfile-progsnot supporting it.
Remove a few unused imports from noded/masterd
Signed-off-by: Guido Trotter <ultrotter@google.com>
init script: handle ganeti-confd as well
Adding ganeti-confd to the example init script. The daemon itself willonly start on master candidates, but the init script can just try tostart it on all nodes.
Signed-off-by: Guido Trotter <ultrotter@google.com>...
Initial confd implementation
ganeti-confd is a simple asynchronous daemon, which listens on a UDPport, passes each packet to a processor, and sends back to the clientthe result.
It also listens on an inotify socket, in order to reload itsconfiguration when the ganeti config file changes....
confd.server.ConfdProcessor
A ConfdProcessor is the job processor for a confd query.It's responsible for all the processing, from unpacking it, verifyingit, to calculating the result.
Add empty ganeti.confd module
It will be used for the confd server code, and for a basic clientlibrary.
SimpleConfigReader: s/Reload/_Load/
Since we use it also to load the config file initially we rename theReload function to _Load. Then we re-export it as Reload to clients(since for them it's a reload).
SimpleConfigReader.Reload, avoid double reloads
If for some reason we try to call Reload twice but the config filehasn't changed, we don't want to load it again. Use stat() on the fileto cheaply avoid that situation.
We also return a boolean value, according to whether we have reloaded...
Basic exceptions used by confd
Reply status constants for confd
These are valid values for the "status" field in objects.ConfdReply
constants for the confd daemon
Adding the various basic daemon constants for confd.
Run post cluster initialization LU
Call PostInitCluster from 'gnt-cluster init'.
Post cluster initialization LU
Add an 'empty' logical unit to run hooks after cluster initialization.
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....
design-2.1: Change OS Flavours with OS Variants
This is the terminology used by libvirt, it's shorter, clearer, and itmakes sense. :)
Also the final sentence about "possible futures" is changed to be a bitmore clear.
serializer.DumpSignedJson
Don't indent the final message.
SimpleConfigReader: add serial numbers reading
GetConfigSerialNo and GetClusterSerialNo return respectively the serialnumber for the config and for the cluster object.
constants: confd node roles
confd will return the node role as an integer, which represents one ofthe mutually exclusive roles a node can be in.
Merge branch 'master' into next
constants: confd query types
Initially confd will support only two queries:
CONFD_REQ_NODE_ROLE_BYNAMEGiven a node name, return its role.
CONFD_REQ_NODE_PIP_BY_INSTANCE_IPGiven an instance ip, return its node primary ip.This rather weird query is the basis for ganeti nbma lookup....
design-2.1: detail confd wire protocol
Until now it was being kept too vague, so here we give some realexamples of how things are going to be.
Update NEWS and version for 2.0.3 release
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
SimpleConfigReader.Reload()
Rather than initializing the config statically at class creation time,we load it every time Reload() is called.
Confd{Request,Reply} objects
These objects are used to store confd queries and replies.
Serializer, remove salt_verifier functionality
The salt needs to be returned anyway, so we don't have to add anotherkey for the sender to recognize which request an answer is answering, soall that infrastructure is useless. :(
pyinotify: configure checks and documentation
After 74d519e3b91845a17ae095eb7d58dd9e3d1303e8 Ganeti depends onpyinotify. Updating the documentation accordingly and checking for itspresence at configure time.
asycnotifier.AsyncNotifier
AsyncNotifier is a special asyncore class that delivers inotify eventsasynchronously.
SimpleConfigReader: Handle errors when loading
Handling both IOErrors and ValueErrors (thrown by the simplejson loader)
ssconf.CheckMasterCandidate
This function checks that the current node is a master candidate, andterminates otherwise. It will be used upon ganeti-confd startup.
Convert ldisk_degraded to tri-state value
This allows us to report “uncertain” states (LDS_UNKNOWN) for caseswhere the code can't easily detect or report what's wrong with ablock device.
Add constants for local disk status
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Handle None result from BlockdevFind
objects.BlockDevStatus: Remove ToLegacyStatus
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>...
Add master candidates IPs informations to ssconf
This will be used when querying confd, in order not to rely on DNS beingavailable.
TestParameterNames: also check nic parameters
ConfigObject.ToDict() only export non-None values
The method is changed to a normal loop, to avoid calling getattr()twice. Also getstate is changed to just use ToDict() by default.
This should also make getstate work for objects which have tooverride the ToDict function because they contain other objects....
Add nodes IPs informations to ssconf
Having a list of primary/secondary IPs of all the nodes in ssconf can be usefulfor scripts/hooks which need to automatically configure network properties forthe whole cluster (e.g.: ipsec/netfilter rules) without relying on a...
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.
serializer: fix a few docstrings
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.
Use objects for blockdev_getmirrorstatus RPC call result
This patch changes the return type for backend.BlockdevGetmirrorstatus froma list of tuples to a list of objects.BlockDevStatus instances.
Use object for blockdev_find RPC call result
This patch changes the return type for backend.BlockdevFind to an object(objects.BlockDevStatus). Before a tuple was used. Adding more values tothis tuple causes a lot of work. Converting the result to an object with...
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.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
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...
gnt-node physical-volumes: Add storage type parameter
This way the user can also show storage types other than lvm-pv.
cmdlib: Fix parameters for storage.FileStorage
It wants a list of directories, not a string.
Add “gnt-node modify-volume” command
cmdlib: Add opcode to modify storage unit fields