gnt-node add: add error msg when using IPv6
Signed-off-by: Manuel Franceschini <livewire@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Use family in backend.StartMaster
This patches changes the StartMaster method to consult the clusterprimary ip version when deciding whether to use arping or ndisc6 afteractivating the master ip.
Signed-off-by: Manuel Franceschini <livewire@google.com>...
Make Hostname object always intialize its name to fqdn
This patch restores the behaviour of Hostname (previously known asHostInfo) to always use fqdn. This was broken due to the fact that thenow used getaddrinfo does not return an fqdn in contrast togethostbyname_ex()....
utils: Use WriteFile in {Set,Remove}EtcHostsEntry
This avoids duplicate effort and has been a TODO for a long time.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Modify gnt-node add to call external script
Signed-off-by: René Nussbaumer <rn@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Make it possible to invoke RunCmd in interactive mode
This is needed so we can run external scripts asking for password and suchto run interactive. Downside is that we can't get the output of the programbut we can still use the exit code.
Signed-off-by: René Nussbaumer <rn@google.com>...
Removing all ssh setup code from the core
Support IPv6 node add
Signed-off-by: Manuel Franceschini <livewire@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Support IPv6 cluster init
Add primary_ip_family to ssconf
Since this parameter will be used on all daemon startups, it needs to beavailable on all nodes. This is achieved by querying it via ssconf. Thispatch additionally adds a getter method to readily retrieve the primaryip family from a ConfigWriter object....
Add new cluster parameter primary_ip_version
We expose the ip_version (4, 6) to the external interface and internallywe convert it to ip_family (AF_INET=2, AF_INET6=10). This makes the codemore concise as all functions deal with family rather than version....
netutils: make re class attribute and catch IndexError
These missing changes were initially agreed upon but then forgotten.First, we move the valid name regex to the class-level such that itwon't be compiled for every invocation of GetIP() and we wrap the result...
Merge branch 'devel-2.2'
Merge branch 'devel-2.1' into devel-2.2
Conflicts: man/gnt-instance.sgml...
Fix some small newline style issues
RAPI client: Support modifying instances
RAPI: Allow modifying instance
gnt-debug: Extend job queue tests
Test multiple opcodes, also with failure.
jqueue: Mark opcodes following failed ones as failed, too
When an opcode fails, the job queue would leave following opcodes as “queued”,which can be quite confusing. With this patch, they're all marked as failed andassertions are added to check this.
Signed-off-by: Michael Hanselmann <hansmi@google.com>...
jqueue: Work around race condition between job processing and archival
This is a simplified version of a patch I sent earlier to make sure the jobfile is only written once with a finalized status.
rapi.client, http.client: Format url correctly when using IPv6
This patch moves the FormatAddress helper function from daemon.py tonetutils.py. This enables its use in http.client as well as inrapi.client. Furthermore this adds functionality to format IPv6...
Support IPv6 in lib/http/server.py
Support for resolving hostnames to IPv6 addresses
This patch enables IPv6 name resolution by using socket.getaddrinfoinstead of socket.gethostbyname_ex.
It renames the HostInfo class to Hostname and unifies its use throughoutthe code. This is achieved by using static calls where no object is...
Always use address instead of hostname in rpc.Client
In light of the upcoming IPv6 support, this patch enables the rpc.Clientto always use a node's address to connect to it. This is necessary as wedo not want to rely on name resolution to connect to the correct IP...
cluster init: Write ssconf before noded starts
This change is needed as we will need to read the primary ip versioncluster parameter before we start the node daemon. The reason is that weneed to know in advance if we bind to the IPv4 or IPv6 any address....
Introduce new IPAddress classes
This patch unifies the netutils functions dealing with IP addresses tothree classes:- IPAddress: Common IP address functionality- IPv4Address: IPv4 specific functionality- IPv6address: IPv6-specific functionality
Furthermore it adds methods to check whether an address is a loopback...
jqueue: More checks for cancelling queued job
We can also check when the lock status is updated. This willimprove job cancelling.
errors: Function to check whether value is encoded error
jqueue: Add more debug output
Merge branch 'devel-2.1'
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Re-add the 'live' parameter to migration opcodes
This patch reintroduces the live parameter, for backwards compatibilityat the Luxi level. This way, clients can work transparently with both2.1 and 2.2, even though sub-optimally.
Signed-off-by: Iustin Pop <iustin@google.com>...
Restore 'tablet mouse on vnc' behavior
We needed to revert commit 5b062a58ac76b39c2dc6a7e1543affdf43dc7ee7because it was in conflict with the usb_mouse hv parameter. Here wereintroduce its functionality only when usb_mouse is not specified.
Signed-off-by: Guido Trotter <ultrotter@google.com>...
Revert "Add -usbdevice tablet to KVM when using vnc"
This reverts commit 5b062a58ac76b39c2dc6a7e1543affdf43dc7ee7.This fixes issue 109. The mouse type can be set with the usb_mousehv parameter.
Signed-off-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
workerpool: Don't keep reference to task arguments
The workerpool should not keep any reference to task arguments afterthey were processed by RunTask. Doing so led to jobs being cachedby the job queue's WeakValueDictionary for longer than they should've...
cli.SubmitOpCode: Pass keyword parameter as keyword
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Manuel Franceschini <livewire@google.com>
masterd.instance: Add missing argument
_DiskTransferPrivate takes three parameters, not two.
Adjust message in case ~/.ssh is no directory
Use actual path, not something hardcoded.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
RAPI client: Fix docstring for migrating instance
RAPI client: Support renaming instances
Allow renaming instances via RAPI
RAPI client: Don't re-use PycURL object
With this patch, a new PycURL object will be created for each request.This should make the RAPI client safe for simultaneous calls frommultiple threads. Unittests are adjusted accordingly.
An unnecessary variable assignment is also removed from the unittest...
Fix bug in bdev when drbd version format is x.x.x.x
This patch fixes a bug reported in [0]. Newer drbd versions can haveanother digit beyond the regular major, minor and point release digits.We modify the regex used to match that with an optional parts which is...
Allow instance NIC's IP address to be None
Also add some assertions.
Add new parameter type “maybe string”
Before strict checking was implemented, NIC IP addresses could be setto “None”. Commit bd061c35 added more strict checking, includingenforcing the IP address to be a string. With this new type, itcan again be set to None....
cmdlib: Change expected type for source CA on remote import
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Fix a few job archival issues
This patch fixes two issues with job archival. First, theLoadJobFromDisk can return 'None' for no-such-job, and we shouldn't addNone to the job list; we can't anyway, as this raises an exception:
node1# gnt-job archive foo...
Change handling of non-Ganeti errors in jqueue
Currently, if a job execution raises a Ganeti-specific error (i.e.subclass of GenericError), then we encode it as (error class, [errorargs]). This matches the RAPI documentation.
However, if we get a non-Ganeti error, then we encode it as simply...
Instance migration: remove error on missing link
Since we don't support upgrades from 1.2.4 without restarting theinstance, the 'not restarted since 1.2.5' check/error iswrong/misleading.
Since the live migration works anyway without the links (it recreates...
Add check for RAPI paths to start with /2
During a discussion in July 2010 it was decided that we'll stabilize on /2. Seemessage ID <20100716180012.GA9423@google.com> for reference.
RAPI client: The os argument for instance reinstalls is optional
Signed-off-by: David Knowles <dknowles@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
RAPI client: Support migrating instances
workerpool: Add two additional assertions
workerpool: Change signature of AddTask function to not use *args
By changing it to a normal parameter, which must be a sequence, we canstart using keyword parameters.
Before this patch all arguments to “AddTask(self, *args)” were passed asarguments to the worker's “RunTask” method. Priorities, which should be...
RAPI: Support migrating instances
workerpool: Move waiting for new tasks for a worker to the pool
This way fewer private variables of the pool are accesssed by the worker.
workerpool: Remove unused worker method
HasRunningTask is never used except for an assertion, where wedon't really need the lock.
workerpool: Additional check in BaseWorker.ShouldTerminate
Document that it should only be called from within RunTask andadd an assertion for this. This means we can no longer use amethod on the pool and hence remove WorkerPool.ShouldWorkerTerminate.
workerpool: Use common function to add tasks
Rename masterfailover to master-failover
Most (all?) of our commands use dash-separator: replace-disks,verify-disks, add-tags, etc. “gnt-cluster masterfailover” is an oldexception to this rule.
The patch replaces it with master-failover, add a compatiblity alias,...
RAPI: Add os params to instance creation v1
Since the RAPI QA suite doesn't seem to offer easy testing of failedcreations, I didn't add this to the QA. Pointers on how to do it arewelcome.
The patch also changes the 'os' argument to be required, since that is...
Improve handling of lost jobs
Currently, if the cli.JobExecutor class is being used, and one of thejobs is being archived before it can check its result, it will raise astracktrace as _ChooseJob is not prepared to handle this case.
This case makes JobExecutor work better with lost jobs (it still reports...
luxi: convert permission errors into exception
This patch adds handling of permission errors so that we don't showtracebacks when a non-root user runs a gnt-* command. Since in thefuture we'll have different permissions, we need to handle this in RAPItoo....
cmdlib: Return new name from rename operations
The new name is then displayed by the clients.
gnt-instance rename: Fix bug and rename params
This patch fixes a bug when gnt-instance rename was invoked with--no-name-check. It renames the internal variables to be consistent withthe ones in equivalent instance add code. Furthermore it checks whether...
Add modification of the reserved logical volumes
This doesn't allow addition/removal of individual volumes, onlywholesale replace of the entire list. It can be improved later, if weever get generic container parameters.
The man page changes replaces some tabs with spaces (hence the...
Add printing of reserved_lvs in cluster info
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: René Nussbaumer <rn@google.com>
Introuce a new cluster parameter - reserved_lvs
This parameter, which is a list of regular expression patterns, willmake cluster verify ignore any such LVs. It will not prevent creation orremoval of such volumes by the backend code.
Change the meaning of call_node_start_master
Currently, backend.StartMaster (the function behind this RPC call) willactivate the master IP and then, if the start_daemons parameter is true,it will also activate the master role.
While this works, it has two issues:...
Move the UsesRPC decorator from cli to rpc
This is needed because not just the cli scripts need this decorator, butthe master daemon too (and it already duplicated the code once).
In cli.py we just leave a stub, so that we don't have to modify all thescripts to import rpc.py....
Update the RAPI node migrate for the 'live' change
This patch adds handling of the new 'mode' parameter to the RAPI server,while keeping compatibility with the old mode. Note that in the old mode(when 'live' is being passed), the auto-mode doesn't work....
Update the RAPI client for the migration mode
See the discussion on the previous patch about this. Basically unless wewant to a add a new 'feature' marking for the live migration parameter,there is no simple way to handle this nicely in the client.
Given that the client was/is marked as experimental, this patch simply...
Rename the OpMigrate* parameter 'live' to 'mode'
This is needed as now the parameter is no longer boolean, but tri-state.
Rename migration type to migration mode
This is in preparation for the rename of the opcode 'live' parameter to'mode'.
utils: Fix incorrect docstring
Merge branch 'devel-2.1' into master
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Fix issue when changing the disk template to drbd
If we pass the current primary node, the conversion will fail horriblywith LVM creation errors. Instead, we catch and check for thiscondition in CheckPrereq.
Always set commonName in X509 certificates
Due to the current switch of the RPC client to PycURL, a bug with newerversions of libcurl surfaced. When the 'Subject' or 'Issuer' of'server.pem' were empty, SSL handshake failed.
This patch changes the certificate generation functions such that they...
Adding constants for setup-ssh
Change AddAuthorizedKey to also allow filehandles
This is required to use this function over paramikosftp file handles.
Signed-off-by: René Nussbaumer <rn@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
RAPI client: Encode empty body to JSON
If the body consists of an empty dict, it should also be encoded.
Introduce git reference/tag tracking for debugging
This patch adds a new vcs-version file that is generated via git (andcan be adapted if VCS is changed) and then embebbded as VCS_VERSION inthe constants module.
This means two things:- local modifications without committing to git (or when using a tar.gz...
Fix epydoc warning "Lists must be indented."
Signed-off-by: Luca Bigliardi <shammash@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Convert RPC client to PycURL
Instead of using our custom HTTP client, using PycURL's multiinterface allows us to get rid of the HTTP client threadpool.The majority of the code is still in the ganeti.http.clientmodule.
A simple per-thread HTTP client pool gives cURL a chance to...
Implement lock names for debugging purposes
This patch adds lock names to SharedLocks and LockSets, that can be usedlater for displaying the actual locks being held/used in places where weonly have the lock, and not the entire context of the locking operation....
Fix pylint complaints introduced in commit e58f87a958c
Due to a small mistake I missed three non-critical pylint complaints forcommit e58f87a958c. They're fixed with this patch.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Signed-off-by: Iustin Pop <iustin@google.com>...
LXC: Add cpu_mask hypervisor parameter
Also implement syntax checking.
Signed-off-by: Balazs Lecz <leczb@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Add ParseCpuMask() utility function
Also adds a generic ParseError exception.
Signed-off-by: Balazs Lecz <leczb@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Add a migration type global hypervisor parameter
Since migration live/non-live is more stable (e.g.) for Xen-PVM versusXen-HVM, we introduce a new parameter for what mode we should use bydefault (if not overridden by the user, in the opcode).
The meaning of the opcode 'live' field changes from boolean to either...
Add test for some aspects of job queue
This new opcode and gnt-debug sub-command test some aspects of thejob queue, including the status of a job. The bug fixed in commit2034c70d507 was identified using this test. A future patch willrun this test automatically from the QA scripts....
LUVerifyCluster: update _ValidateNode description
Change _ValidateNode description to reflect what the function actually does.
Signed-off-by: Luca Bigliardi <shammash@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
KVM hypervisor: Use utils.ShellWriter for network script
This patch converts hv_kvm to use utils.ShellWriter for writingthe network script. It also adds a few unittests (the firstfor any hypervisor modules).
Move ShellWriter class to utils
Also add unittest.
jqueue: Factorize code waiting for job changes
By splitting the _WaitForJobChangesHelper class into multiple smallerclasses, we gain in several places:
- Simpler code, less interaction between functions and variables- Easy to unittest (close to 100% coverage)...
Merge remote branch 'origin/devel-2.1'
Conflicts: test/ganeti.rapi.client_unittest.py: Trivial test/ganeti.rapi.rlib2_unittest.py: Trivial...
RAPI client: Implement old instance creation request format
Commit 8a47b4478 implemented instance creation in the RAPI client,but it left out support for the old instance creation request format.This patch now implements the old format as good as possible. This...
rlib2: Use constants for disk and NIC parameters
These constants were added in commit bd061c35, but the parsing codewas not updated. This also fixes a bug where a NIC's MAC addresswasn't used.
Use reserved documentation IPs and domains
Use RFC 5737 IP addresses and RFC 2606 domain names in allunittests, docs, qa and docstrings.
Provide feedback function for all LU methods
By exposing mcpu's _Feedback function (now renamed to “Log”) to LU's,methods like ExpandNames can also write to the job execution log.
jqueue: Setup inotify before checking for any job changes
Since the code waiting for job changes was modified to use inotify,a race condition between checking for changes the first time andsetting up inotify occurs. If the job is modified after the check...
cli.SubmitOpCode: Support custom job reporter
This is necessary to reuse SubmitOpCode while adding processing forcustom message types.