David Knowles [Tue, 16 Mar 2010 17:21:38 +0000 (13:21 -0400)]
Adding RAPI client library.
Signed-off-by: David Knowles <dknowles@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Signed-off-by: Iustin Pop <iustin@google.com>
(modified slightly the unittest to account for
missing httplib2 library)
Iustin Pop [Thu, 18 Mar 2010 15:46:54 +0000 (16:46 +0100)]
Extend ConfdFilterCallback with consistency checks
Note that users of the callback will have to manually check the
attribute.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Thu, 18 Mar 2010 15:56:08 +0000 (16:56 +0100)]
Abstract the confd client creation
Most creation of confd clients will do the same steps: read MC file,
parse it, read HMAC key, etc. We abstract this functionality so that
we don't duplicate the code.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Guido Trotter [Wed, 31 Mar 2010 15:40:56 +0000 (16:40 +0100)]
Remove unused import from test file
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Guido Trotter [Wed, 31 Mar 2010 15:37:09 +0000 (16:37 +0100)]
kvm_flag hypervisor parameter
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Guido Trotter [Tue, 30 Mar 2010 15:37:02 +0000 (16:37 +0100)]
Move the runas user at execution time
Everything still works the same way, but the user is calculated each
time we start kvm, rather than stored in the config file. This makes it
easier to implement the "pool" security model.
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
René Nussbaumer [Tue, 30 Mar 2010 14:16:04 +0000 (16:16 +0200)]
Send "501 Not Implemented" back when method not found
Before this was "400 Bad Request" and thus it didn't reflect
the reality.
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
René Nussbaumer [Fri, 26 Mar 2010 12:56:58 +0000 (13:56 +0100)]
Adding QA RAPI tests for activate-disks and deactivate-disks calls
* This also adds support for authenticated RAPI calls
* Other HTTP methods than GET/POST
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Guido Trotter [Wed, 24 Mar 2010 15:42:39 +0000 (15:42 +0000)]
SerializableConfigParser: Make Loads class indep
Currently SerializableConfigParser.Loads is a static method that returns
a SerializableConfigParser. With this patch we change it to a class
method that returns a member of the class. This way a subclass calling
Loads on itself will get its own member, rather than a bare
SerializableConfigParser.
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>
Guido Trotter [Tue, 23 Mar 2010 13:07:41 +0000 (13:07 +0000)]
Unbreak command line job submission
A change introduced in
5299e61f modified the contents of
JobExecutor.jobs, missing a place where this tuple was deconstructed.
This creates a traceback in gnt-* <any> --submit, fixed by this patch.
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Guido Trotter [Tue, 23 Mar 2010 09:29:51 +0000 (09:29 +0000)]
Allow file storage to be grown
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Guido Trotter [Mon, 22 Mar 2010 16:16:12 +0000 (16:16 +0000)]
Write grow support for file storage
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Iustin Pop [Mon, 22 Mar 2010 15:21:45 +0000 (16:21 +0100)]
Watcher: fix some doc typos
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Mon, 22 Mar 2010 15:15:46 +0000 (16:15 +0100)]
Watcher: do not warn for missing hooks dir
If the hooks dir does not exist, do not warn needlessly. This is similar
to commit
a9b7e346 (for backend.py).
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Mon, 22 Mar 2010 14:49:23 +0000 (15:49 +0100)]
Extend the hypervisor API with name-only shutdown
Currently the ShutdownInstance method of the hypervisors takes a full
instance object. However, when doing instance shutdowns from the node
only, we don't have a full object, just the name.
To handle this use case, we add a new ‘name’ argument to the method,
which makes the shutdown not use/rely on the ‘instance’ argument. The
KVM and fake hypervisors need a little bit of work, otherwise the change
is straightforward.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Mon, 22 Mar 2010 12:27:07 +0000 (13:27 +0100)]
Distribute list of enabled hypervisors in ssconf
This can be used by nodes to know which hypervisors they are supposed to
support.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Guido Trotter [Mon, 22 Mar 2010 16:25:27 +0000 (16:25 +0000)]
ganeti-confd: Call pyinotify flags correctly
The "apparently pylint was right" commit.
Although the pyinotify constants work on old distributions, they fail on
new ones, with new python. Fixing this by calling them in a way that
works everywhere.
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Guido Trotter [Mon, 22 Mar 2010 16:17:41 +0000 (16:17 +0000)]
Fix burnin error when trying to grow a file volume
Abstract the growable disk types in a ganeti constants, and only run
disk grow, from burnin, on them.
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Iustin Pop [Thu, 18 Mar 2010 13:23:48 +0000 (14:23 +0100)]
Some epydoc fixes
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Thu, 18 Mar 2010 10:33:42 +0000 (11:33 +0100)]
A rewrite of LUClusterVerify
Per issue 90, current cluster verify is very very brittle. It's one of
the oldest pieces of code, with only additions without cleanups over the
last years.
Among its problems:
- data initialization interspersed with verification of RPC results,
leading to non-initialized data for some branches
- due to the above, we order strictly some checks and we have the case
where a bad node time result will skip checking of node volumes
- many many local variables, with each new check adding a new dict,
leading to a spaghetti of dicts in the main Exec function
- monolithic code, both Exec() and _NodeVerify() do a lot of
independent checks
This patch does an imperfect rewrite, but at least we gain:
- a clear infrastructure for adding more checks (the new NodeImage
class, with it's clear and documented fields), and removal of most
per-node dicts from the Exec() function
- the new NodeImage object should allow better type safety, e.g. by
allowing pylint to check the actual object attributes rather than
strings as dict keys
- a-priori initialization of data fields, eliminating the need to
introduce dependencies between checks
- per-result-key status field, allowing elimination of duplicate error
messages (where we want)
- split of most independent checks into separate functions, for greater
clarity
The new code, being new will probably introduce for the short term more
bugs than it removes. However, it should offer a much better way for
extending cluster verify in the future.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Mon, 22 Mar 2010 16:23:36 +0000 (17:23 +0100)]
Introduce a bool CLI option type
This option type enforces its value to either True or False, relieving
the scripts from manually parsing the values in each function.
We also update the bash completion code to use the option type if
possible.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Thu, 18 Mar 2010 09:54:24 +0000 (10:54 +0100)]
Fix backend.VerifyNode behaviour for VG problems
In case LVM is broken, backend.GetVolumeList will raise an RPC exception
(as expected since it's a function exposed over RPC). Therefore we must
be prepared to catch any such exceptions, so that we don't fail the
whole verify call in this case. cmdlib is already prepared to handle
string results for this response key.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
René Nussbaumer [Mon, 22 Mar 2010 15:50:15 +0000 (16:50 +0100)]
Adding missing documentation to make the docs better
Also fixed a typo I noticed.
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Guido Trotter [Mon, 22 Mar 2010 15:41:33 +0000 (15:41 +0000)]
Remove race condition in FileStorage.Create
Rather than checking that the file doesn't exist, and then creating it,
we create it with O_CREAT | O_EXCL, making sure the checking/creation is
atomic.
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Guido Trotter [Mon, 22 Mar 2010 11:08:50 +0000 (11:08 +0000)]
KVM: Check instances for actual liveness
Currently if we find a live process with the pid we saved we assume kvm
is alive. What could happen, though, is that the pidfile has been
reused.
In order to avoid that we change the check to make sure, everywhere,
that the process we see is our actual kvm process. In order to do so we
open its cmdline, and check that it contains the correct instance name
in the -name argument passed to kvm.
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Guido Trotter [Mon, 22 Mar 2010 11:09:14 +0000 (11:09 +0000)]
KVM: improve GetInstanceInfo docstring
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Guido Trotter [Mon, 22 Mar 2010 15:03:21 +0000 (15:03 +0000)]
Revert "Only override any and all if not defined"
This reverts commit
bd5617020a50bcd08269330638d64078c1b30b71.
Turns out our and python's any/all are not compatible.
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
René Nussbaumer [Mon, 22 Mar 2010 15:16:47 +0000 (16:16 +0100)]
Adding RAPI call to deactivate-disks for an instance
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
René Nussbaumer [Mon, 22 Mar 2010 15:16:17 +0000 (16:16 +0100)]
Adding RAPI call for activate-disks on an instance
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Iustin Pop [Thu, 18 Mar 2010 15:18:05 +0000 (16:18 +0100)]
Add a hint to masterd for inconsistent clusters
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Guido Trotter [Thu, 18 Mar 2010 14:26:12 +0000 (14:26 +0000)]
SimpleConfigReader: add docstrings
All non-oneliner functions, after this patch, have their docstring.
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Guido Trotter [Mon, 15 Mar 2010 13:23:01 +0000 (13:23 +0000)]
burnin: implement basic confd testing
Just a few queries are checked, but this should give us confidence that
at least the basic confd framework is working properly.
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Guido Trotter [Mon, 15 Mar 2010 11:43:21 +0000 (11:43 +0000)]
AsyncUDPSocket.process_next_packet
This function allows receiving socket data synchronously.
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Guido Trotter [Tue, 16 Mar 2010 15:08:31 +0000 (15:08 +0000)]
WaitForSocketCondition: rename, handle EINTR
- Rename WaitForSocketCondition to SingleWaitForFdCondition
- Avoid potentially infinite loop, if we continue to get interrupted
- Handle eintr correctly
- Avoid the poller try/finally, as the poller object gets destroyed
anyway
- Provide a new WaitForFdCondition
- Using retry, guarantee to continue checking until the timeout
expires
- Needs an extra helper class, as it uses retry in a very custom way
(no sleep happens, because the poller sleeps by itself)
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Guido Trotter [Tue, 16 Mar 2010 13:59:25 +0000 (13:59 +0000)]
move http.WaitForSocketCondition to utils
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Guido Trotter [Mon, 15 Mar 2010 11:42:12 +0000 (11:42 +0000)]
ConfdCountingCallback
This new confd callback counts received replies for the registered
queries.
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Guido Trotter [Mon, 15 Mar 2010 11:40:54 +0000 (11:40 +0000)]
ConfdClient: add synchronous features
By sending requests with async=False, and receiving replies with
ReceiveReply we can more easily use confd from a synchronous client.
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Guido Trotter [Fri, 12 Mar 2010 12:39:46 +0000 (12:39 +0000)]
Replace @keyword with @param in confd client
@keyword was used inappropriately.
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Guido Trotter [Mon, 15 Mar 2010 13:21:22 +0000 (13:21 +0000)]
AsyncUDPSocket: abstract do_read function
This basically implements read handling, without catching all
exceptions. When using the socket in synchronous mode, it's useful to
avoid losing exception data (which, in an async daemon, can only be
logged)
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Guido Trotter [Thu, 11 Mar 2010 15:17:17 +0000 (15:17 +0000)]
Burnin: don't add/remove routed nics
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Guido Trotter [Mon, 15 Mar 2010 11:37:38 +0000 (11:37 +0000)]
Only override any and all if not defined
If any or all are already defined (because we're using a new version of
python) just link them inside "utils" rather than redefining them.
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Wed, 17 Mar 2010 16:52:41 +0000 (17:52 +0100)]
backend: Two small style fixes
- Pass keyword parameter as such
- Replace “not x == y” with “x != y”
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Iustin Pop [Wed, 17 Mar 2010 16:08:13 +0000 (17:08 +0100)]
Allow cluster copy file over the replication net
This patch introduces the option “--use-replication-network” for the
cluster copyfile functionality, which is useful if the primary and
secondary network are significantly different (see issue 32).
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Wed, 17 Mar 2010 15:49:59 +0000 (16:49 +0100)]
Enhance cli.GetOnlineNodes query/filtering
This patch allows GetOnlineNodes to return the secondary IPs instead of
the node names, and to provide filtering of the master node (required to
be done in this function in case we return the secondary IPs).
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Wed, 17 Mar 2010 14:00:14 +0000 (15:00 +0100)]
Instance creation: implement --no-install mode
This is a simple patch that adds the no-install mode for instance
creation, allowing import from foreign source of the actual OS (instead
of requiring the preparation of data in a form expected by the import
scripts).
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Wed, 17 Mar 2010 13:33:44 +0000 (14:33 +0100)]
Allow OS changes without reinstallation
This patch modifies LUSetInstanceParms to allow OS name changes, without
reinstallation, in case an OS gets renamed on-disk.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Wed, 17 Mar 2010 13:19:50 +0000 (14:19 +0100)]
cmdlib: Abstract OS checks
This patch moves the node-has-os checks to a separate function.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Michael Hanselmann [Tue, 16 Mar 2010 13:51:38 +0000 (14:51 +0100)]
Improve “gnt-cluster renew-crypto”
- Report exception text immediately instead of just logging it
- Remove leftover assertion from when it still used “gnt-cluster
modify”
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Iustin Pop [Tue, 16 Mar 2010 10:34:06 +0000 (11:34 +0100)]
Fix behaviour of gnt-node modify -C no
The current check on whether we require auto_promote or not is wrong, as
we check whether we will have exactly the correct number of master
candidates left. But it is fine if we have more (e.g. when CPS=10 and
mc_remaning=19) than the current number, and in that case we shouldn't
require auto promotion.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Michael Hanselmann [Mon, 15 Mar 2010 15:53:22 +0000 (16:53 +0100)]
Rightname confd's HMAC key
Currently, the ganeti-confd's HMAC key is called “cluster HMAC key” or
simply “HMAC key” everywhere. With the implementation of inter-cluster
instance moves, another HMAC key will be introduced for signing critical
data. They can not be the same, so this patch clarifies the purpose of the
“cluster HMAC key” by renaming it. The actual file name is not changed.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Mon, 15 Mar 2010 15:15:47 +0000 (16:15 +0100)]
Rename SSL_CERT_FILE to NODED_CERT_FILE
To be consistent with RAPI_CERT_FILE, the rather generic named
“SSL_CERT_FILE” constant is renamed to “NODED_CERT_FILE”. The actual file
name is not changed.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Iustin Pop [Mon, 15 Mar 2010 16:14:25 +0000 (17:14 +0100)]
Clarify the error message for ':' in PV names
As described in issue 93, just saying ':' is not a valid char can be
confusing.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Sun, 14 Mar 2010 15:39:01 +0000 (16:39 +0100)]
Implement QA tests for disk template changes
The new test depends on the drbd type tests being enabled, and test
conversion to plain and back to drbd.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Sun, 14 Mar 2010 15:39:00 +0000 (16:39 +0100)]
Update instance modify documentation
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Sun, 14 Mar 2010 15:38:59 +0000 (16:38 +0100)]
Implement conversion from drbd to plain
This is much simpler than the opposite, with fewer possibilities of
failures.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Sun, 14 Mar 2010 15:38:58 +0000 (16:38 +0100)]
Implement conversion from plain to drbd
This patch adds a new mode to instance modify, the changing of the disk
template. For now only plain to drbd conversion is supported, and the
new secondary node must be specified manually (no iallocator support).
The procedure for conversion works as follows:
- a completely new disk template is created, matching the count, size
and mode of the instance's current disks
- we create manually (not via _CreateDisks) all the missing volumes
- we rename on the primary the LVs to the new name
- we create manually the DRBD devices
Failures during the creation of volumes will leave orphan volumes.
Failure during the rename might leave some disks renamed and some not,
leading to an inconsistent instance.
Once the disks are renamed, we update the instance information and wait
for resync. Any failures of the DRBD sync must be manually handled (like
a normal failure, e.g. by running replace-disks, etc.).
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Sun, 14 Mar 2010 15:38:57 +0000 (16:38 +0100)]
Abstract check that an instance is down
Multiple LUs require that an instance is not running while they operate
on the instance (reinstall, rename, modify, recreate disks, deactivate
disks). The code to do this check is duplicate many times, and not very
consistent (some use call_instance_list, some call_instance_info).
The patch moves this check into a separate function that is then reused.
The only drawback is that _SafeShutdowInstanceDisks now raises an
OpPrereqError (even though it is run during Exec()), but this use case
is fine (there are no other modifications in that Exec).
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Sun, 14 Mar 2010 15:38:56 +0000 (16:38 +0100)]
Abstract node free disk space check
Both create instance and grow disk check the free disk space on nodes
using the same, duplicate code. Since we'll need this in other places in
the future, we abstract the check into a new function.
The patch adjusts the error message to be more in-line with the one for
memory checking, and fixes the exception raised for RPC errors.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Sun, 14 Mar 2010 15:38:55 +0000 (16:38 +0100)]
Abstract disk template verification
This is a simple check, but we'll need it in multiple places.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Sun, 14 Mar 2010 00:55:19 +0000 (01:55 +0100)]
Update documentation for disk adoption
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Sun, 14 Mar 2010 00:55:18 +0000 (01:55 +0100)]
Implement disk adoption mode in gnt-instance
This patch modifies the parsing of the “--disk” argument to instance
create to accept “adopt” as a valid key, which builds the correct disk
structure for OpCreateInstance.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Sun, 14 Mar 2010 00:55:17 +0000 (01:55 +0100)]
LUCreateInstance: implement disk adoption mode
This new mode, valid only for the plain template disk, allows creation
of an instance based on existing logical volumes (preserving data),
rather than creation of new volumes and OS creation.
The new mode works as follows:
- instead of size, all disks passed in must have an 'adopt' key, which
signifies the LV name to be used
- all disks must have this key, or neither should
- we check the volume existence, and from the result we fill in the
actual size
- online (in-use) volumes are not allowed
- 'stealing' of another's instance volumes is prevented via reservation
of the LV names
- during creation, we rename the logical volumes to the standard Ganeti
format (based on UUID)
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Sun, 14 Mar 2010 00:55:16 +0000 (01:55 +0100)]
LUCreateInstance: Move parameter init earlier
This way, the parameters are available in CheckArguments too.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Sun, 14 Mar 2010 00:55:15 +0000 (01:55 +0100)]
ConfigWriter: add an LV reservation manager
This patch adds an LV reservation manager to be used for LV names. Since
we now have four such managers, we create a list for easier release.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Mon, 15 Mar 2010 12:55:48 +0000 (13:55 +0100)]
Fix two issues related to check-man
First, we don't need to check man pages at sed time, because this means
everyone building the package will do - we only need to check at docbook
time, which is mostly at developer time.
Second, don't force LC_ALL to C, as this breaks newer man-db. I've
verified and removing LC_ALL works fine across etch, hardy, lenny aid
squeeze/sid.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Michael Hanselmann [Mon, 15 Mar 2010 14:33:47 +0000 (15:33 +0100)]
utils.RunCmd: Test case with reset_env set and setting variables
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Michael Hanselmann [Fri, 12 Mar 2010 15:16:08 +0000 (16:16 +0100)]
Implement replacing cluster certs and keys via “gnt-cluster renew-crypto”
Recent changes to “gnt-cluster verify” made it complain on expiring SSL
certificates. While it was possible to replace the SSL certificates and
other cluster secrets manually before, doing so was cumbersome. Cluster
certificates, keys and secrets can now be replaced easily.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Fri, 12 Mar 2010 10:51:22 +0000 (11:51 +0100)]
cli: Add helper function to stop and start whole cluster
Replacing cluster certificates and keys requires all cluster daemons to be
shut down. This might also be handy for the cluster merger tool, though
the function might need a few more extensions.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Fri, 12 Mar 2010 10:49:16 +0000 (11:49 +0100)]
cfgupgrade: Use new bootstrap function for certs and keys
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Fri, 12 Mar 2010 10:49:47 +0000 (11:49 +0100)]
bootstrap: Add new function to create cluster certs and keys
The code to generate cluster certificates, keys and secrets is currently
spread over several places. It makes sense to move it to a separate
function as we want to provide the user with the ability to automatically
replace all cluster certificates and keys.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Fri, 12 Mar 2010 14:35:02 +0000 (15:35 +0100)]
utils.CreateBackup: Use human-readable instead of seconds since Epoch
Seconds since the Epoch are not easily readable by a human. Using a
formatted timestamp makes it easier (e.g.
“….backup-2010-03-12_14_02_43.…”). This patch also makes OS logfiles use
this formatted timestamp.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Thu, 11 Mar 2010 17:52:59 +0000 (18:52 +0100)]
Add unittest for daemon-util
This test doesn't cover everything, but it's better than nothing.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Thu, 11 Mar 2010 17:28:54 +0000 (18:28 +0100)]
Add support for non-Python unittests
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Thu, 11 Mar 2010 16:42:19 +0000 (17:42 +0100)]
daemon-util: Generate daemon path in separate function
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Thu, 11 Mar 2010 16:16:44 +0000 (17:16 +0100)]
daemon-util: Use “return” instead of “exit” in all functions
This is important if they're called directly within daemon-util.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Thu, 11 Mar 2010 16:16:28 +0000 (17:16 +0100)]
daemon-util: Add function to start and stop all daemons
This is, to some degree, duplicated code from the init script. However,
the init script has to conform to standards of the underlying Linux
distributions, while these functions will be called by Ganeti itself. By
moving more code into daemon-util, the amount of duplication has been
reduced.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Michael Hanselmann [Thu, 11 Mar 2010 15:52:17 +0000 (16:52 +0100)]
ganeti.initd: Move all daemon names from init script to daemon-util
The list of daemon names will be used in daemon-util, too.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Michael Hanselmann [Thu, 11 Mar 2010 11:51:44 +0000 (12:51 +0100)]
ganeti.initd: Move code checking daemon exit code to daemon-util
This is again for re-using code.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Michael Hanselmann [Thu, 11 Mar 2010 11:27:11 +0000 (12:27 +0100)]
ganeti.initd: Move code checking config to daemon-util
This allows for more code re-use. daemon-util will also be used to start
all daemons.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Michael Hanselmann [Thu, 11 Mar 2010 16:15:29 +0000 (17:15 +0100)]
daemon-util: Require dashes in commands
Even though the script uses underscores (_) internally, the external
commands are supposed to be written using dashes (-).
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Michael Hanselmann [Wed, 10 Mar 2010 17:00:21 +0000 (18:00 +0100)]
Improve ganeti.serializer unittests
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Wed, 10 Mar 2010 16:59:54 +0000 (17:59 +0100)]
Add unittests for ganeti.errors
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Tue, 23 Feb 2010 16:14:04 +0000 (17:14 +0100)]
Verify cluster certificates in LUVerifyCluster
When using pyOpenSSL 0.7 or above, LUClusterVerify will start to show a
warning 30 days before a certificate expires. 7 days before the
certificate expires, the warning becomes an error. Once expired,
LUVerifyCluster will always report an error. The latter is also supported
with pyOpenSSL 0.6.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Tue, 23 Feb 2010 16:09:03 +0000 (17:09 +0100)]
utils: Add function to extract X509 cert validity
X509 uses ASN1 GENERALIZEDTIME or UTCTIME to store certificate validity.
pyOpenSSL 0.7 and above allow us to retrieve both “notBefore” and
“notAfter” as strings. Parsing them turned out to be a challenge since
they can be in a variety of formats (YYYYMMDDhhmmssZ, YYYYMMDDhhmmss+hhmm
or YYYMMDDhhmmss-hhmm).
This will be used to verify the validity of cluster certificates in
LUVerifyCluster.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Tue, 23 Feb 2010 16:10:37 +0000 (17:10 +0100)]
Add constant with cluster X509 certificates
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Iustin Pop [Fri, 12 Mar 2010 13:15:27 +0000 (14:15 +0100)]
Merge branch 'stable-2.1' into devel-2.1
* stable-2.1:
Release version 2.1.1
Update NEWS file for the 2.1.1 release
Validate the os-specific hypervisor parameters
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Fri, 12 Mar 2010 10:44:43 +0000 (11:44 +0100)]
Release version 2.1.1
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Fri, 12 Mar 2010 08:34:45 +0000 (09:34 +0100)]
Improve cluster verify with hypervisor errors
In case the hypervisor has issues on one node, currently
backend.VerifyNode will exit via an exception (two exit paths possible,
one via HypervisorError from hypervisor.Verify(), and one via RPCFail
from GetInstanceList). This is bad as it invalidates all other checks of
that node.
This patch catches these two errors and allows the rest of the
VerifyNode function to run. This leads to a more complete verify cluster
run, for example now only real missing LVs are reported, not all of
them.
The cluster verify is not perfect as it will skip some tests even if it
has data, but this will require a more complete rewrite (see issue 90).
Also, the patch fixes and improves some error messages in cmdlib.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Thu, 11 Mar 2010 15:31:04 +0000 (16:31 +0100)]
Fix wrong indentation
Sorry…
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
René Nussbaumer [Wed, 10 Mar 2010 10:25:15 +0000 (11:25 +0100)]
Adding qa tests for gnt-os modify
This adds basic qa tests for gnt-os modify
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Thu, 11 Mar 2010 14:07:35 +0000 (15:07 +0100)]
Switch burnin to cli.JobExecutor
Burnin has a custom job executor, because of its need to retry some job
series.
While we cannot replace all of it, at least the execution we can switch
to cli.JobExecutor, to take advantage of the recently-introduced
out-of-order waiting.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Thu, 11 Mar 2010 13:54:45 +0000 (14:54 +0100)]
Extend JobExecutor to allow custom feedback_fn
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Thu, 11 Mar 2010 12:35:38 +0000 (13:35 +0100)]
cli.JobExecutor: poll jobs in execution order
… rather than submission order. The results are still returned in the
submission order, and for this we needed to track internally the index
of the submission.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Thu, 11 Mar 2010 12:33:29 +0000 (13:33 +0100)]
Add a partition function to split a list in two
This is similar to the Haskell function, except that the signature is
reverse to match the 'any' and 'all' Python functions.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Thu, 11 Mar 2010 12:29:36 +0000 (13:29 +0100)]
Improve burnin's Log function
This makes the Log function able to take multiple args for simplified
message construction, similar to the ToStdout one.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Thu, 11 Mar 2010 14:35:25 +0000 (15:35 +0100)]
Fix cluster verify with simulate-errors
In simulate errors mode, the test "ntime_diff is not None" will be
ignored, and thus a None value will try to be formatted as %.01f. We
workaround this by formatting it before, and then only using %s, which
can format a 'None' value.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Guido Trotter [Thu, 11 Mar 2010 10:57:27 +0000 (10:57 +0000)]
KVM: remove unused variable
We don't need the pwentry when checking if a username exists, just to be
sure the KeyError is not returned. Remove the variable, and thus shut up
lint.
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Iustin Pop [Thu, 11 Mar 2010 09:52:02 +0000 (10:52 +0100)]
Update NEWS file for the 2.1.1 release
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Thu, 11 Mar 2010 08:48:54 +0000 (09:48 +0100)]
Validate the os-specific hypervisor parameters
This adds a validation similar to the one for cluster-wide hypervisor
paramters.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Guido Trotter [Wed, 10 Mar 2010 12:58:52 +0000 (12:58 +0000)]
Document the security_* hypervisor parameters
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>