Add helper function to generate disk labels
... which converts decimal numbers into '/dev/sda', '/dev/sdb', etc.
Signed-off-by: Jose A. Lopes <jabolopes@google.com>Reviewed-by: Hrvoje Ribicic <riba@google.com>
Remove Ganeti Lock Manager and Monitor
...from the jobs code, as this functionality is nowcarried out by wconfd. Also remove dead code resultingfrom this removal.
Signed-off-by: Klaus Aehlig <aehlig@google.com>Reviewed-by: Petr Pudlak <pudlak@google.com>
Add the old DRBD secrets reservation code to mocked config
.. so that the unit tests work without the presence of WConfd.
Also fix mocked GenerateMAC, which used _temporary_ids by mistake in theoriginal ConfigWriter.
Signed-off-by: Petr Pudlak <pudlak@google.com>...
Add the old MAC reservation code to ConfigMock
.. so that unit tests work without the presence of WConfd..
Signed-off-by: Petr Pudlak <pudlak@google.com>Reviewed-by: Klaus Aehlig <aehlig@google.com>
Merge branch 'stable-2.11' into stable-2.12
Merge branch 'stable-2.10' into stable-2.11
Signed-off-by: Thomas Thrainer <thomasth@google.com>...
Convert all the classes to new-style classes
... to make lint shut up.
Signed-off-by: Helga Velroyen <helgav@google.com>Reviewed-by: Jose Lopes <jabolopes@google.com>
Fix unit tests
Fix unit tests according to changes to the instance class.
Add 'install_image' param to 'Cluster'
The 'Cluster.install_image' param holds the location of the image tobe used for the safe installation instances.
Don't test for ganeti-masterd to exist
...it has just been removed for good.
Signed-off-by: Klaus Aehlig <aehlig@google.com>Reviewed-by: Hrvoje Ribicic <riba@google.com>
Fix hard-coded list of daemons in test
The reality is, that masterd is gone now, so there isno point in testing that daemon-utils knows about it.In fact, it would be a bug if daemon-util would mentionit.
Signed-off-by: Klaus Aehlig <aehlig@google.com>...
Add tests for compression tool misuse
This patch extends opcode tests for both unacceptable tools, and theuse of tools which are not on the compression_tools parameter list.
Signed-off-by: Hrvoje Ribicic <riba@google.com>Reviewed-by: Thomas Thrainer <thomasth@google.com>
Forbid the compression tools from being set over RAPI
Although we impose restrictions on what can be input as a compressiontool, someone with RAPI credentials could choose and execute a numberof commands by first setting the custom tools and then executing them....
Add the compression tools parameter
This patch makes the myriad of changes necessary for the compressiontool parameter to be added. The filtering of compression tools forsuspicious entries has been added for this exact purpose.
Signed-off-by: Hrvoje Ribicic <riba@google.com>...
Make arbitrary compression tools work
We assume that the compression tools the user supplies use stdin andstdout for handling data, and that a switch is used to distinguishcompression from decompression. This patch introduces these constraintsby adding the invocation of these tools to the import-export daemon....
Extend offered compression types
This patch adds a few new types of compression supported by Ganeti:gzip-fast (gzip -1), gzip-slow (ordinary gzip), and lzop. gzip nowbecomes a shorthand for gzip-fast kept for compatibility.
Extend tests in preparation for new compression types
To ensure that later modifications are also noted in tests, this patchupdates the test to account for all compression types known.
Remove the unit test for verifying node's DRBD reservations
We'll need to reconstruct a similar test later when we add functions formanipulating the configuration directly to WConfd.
Fix the mocked ConfigWriter to pass DRBD minors methods
.. since for unit tests, we don't have access to WConfd, which nowimplements the functionality.
Upgrade config to support top-level citizen disks
Implement upgrade/downgrade of the config file to support disks astop-level citizens. During downgrade, disks that are not attached to anyinstance will be removed from config file.
Signed-off-by: Ilias Tsitsimpis <iliastsi@grnet.gr>...
Eliminate local variable
Signed-off-by: Ilias Tsitsimpis <iliastsi@grnet.gr>Reviewed-by: Jose A. Lopes <jabolopes@google.com>
Fix the broken unittests
Fix the unittest that have been broken when we lifted the Disk objectsfrom the Instances.
Add 'disks_info' Instance slot
Instance's 'disks' slot will contain a list of disk UUIDs. Create a newslot named 'disks_info' which will be annotated with the disk objects'during the RPC.
Get instance's nodes from config
Use 'GetInstanceNodes' to get the nodes of an instance, instead of the'all_nodes' Instance property.
Get instance secondary nodes from config
Use 'GetInstanceSecondaryNodes' to get the secondary nodes of aninstance, instead of the 'secondary_nodes'.Annotate 'secondary_nodes' in rpc so that backend has access to it.
Change TestInstance in objects unittest
Now that 'all_nodes' and 'secondary_nodes' of an instance are computedfrom the 'config' module, move the corresponding tests from'objects_unittest' to 'config_unittest'.
Fix '_create_instance' in config_unittest
Previously '_create_instance' would initialize the config object everytime it would be called. This causes '_WriteConfig' to fail withConfigurationError: The configuration file has been modified since thelast write. Fix this by passing the config object to '_create_instance'...
Add timestamp/serial_no slot to disk objects
Now that disks are top level citizens in config,they need a timestamp and a serial_no slot.
Add systemd unittests
Test the consistency between daemon-util and the systemd unit files:
- Each service started/stopped by daemon-util must have a respective unit file. - The daemon user/group in the service file must be the same as the one reported by daemon-util....
Add a test for parsing version strings
...even in the presence of patch levels.
Avoid assertIn
...as it is only present in python version 2.7 and higher.
Remove left-over debug code
This also avoids writing to hard-coded paths under /tmp
Signed-off-by: Klaus Aehlig <aehlig@google.com>Reviewed-by: Helga Velroyen <helgav@google.com>
daemon-util: support for daemons loaded on demand
We add a second category of daemons in daemon-util, those that arestarted on demand and should not be started by the start_all action, butshould be stopped during service shutdown. This category currently...
Merge branch 'stable-2.11' into master
Make GlusterFS tests dual-stack-aware
Resolving "localhost" may either return "127.0.0.1" or "::1",so we have to check for both cases in the relevant tests.
Signed-off-by: Apollon Oikonomopoulos <apoikos@gmail.com>Signed-off-by: Klaus Aehlig <aehlig@google.com>...
Add a new node parameter cpu_speed
This parameter will describe the speed of the CPU relativeto the speed of a "normal" node in this node group.
Add tests for RAPI forbidden parameters
This patch introduces a number of tests ensuring that forbiddenparameters cannot be used. This is done by introducing a fake opcodeand a fake RAPI handler for it. Forbidden parameters, specificforbidden values, and renamings to forbidden parameters were all...
Minor preparations for forbidden params in RAPI handlers
This patch prepares the way for defining forbidden parameters in RAPIhandler classes as is done with renames and the like. No implementationof the logic is present here, just the expansion of expected...
Make RAPI opcode attributes use a class and not a tuple
The tuple approach to storing opcode attributes might have worked whenthere were four possible modifiers per method, but with aliases thisnumber has been pushed to five, and with forbidden parameters it will...
Refactor rlib2 unit tests
This huge patch removes a lot of cruft that has been accumulated in therlib2 test file. A new class, RAPITestCase, provides a common base forall the tests and unifies checks that were repeated on a per-test-casebasis.
Fix non-running test and remove custom_nicparams rename
Due to a missing base class, the test that was supposed to check ifRAPI instance parameter renames during modifications are working didnot execute. As the instances are not covered by the QA tests, the...
QMP: make QmpConnection act as a context manager
This will allow automatic connection and socket cleanup on commandcompletion.
We also repeat the Qmp tests using the context manager. For this to befeasible, we move the test scenario to class variables and modify...
Add the zeroing-image option
This patch adds the zeroing-image option to gnt-cluster and theOpBackupExport params. The many changes are all minor, yet necessary.
Signed-off-by: Hrvoje Ribicic <riba@google.com>Reviewed-by: Jose A. Lopes <jabolopes@google.com>
QMP: always return the command result
According to the QEMU Machine Protocol Specification, the messages sentby QMP as a response to a command can be of two types: either an errormessage (identified by the "error" key), or a success message(identified by the "return" key)....
QMP: test supported_commands
Add test for supported_commands.
Signed-off-by: Apollon Oikonomopoulos <apoikos@gmail.com>Signed-off-by: Thomas Thrainer <thomasth@google.com>Reviewed-by: Thomas Thrainer <thomasth@google.com>
KVM: move tap control functions to a submodule
Move all tap-related functionality to the hv_kvm.netdev submodule. Werename _OpenTap to OpenTap, since it will now be used as a publicfunction.
Also, change the hv_kvm tests to import the new code.
Signed-off-by: Apollon Oikonomopoulos <apoikos@gmail.com>...
Update 'daemons/daemon-util' to stop 'ganeti-metad'
Note that 'ganeti-metad' is not automatically started together withall the other daemons. Instead, 'ganeti-metad' is only started when...
Merge branch 'stable-2.9' into stable-2.10
Signed-off-by: Hrvoje Ribicic <riba@google.com>Reviewed-by: Klaus Aehlig <aehlig@google.com>...
Merge branch 'stable-2.8' into stable-2.9
Signed-off-by: Hrvoje Ribicic <riba@google.com>Reviewed-by: Klaus Aehlig <aehlig@google.com>
Remove VerifyConfig tests
These tests don't work with WConfd, because the configuration isverified automatically before each operation and it's not possible tomodify the configuration state directly.
It'll be necessary to re-create these tests for WConfd once...
Update ConfigWriter test for _UpgradeConfig
.. to work with the updated version.
Remove desctructive ConfigWriter test
This test relies on bringing a configuration into an inconsistent state,and doesn't work with WConfd any more.
Update ConfigWriter unit tests
This involves:
- Updating how a mocked configuration object is set up.- Adding calls to refresh in-memory objects from the configuration (because they're not shared any more).- Adding calls to Update to save modified in-memory objects so that the...
Add unittests for instance modify parameter renaming
The get/put QA test could be used for instances as well, but unlikeother objects, instances have a very large number of discrepancies andmissing fields. To avoid enumerating every discrepancy and testing...
Add test for group custom parameter renaming
This patch introduces a simple test checking if a custom_* parameter isrenamed and passed to the opcode correctly.
Fix failing cluster query test
This patch makes a mock use a dictionary instead of an object, allowingalias finding to work on it.
Add support for value aliases to RAPI
This patch extends the metaclass used to generate RAPI handlers toallow creating aliases of certain values returned by GET methods.
Add reason parameter to RAPI client functions
Only the functions for starting, stopping and rebooting a VM had a reasonparameter. Now, all the RAPI client functions generating opcodes do.
Also, one test is expanded to verify that a RAPI request with both body and...
Add a method for WConfd context to GanetiContextMock
Move the test for adding/removing certs to config. tests
.. and update it to work with ConfigWriter instead of the 'security'module.
Signed-off-by: Petr Pudlak <pudlak@google.com>Reviewed-by: Helga Velroyen <helgav@google.com>
Extend unittest for gnt-os info changes
Extend unit test ganeti.query_unittest.py, to correspond to thechanges made in the 'gnt-os info' output.
Signed-off-by: Dimitris Bliablias <bl.dimitris@gmail.com>Signed-off-by: Michele Tartara <mtartara@google.com>...
Fix WConfd mock client after updating the lock
.. because instead of a job ID and a lock file, we now pass a single,client ID object.
Update tests after merging 'os_get' into 'os_validate'
... namely, unit tests and QA.
Signed-off-by: Jose A. Lopes <jabolopes@google.com>Reviewed-by: Petr Pudlak <pudlak@google.com>
Make mcpu acquire WConfD locks
So far, the mcpu acquires locks that live in memoryof masterd. This design does not fit with our jobs-as-processesgoal. So make mcpu acquire the corresponding locks in WConfDinstead.
Note that this implies changes in various other files that call...
Add a mock for the wconfd module
As our so-called unit tests for the logical units are morelike integration tests, calling the actual LU through an almostlive mcpu, we need a quite involved "mock" for the wconfd module,called indirectly through mcpu. The difficulties arise from the...
Add a mock version of livelocks
...as the will be used by mcpu for lock handling and that willrequire tests to be adapted accordingly.
OS images in 'LUInstanceCreate' and OS scripts optional
Merge branch 'origin/stable-2.8' into stable-2.9
Enable a timeout for instance shutdown
Add the timeout parameter to the StopInstance function of the hypervisor baseclass and to all its implementations.
Also, change the tests as required by this change.
Signed-off-by: Michele Tartara <mtartara@google.com>...
Fix failing tests
The previously introduced changes caused some tests to fail. This patchalters the tests to expect different values, while still ensuringcorrect behavior.
Signed-off-by: Hrvoje Ribicic <riba@google.com>Reviewed-by: Petr Pudlak <pudlak@google.com>
Extend RAPI client constant unit test with error codes
The RAPI client is meant to be independent from the wider Ganeticodebase, but it still needs to use Ganeti constants. To enforce this,a unit test is used. This patch extends the unit test with error code...
Remove duplicated '_CheckOSVariant'
It seems '_CheckOSVariant' was moved from 'ganeti.cmdlib.instance' to'ganeti.cmdlib.instance_utils' but the source was never deleted. Thispatch deletes the source copy if this function.
Signed-off-by: Jose A. Lopes <jabolopes@google.com>...
Use node UUIDs for executing LU hooks
LUNodeAdd, the only LU using a node name still, is changed to overwritePreparePostHookNodes() and use node UUIDs only as well.This allows to remove the support for 3-tuples as results ofBuildHooksNodes() and removes the translation to node names....
Add unittest for gnt-cluster modify --mac-prefix
Add unittest for cluster mac-prefix modification support.
Signed-off-by: Dimitris Bliablias <bl.dimitris@gmail.com>Reviewed-by: Jose A. Lopes <jabolopes@google.com>
Fix return of 'Validate'
Signed-off-by: Jose A. Lopes <jabolopes@google.com>Reviewed-by: Helga Velroyen <helgav@google.com>
Fix the test that checks for the order of instance's nodes
The test checks if the first node in the tuple is the primary node, butbecause it names the node so that it's the least one alphabetically, thetest always succeeds. This fixes the test.
Use node UUID as client certificate serial number
It turns out, that some implementations of OpenSSL are morepedantic in checking the certficates than others. In thisparticular case, the SSL connection could not beestablished when the serial number of the certificates...
Revert "Disabling client certificate usage"
This reverts commit 45f75526b848, which was introduced totemporarily disable the implementation of SSL clientcertificates. As this patch series fixes the reason forthe disabling, we are rolling back the patch....
Add the WConfD daemon itself
The daemon exposes the declared functions in Ganeti.WConfd.Core to RPCclients (currently just 'echo').
Add the WConfD daemon to build configuration files
Also list it in the Haskell datatype, constants, Python constants andtest configuration.
Add 'instance_communication_parameter' to 'Cluster'
Fix start/stop scripts to run luxid unconditionally
and update the unit check the list of daemons.
Fix compatibility issues
Signed-off-by: Santi Raffa <rsanti@google.com>Reviewed-by: Jose A. Lopes <jabolopes@google.com>