Michael Hanselmann [Wed, 19 Nov 2008 13:18:41 +0000 (13:18 +0000)]
ganeti.rpc: Use central functions for actual RPC calls
Before we had lots, lots and lots of code duplication. This patch
changes the code to use four central functions.
Reviewed-by: iustinp
Michael Hanselmann [Wed, 19 Nov 2008 13:18:08 +0000 (13:18 +0000)]
Make HttpClientManager threadsafe
This allows a single HttpClientManager to be used from more than one
thread at the same time. We discussed having one HttpClientManager
per job queue thread. Assuming there should be one HTTP thread per
node, this would mean quadratic growth with the number of nodes. By
being able to reuse the manager, this problem is a defused a bit.
This patch also fixes a typo in HttpClientRequestExecutor.
Reviewed-by: iustinp
Oleksiy Mishchenko [Wed, 19 Nov 2008 12:59:08 +0000 (12:59 +0000)]
HTTP server: Do not decode empty entity body
Reviewed-by: imsnah
Oleksiy Mishchenko [Wed, 19 Nov 2008 11:09:26 +0000 (11:09 +0000)]
RAPI: Instance modify.
Split parameters filter to the separate function and reuse it in instance creation.
Iustin Pop [Tue, 18 Nov 2008 11:30:26 +0000 (11:30 +0000)]
Skip another testWaitingXblocksY
The waiting sharer blocks exclusive is another not-possible to test
right now.
Sorry for missing it the first time; there are no other testWaiting...
tests.
Reviewed-by: ultrotter
Iustin Pop [Tue, 18 Nov 2008 10:06:01 +0000 (10:06 +0000)]
Allow querying of variable number of parameters
This patch adds support for querying in gnt-instance list of:
- disk.count
- nic.count
- disk.size/$N
- nic.(ip|mac|bridge)/$N
The patch also disables the exception raised when the header description
is missing, that should be fixed in the future (together with better
handling of variable numeric fields).
Reviewed-by: imsnah
Iustin Pop [Tue, 18 Nov 2008 10:04:34 +0000 (10:04 +0000)]
Convert cmdlib.py to _FieldSet
This patch converts the current usage of _CheckOutputFields to the
FieldSet class, but it doesn't start to use its variable matching
features.
Reviewed-by: ultrotter
Iustin Pop [Tue, 18 Nov 2008 10:00:28 +0000 (10:00 +0000)]
Add a FieldSet class for variable parameter sets
This patch adds a _FieldSet class that can be used for the new variable
parameter sets: e.g. the sda_size will change to disk/0.size (or
similar) and we need to both check validity and extract the index of the
parameter easily.
The patch also sorts the unittest list in Makefile.am.
Reviewed-by: ultrotter
Iustin Pop [Tue, 18 Nov 2008 09:58:07 +0000 (09:58 +0000)]
Skip the waitingExclusiveBlockSharer test
Until we have a way to properly test this, we'll skip the test.
Reviewed-by: imsnah
Iustin Pop [Mon, 17 Nov 2008 11:30:42 +0000 (11:30 +0000)]
More updates to the documentation
This patch removes the client-api.txt document (since it's obsoleted by
the documentation inside the design-2.0.rst document) and adds many
updates to the latter.
Reviewed-by: imsnah
Iustin Pop [Mon, 17 Nov 2008 11:30:21 +0000 (11:30 +0000)]
Fix distcheck with the new dot/png rules
Adding a new filetype/make rule requires more work than the previous
patch. Sorry! Now pases distcheck.
Reviewed-by: imsnah
Iustin Pop [Sun, 16 Nov 2008 06:24:27 +0000 (06:24 +0000)]
Add a cluster architecture diagram
This adds a simple diagram for the cluster architecture and also adds a
dependency on graphviz (both doc and in configure).
Reviewed-by: imsnah
Iustin Pop [Sun, 16 Nov 2008 06:24:08 +0000 (06:24 +0000)]
Combine the 2.0 design documents into one
This patch combines all the design documents for 2.0 except the
security one into a single document, in order to ease reading and reduce
duplication of information.
Future patches will start removing wrong pointers to old document names
and some better integration between the sections.
Reviewed-by: imsnah
Oleksiy Mishchenko [Fri, 14 Nov 2008 16:59:23 +0000 (16:59 +0000)]
RAPI: Instance startup/shutdown resources
Reviewed-by: imsnah
Oleksiy Mishchenko [Fri, 14 Nov 2008 10:34:34 +0000 (10:34 +0000)]
RAPI: Implement an instance reboot
Reviewed-by: imsnah
Michael Hanselmann [Wed, 12 Nov 2008 12:52:18 +0000 (12:52 +0000)]
Use utils.ReadFile to read SSL certificate
Reviewed-by: iustinp
Michael Hanselmann [Wed, 12 Nov 2008 12:52:07 +0000 (12:52 +0000)]
ganeti.rpc: Use utils.ReadFile instead of reading file directly
Reviewed-by: iustinp
Michael Hanselmann [Wed, 12 Nov 2008 12:51:54 +0000 (12:51 +0000)]
utils.SetupLogging: Remove previously setup handlers
If a logging function is called before the logging module is setup
using utils.SetupLogging, it calls logging.basicConfig, which adds
a StreamHandler, on its own. If we leave it in, all log output will
be printed twice on stderr. This patch makes sure to remove all
handlers before adding our own.
Reviewed-by: iustinp
Michael Hanselmann [Wed, 12 Nov 2008 12:51:39 +0000 (12:51 +0000)]
jqueue: Always use rpc.RpcRunner
"from ganeti.rpc import RpcRunner" does not conform to the style guide.
Reviewed-by: iustinp
Michael Hanselmann [Wed, 12 Nov 2008 12:51:28 +0000 (12:51 +0000)]
bootstrap: Always use rpc.RpcRunner
"from ganeti.rpc import RpcRunner" does not conform to the style guide.
Reviewed-by: iustinp
Michael Hanselmann [Wed, 12 Nov 2008 12:50:53 +0000 (12:50 +0000)]
ganeti.rpc: Convert to ganeti.serializer
This is one of the last places where the simplejson module is
used directly.
Reviewed-by: iustinp
Michael Hanselmann [Wed, 12 Nov 2008 12:50:41 +0000 (12:50 +0000)]
Convert RPC module to new HTTP client
Currently, HttpClientManager is instantiated for every RPC call. This
will be changed with another patch, as will the use of SSL. The “Run”
method is no longer needed.
Reviewed-by: iustinp
Iustin Pop [Wed, 12 Nov 2008 06:25:11 +0000 (06:25 +0000)]
Convert the locking unittests to repetition-test
Currently the locking tests are using timeouts to ensure an event will
'never happen'. However, this is suboptimal.
The patch converts all of these to instead: not wait, but sequence the
operations logically and expect that they execute as such. In case of
not so, they will timeout with a big (60s) timeout.
The 'never happen' is tested by multiple repetitions of the same test -
this is not perfect, but again 'X will never happen' is not actually
testable.
This patch reduces the runtime of the tests from ~5.4 to ~0.8 seconds
(with 8 repetitions of each test thas has 'never happen' situations).
Reviewed-by: imsnah
Iustin Pop [Wed, 12 Nov 2008 03:43:12 +0000 (03:43 +0000)]
Fix utils.KillProcess
Rev 1978 introduced a breakage on the SIGKILL finall signal to the
process, due to mistyped variable.
Reviewed-by: francis.perron
Michael Hanselmann [Tue, 11 Nov 2008 16:16:08 +0000 (16:16 +0000)]
ganeti.http: Implement SSL for HTTP client
Implementing SSL for the HTTP client required more work than I expected.
For correct error handling, quite a lot of code is needed. To avoid
code duplication, I moved a lot of the socket handling code into a
single function named _SocketOperation. It takes care of the polling
and error handling for OpenSSL. At the same time, the functions calling
it become a lot smaller.
This patch brings a few more changes:
- Error handling for socket.connect_ex (e.g. name resolution failures)
- Rename "ResponseError" exception class to "_HttpClientError" --
it's an internal class anyway
Reviewed-by: iustinp
Michael Hanselmann [Tue, 11 Nov 2008 11:02:49 +0000 (11:02 +0000)]
ganeti.daemon: Add timers to Mainloop
This is a fallout from my work on the HTTP client class. Repeating
timers are prepared, but not yet implemented.
Reviewed-by: iustinp
Iustin Pop [Tue, 11 Nov 2008 10:58:50 +0000 (10:58 +0000)]
Convert trunk to posix-compatibility
We change two functions to use RunCmd without shell, and the other
(which needs a ssh command line) is changed to the '>... 2>&1' syntax.
Reviewed-by: imsnah
Iustin Pop [Tue, 11 Nov 2008 10:58:39 +0000 (10:58 +0000)]
Abstract runtime creation of dirs into a function
Currently the dir creation in ganeti-noded is in the main function. This
is not nice: we move it into a separate function and also add creation
of the OS_LOG_DIR (with different permissions, but in the same way).
This will permit cleanup of the creation of the OS_LOG_DIR from the
backend module (it's done multiple places currently).
Reviewed-by: imsnah
Iustin Pop [Tue, 11 Nov 2008 10:58:28 +0000 (10:58 +0000)]
Remove zombie special case from IsProcessAlive
Based on the discussion on the mailing list, we remove the special
casing of zombie processes.
Note we don't use kill -0 since that has a different meaning than "check
process is alive", so this function is still linux-specific.
Reviewed-by: imsnah
Iustin Pop [Tue, 11 Nov 2008 10:58:14 +0000 (10:58 +0000)]
Add cleanup of processes to utils.KillProcess
In case the process we want to signal is our own process, and the signal
we send is a deadly one, we should also cleanup after the process.
This patch adds a new parameter waitpid to this function that does this,
and changes its unittest to pass this new parameter.
Reviewed-by: imsnah
Iustin Pop [Tue, 11 Nov 2008 10:58:00 +0000 (10:58 +0000)]
Fix instance rename
As can be seen from the patch, we remove from the locking manager
inst.name. However, we do this right after cfg.RenameInstance, which
changes inst.name to the new name. So we need to remove old_name not
the new name.
The real question is why does the glm allow me to remove a not-existing
instance name...
The symptom before the patch was: run rename, then:
$ gnt-instance list
Unhandled protocol error while talking to the master daemon:
Caught exception: 'NoneType' object has no attribute 'primary_node'
Reviewed-by: imsnah
Iustin Pop [Tue, 11 Nov 2008 10:57:49 +0000 (10:57 +0000)]
Make the makefile not recreate ganeti every time
Currently the makefile always recreates the ganeti symlink. Make it so
that it does only when it doesn't exist or it's not a symlink.
Reviewed-by: imsnah
Iustin Pop [Tue, 11 Nov 2008 03:12:17 +0000 (03:12 +0000)]
Fix gnt-instance reinstall
Commit 1881 changed a rpc call but didn't fix all its users. This should
fix it (but I can't test as HTTP is broken).
Reviewed-by: imsnah
Iustin Pop [Tue, 11 Nov 2008 03:12:05 +0000 (03:12 +0000)]
Implement working directory for utils.RunCmd
In order to replace usage of the shell just for 'cd %s; ...' we need to
be able to specify the working directory for childs.
The patch also changes the default working directory (when not
specified) to "/", as opposed to the current dir; since the daemos run
with cwd=/ anyway, this should not change things.
Reviewed-by: imsnah
Michael Hanselmann [Mon, 10 Nov 2008 12:38:26 +0000 (12:38 +0000)]
ganeti.http: Move SSL socket creation into base class
The same code will be used by the HTTP client.
Reviewed-by: iustinp
Michael Hanselmann [Mon, 10 Nov 2008 12:37:49 +0000 (12:37 +0000)]
ganeti.daemon: Make Mainloop more flexible
While working on the HTTP client class, I wanted to use Mainloop
before deciding to use threads instead.
- Add docstrings
- Rename "quit" to "running", move it to a local variable
- Support adding and removing I/O listeners while running
(e.g. to add/remove listeners from OnIO(…) calls)
- Allow user of the class to disable signal handlers
- Flag to exit once all listeners are gone
Reviewed-by: iustinp
Michael Hanselmann [Mon, 10 Nov 2008 10:14:08 +0000 (10:14 +0000)]
ganeti.http: Add constant for "Unexpected EOF"
This is an expected error message and will be used in two places.
Reviewed-by: iustinp
Alexander Schreiber [Fri, 7 Nov 2008 11:32:52 +0000 (11:32 +0000)]
Fix gnt-cluster init without cluster parameters
Reviewed-by: imsnah
Michael Hanselmann [Thu, 6 Nov 2008 11:25:10 +0000 (11:25 +0000)]
Add new HTTP client class
It is based on the WorkerPool class which is already used for the job
queue and master daemon. Each request must be encapsulated in an
instance of HttpClientRequest, which will then be passed to
HttpClientManager for processing. Upon completion, the request object
contains the response or error message.
While not yet enabled, the HTTP client implementation has been designed
with HTTP/1.1 and keep-alive in mind. For now it only uses HTTP/1.0,
though.
HttpClientManager will likely need more changes when integrating with
the RPC layer. SSL will also be integrated in a second step.
Reviewed-by: iustinp, ultrotter
Michael Hanselmann [Thu, 6 Nov 2008 11:24:49 +0000 (11:24 +0000)]
ganeti.http: Use 411 Length Required in server code
Reviewed-by: iustinp
Guido Trotter [Wed, 5 Nov 2008 16:37:51 +0000 (16:37 +0000)]
Update LUGrowDisk _WaitForSync call
The _WaitForSync call changed in r1794 but the GrowDisk call wasn't updated
then. This makes GrowDisk work in trunk.
Reviewed-by: iustinp
Michael Hanselmann [Wed, 5 Nov 2008 14:04:04 +0000 (14:04 +0000)]
ganeti.http: Add more constants
As a preparation for the new HTTP client class, add more constants
to ganeti.http.
Reviewed-by: iustinp
Iustin Pop [Mon, 27 Oct 2008 23:21:29 +0000 (23:21 +0000)]
Small documentation updates for workerpool.py
Reviewed-by: imsnah
Iustin Pop [Mon, 27 Oct 2008 23:21:11 +0000 (23:21 +0000)]
Documentation updates for jqueue.py
Reviewed-by: imsnah
Iustin Pop [Mon, 27 Oct 2008 23:20:57 +0000 (23:20 +0000)]
Yet another bug found while reviewing docs
The newer_than variable can be either None or an int, and we normalize
it to an integer previously and save it in the 'serial' variable, which
should be used instead.
Reviewed-by: imsnah
Iustin Pop [Mon, 27 Oct 2008 23:20:25 +0000 (23:20 +0000)]
Documentation updates for utils.py
Reviewed-by: imsnah
Iustin Pop [Mon, 27 Oct 2008 23:20:10 +0000 (23:20 +0000)]
Documentation updates for gnt-debug and gnt-os
Reviewed-by: imsnah
Iustin Pop [Mon, 27 Oct 2008 23:19:58 +0000 (23:19 +0000)]
Documentation updates for gnt-job
Reviewed-by: imsnah
Iustin Pop [Mon, 27 Oct 2008 23:19:45 +0000 (23:19 +0000)]
Documentation updates for gnt-backup
Reviewed-by: imsnah
Iustin Pop [Mon, 27 Oct 2008 23:19:22 +0000 (23:19 +0000)]
Change exit code of gnt-backup list
Currently gnt-backup list exits with the same error code even if can't
contact som nodes for backup information.
The patch changes it to return 1 instead in this case.
Reviewed-by: imsnah
Iustin Pop [Mon, 27 Oct 2008 23:18:45 +0000 (23:18 +0000)]
Documentation updates for gnt-node
The patch also adds a 'return 0' to a function that was missing it.
Reviewed-by: imsnah
Iustin Pop [Mon, 27 Oct 2008 23:18:26 +0000 (23:18 +0000)]
Documentation updates for gnt-cluster
Reviewed-by: imsnah
Iustin Pop [Mon, 27 Oct 2008 23:18:11 +0000 (23:18 +0000)]
Documentation updates for gnt-instance
Reviewed-by: imsnah
Iustin Pop [Sat, 25 Oct 2008 00:37:25 +0000 (00:37 +0000)]
Update backend.py docstrings
This patch converts all of backend.py to epydoc formatting.
Reviewed-by: imsnah
Iustin Pop [Sat, 25 Oct 2008 00:37:16 +0000 (00:37 +0000)]
Fix another error handling case
The return from this error path is a dict, but the actual return value
(on the non-error handling) is a list of dicts. Change accordingly.
Reviewed-by: imsnah
Iustin Pop [Fri, 24 Oct 2008 16:14:48 +0000 (16:14 +0000)]
Fix an error handling case
Found while reviewing documentation.
Reviewed-by: ultrotter
Guido Trotter [Fri, 24 Oct 2008 15:23:36 +0000 (15:23 +0000)]
OSFromDisk remove superfluous empty line
Reviewed-by: iustinp
Guido Trotter [Fri, 24 Oct 2008 15:23:21 +0000 (15:23 +0000)]
design-2.0-os-interface: update import/export
In the end we ended up taking a slightly different approach for
import/export than the one discussed in the design doc, after
trying/talking about a few more alternatives. Document this in the
document.
Reviewed-by: iustinp
Iustin Pop [Fri, 24 Oct 2008 14:44:15 +0000 (14:44 +0000)]
Some documentation updates
This fixes a few doc issues and converts a few docstrings to epydoc.
Reviewed-by: imsnah
Iustin Pop [Fri, 24 Oct 2008 14:43:58 +0000 (14:43 +0000)]
Modify utils.RunCmd to write output to file
Currently we launch processes via the shell in a few places only to
redirect standard output and error to a log file ("&> $file"). It is
better to do such redirection from within RunCmd itself.
This patch splits RunCmd in two parts, the setup and the execution part,
the latter being implemented in two different functions depending on
whether we write to a file or not.
We also update the unittests with this new case.
Reviewed-by: imsnah
Michael Hanselmann [Fri, 24 Oct 2008 11:49:01 +0000 (11:49 +0000)]
ganeti.http: Implement SSL certificates
Reviewed-by: killerfoxi
Michael Hanselmann [Fri, 24 Oct 2008 11:31:29 +0000 (11:31 +0000)]
Document HttpServer.__init__
At the same time, simplify the interface a bit by not using a tuple.
Reviewed-by: killerfoxi, ultrotter
Alexander Schreiber [Thu, 23 Oct 2008 16:41:24 +0000 (16:41 +0000)]
Update gnt-cluster man page, sections modify and queue.
Document the new options for gnt-cluster modify and the new queue
command.
Reviewed-by: imsnah
Alexander Schreiber [Thu, 23 Oct 2008 15:13:27 +0000 (15:13 +0000)]
Update gnt-cluster man page with current options.
This patch updates the gnt-cluster man page to reflect the current
changes to gnt-cluster.
Reviewed-by: imsnah
Alexander Schreiber [Thu, 23 Oct 2008 15:01:51 +0000 (15:01 +0000)]
Fix use of ToStderr in gnt-cluster
Reviewed-by: imsnah
Iustin Pop [Thu, 23 Oct 2008 14:19:13 +0000 (14:19 +0000)]
Fix gnt-* command with --submit
Currently we don't catch the JobSubmittedException (although the code to
format it nicely is there). The patch adds the exception name to the
catch list and makes --submit work.
Reviewed-by: imsnah
Iustin Pop [Thu, 23 Oct 2008 14:19:05 +0000 (14:19 +0000)]
Export the disk index in the import/export scripts
We want to export the disk index as some OSes will only want to export
the first disk (or the second one, etc.), even if we have multiple
disks.
The patch also updates the backend.ExportSnapshot docstring.
Reviewed-by: ultrotter
Iustin Pop [Thu, 23 Oct 2008 14:18:53 +0000 (14:18 +0000)]
Fix leftover of hypervisor attribute rename
Reviewed-by: imsnah
Alexander Schreiber [Thu, 23 Oct 2008 11:58:44 +0000 (11:58 +0000)]
convert remaining print statements to ToStderr in gnt-cluster
Reviewed-by: imsnah
Michael Hanselmann [Thu, 23 Oct 2008 11:58:16 +0000 (11:58 +0000)]
http library: Always fork before reading request
It turned out that clients not sending a full request will stop
us from responding to further requests. This patch leverages the
situation a bit by always forking before handling the request,
but we still have DoS situations.
Reviewed-by: ultrotter
Michael Hanselmann [Thu, 23 Oct 2008 11:58:03 +0000 (11:58 +0000)]
daemon.py: Don't wake up every second
We don't have timers yet, hence waking up is not needed at all.
Reviewed-by: ultrotter
Oleksiy Mishchenko [Wed, 22 Oct 2008 22:41:03 +0000 (22:41 +0000)]
RAPI: Export beparams as dict. The patch also enables LUQueryInstances to accept beparams as valid field.
Reviewed-by: iustinp
Oleksiy Mishchenko [Wed, 22 Oct 2008 20:54:58 +0000 (20:54 +0000)]
RAPI: Forgoten in r1923 instance add change.
Reviewed-by: iustinp
Guido Trotter [Wed, 22 Oct 2008 14:09:38 +0000 (14:09 +0000)]
LUCreateInstance: import multiple disks
Previously we used to handle only one disk. Now we'll import all the
ones present in the export, in order, on the instance's disks. Any disk
which was present on the original instance but wasn't exported is just
skipped in the target instance.
Reviewed-by: iustinp
Guido Trotter [Wed, 22 Oct 2008 14:09:26 +0000 (14:09 +0000)]
Convert ImportOSIntoInstance to OS API 10
- Change ImportOSIntoInstance not to get any "os_disk" and "swap_disk"
arguments but to accept multiple target images to import, and to
return a list of booleans with the result of each import
- Change the relevant rpc call and the only caller to conform
- Pass arguments to the import script through the environment
- Run one import os script for each disk image, passing an IMPORT_DEVICE
Reviewed-by: iustinp
Guido Trotter [Wed, 22 Oct 2008 14:09:11 +0000 (14:09 +0000)]
Convert ExportSnapshot to OS API 10
We pass the data via the environment rather than on the command line, as
API 10 says. All the rest remains the same, and we export just one disk,
as the master calls this function for every snapshotted disk.
Reviewed-by: iustinp
Guido Trotter [Wed, 22 Oct 2008 14:08:58 +0000 (14:08 +0000)]
LUExportInstance: snapshot all disks
Rather than just snapshotting the "sda" disk, we'll snapshot all of the
instance disks. If we can't snapshot a disk for any reason we'll log an
error and proceed anyway: in this case the resulting export will miss a
disk. This also changes all the warning messages to self.LogWarning().
Reviewed-by: iustinp
Guido Trotter [Wed, 22 Oct 2008 14:08:31 +0000 (14:08 +0000)]
Convert SnapshotBlockDevice's docstring to epydoc
Reviewed-by: iustinp
Oleksiy Mishchenko [Tue, 21 Oct 2008 20:32:37 +0000 (20:32 +0000)]
Pass request headers in to RAPI handlers.
Reviewed-by: iustinp
Iustin Pop [Tue, 21 Oct 2008 17:54:15 +0000 (17:54 +0000)]
Move some LU logging to use proc.Log*
We change some messages which are obviously intended for the user to use
the proc.Log* functions instead of (only) the logging ones.
We also fix some wrong uses of feedback_fn.
Reviewed-by: imsnah
Iustin Pop [Tue, 21 Oct 2008 15:45:28 +0000 (15:45 +0000)]
Improve the mcpu.Processor logging routines
As discussed previously, many of the routinges in cmdlib.py are using
logging functions as a carry-over from 1.2 (when these also showed the
message on stderr/to the user), instead of actually warning the user.
This patch extends the syntax for Processor.LogInfo/LogWarning in order
to be easier to use them.
Reviewed-by: imsnah
Iustin Pop [Tue, 21 Oct 2008 13:02:05 +0000 (13:02 +0000)]
Fix whitespace-at-EOL
Please configure your editors to strip it, or enable your git hooks...
Reviewed-by: ultrotter
Iustin Pop [Mon, 20 Oct 2008 18:01:28 +0000 (18:01 +0000)]
Generalize the reading of test file data
Currently we have two methods in ganeti.bdev_unittest.py of computing
the test data file name - and, of course, they don't give the same
results.
The patch moves the functions to compute the test file name and reading
of its contents to the GanetiTestCase class in testutils, which allows
running the tests from the command line as well.
We also change assertFileContent to use utils.ReadFile.
Reviewed-by: imsnah
Alexander Schreiber [Mon, 20 Oct 2008 16:38:28 +0000 (16:38 +0000)]
Set default hypervisor at cluster init
During cluster init, set the default hypervisor to be used for instances.
Ensure that the default hypervisor belongs to the set enabled hypervisors
for this cluster. Also fix a small bug with setting the default enabled
hypervisor list.
Reviewed-by: imsnah
Iustin Pop [Mon, 20 Oct 2008 14:47:17 +0000 (14:47 +0000)]
Convert the job queue rpcs to address-based
The two main multi-node job queue RPC calls (jobqueue_update,
jobqueue_rename) are converted to address-based calls, in order to speed
up queue changes. For this, we need to change the _nodes attribute on
the jobqueue to be a dict {name: ip}, instead of a set.
Reviewed-by: imsnah
Iustin Pop [Mon, 20 Oct 2008 14:47:07 +0000 (14:47 +0000)]
Convert rpc.call_upload_file to use addresses
This patch allows rpc.call_upload_file to use addresses (if passed), and
also converts the ConfigWriter._DistributeConfig to pass them, since
this is an often-done operation.
Reviewed-by: imsnah
Iustin Pop [Mon, 20 Oct 2008 14:47:00 +0000 (14:47 +0000)]
Convert non-static rpc calls to use addresses
This patch converts all non-staticmethods rpc calls to pass addresses to
the Client calls.
This is done via two new small helpers. These functions also deal with
nodes that are not (yet) in the configuration file, and pass None for
the address instead (which allow NodeControllers to do resolving).
Reviewed-by: imsnah
Iustin Pop [Mon, 20 Oct 2008 14:46:52 +0000 (14:46 +0000)]
Add infrastructure for using addresses in rpc.py
The patch adds support for passing node addresses to NodeController
objects, which should speed up the connect sequence.
The patch also adds another very small optimization of computing the
content-length header value in the parent Client class instead of each
NodeController.
Reviewed-by: imsnah
Iustin Pop [Mon, 20 Oct 2008 14:46:44 +0000 (14:46 +0000)]
Improve conformance with the style guide for rpc.py
This patch renames some internal function to camel case, for compliance
with the style guide.
It also fixes the module docstring (how old was that?).
Reviewed-by: imsnah
Guido Trotter [Mon, 20 Oct 2008 13:44:45 +0000 (13:44 +0000)]
Use constants.VALUE_AUTO for ip comparison too
Forward-port-of: r1889, Reviewed-by: imsnah
Reviewed-by: imsnah
Guido Trotter [Mon, 20 Oct 2008 13:44:32 +0000 (13:44 +0000)]
Document mac option for gnt-backup import
Forward-port-of: (r1888, r1891), Reviewed-by: (iustinp, imsnah)
Reviewed-by: imsnah
Guido Trotter [Mon, 20 Oct 2008 13:44:19 +0000 (13:44 +0000)]
LUCreateInstance: reuse mac address on import
When importing an instance with the same name as the exported one if the
mac address is "auto" we try to reuse the previous mac address. One can
still force generation of a new one with mac="generate".
Forward-port-of: r1887, Reviewed-by: iustinp
Reviewed-by: imsnah
Guido Trotter [Mon, 20 Oct 2008 13:44:06 +0000 (13:44 +0000)]
LUCreateInstance: accept mac = VALUE_GENERATE
VALUE_GENERATE is handled exactly the same as VALUE_AUTO and the mac
address is generated randomly.
Forward-port-of: r1886, Reviewed-by: iustinp
Reviewed-by: imsnah
Guido Trotter [Mon, 20 Oct 2008 13:43:54 +0000 (13:43 +0000)]
Add mac option to gnt-backup import
Before 'auto' was the only allowed possibility
Forward-port-of: r1885, Reviewed-by: iustinp
Reviewed-by: imsnah
Guido Trotter [Mon, 20 Oct 2008 13:43:34 +0000 (13:43 +0000)]
Add VALUE_AUTO and VALUE_GENERATE constants
'auto' is used in multiple place in the code with a meaning similar to
'default', 'generate' will be used to force generation of mac addresses
when the default would be to reuse an old one.
Forward-port-of: r1884, Reviewed-by: iustinp
Reviewed-by: imsnah
Iustin Pop [Mon, 20 Oct 2008 12:50:50 +0000 (12:50 +0000)]
Remove the logger.py module
Since now we use only one function from the logger module
(SetupLogging), we move it to utils.py (which is already imported by all
users of this function), and we remove the module.
Reviewed-by: imsnah
Iustin Pop [Mon, 20 Oct 2008 12:50:37 +0000 (12:50 +0000)]
Convert http.py to use the logging module
Reviewed-by: imsnah
Iustin Pop [Mon, 20 Oct 2008 12:50:29 +0000 (12:50 +0000)]
Convert cmdlib.py to use the logging module
Note that many uses of logger.Error were used in 1.2 for their
side-effect of logging to stderr, where the user will see the messages,
and not for having the entry in the log. As such, we need to go over and
review every use of logging.* and decide if it should use feedback_fn
instead of being a logging call.
Reviewed-by: imsnah
Iustin Pop [Mon, 20 Oct 2008 12:50:22 +0000 (12:50 +0000)]
Convert hv_xen.py to use the logging module
Reviewed-by: imsnah
Iustin Pop [Mon, 20 Oct 2008 12:50:14 +0000 (12:50 +0000)]
Convert mcpu.py to use the logging module
Reviewed-by: imsnah