Use network's mac prefix
Modify existing GenerateMAC so that it takes network as an argument.
Substitute _GenerateOneMAC with a decorator _GenerateMACPrefixthat chooses the prefix (network's or cluster's) and wraps_GenerateMACSuffix that generates the three remaining bytes....
Pass netinfo in rpcs
If a nic has a network field then encapsulate a network object innetinfo slot for every rpc. This is needed to pass network info toscripts managing nics (kvm-vif-bridge).
Introduce _BuildNetworkEnv()
Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Pass detailed network info in hooks
Introduce client support for networks
gnt-network is used to manipulate and handle networks thatcurrently provides the following operations:
ss_conf support for networks
Signed-off-by: Apollon Oikonomopoulos <apollon@noc.grnet.gr>Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Rapi support for networks
Support: - GetNetwork(s) - CreateNetwork - ConnectNetwork - DisconnectNetwork - RemoveNetwork
Basic IP pool management logic
Implement LUs for corresponding opcodes: * LUNetworkAdd: - Check for IP validity - Reserves all necessary IPs - Create new Network config object * LUNetworkRemove: - Checks if connected to any nodegroup - Remove a Network config object...
Implement LUNetworkQuery
Summarily list all existing networksSupply detailed info for every existing network - List used/free IPs - List instances with NICs assigned to the corresponding network - List NIC index and IP for the above instances
Implement complementary config methods for retrieving networks....
Implement LUNetworkSetParams
Support modifying all network parameters except for network (ip range)Cannot modify gateway and reserved ips at the same time.
Implement network/nodegroup mappings
LUNetworkConnect() connects a network to a nodegroup and definesits netparams (mode and link). Specifically: * Check if network already exists * Check if netparams are valid * Check if already connected to the same nodegroup...
Config methods for reserving/releasing IPs
Use TemporaryReservationManager for IP handling to ensureconfig data consistency.
Implement: - methods for reserving/releasing IPs - _UnlockedCommitTemporaryIps() - CheckIPInNodeGroup() used for conflicting IPs...
Modify LUInstanceCreate to support networks
Implement backend support, to export the IP pool managementfunctionality to the clients. When the new NIC parameter 'network'is given, the ippool management system is triggered.If a NIC belongs to a network, it inherits the netparams...
Modify RemoveInstance() to support networks
Release any IPs held the instance before actually removing.
Modify LUInstanceSetParams() to support networks
Keep backwards compatibility just like LUInstanceCreate() andsupport network parameter for NIC object.
Add ec_id argument in Update() to be able to commit temporaryIPs that were previously reserved.
Peripheral changes for networks
Specifically: * export a new environment variable for the gnt-os-interface * export a new environment variable for KVM specific scripts * ovf support for networks
Signed-off-by: Apollon Oikonomopoulos <apollon@noc.grnet.gr>...
Modify instance client to support networks
Add --no-conflicts-check option.Modify instance query methods to return nic's network info.
IP pool related objects, opcodes and constants
Config objects: * Introduce L{Network} with - IPv4 network field (mandatory) - IPv4 gateway, IPv6 (network/gateway), mac prefix, type (optional) * Modify existing config objects to support networks: - Add new slot 'network' to L{NIC} config object...
Introduce new module for IP pool management
Add new library module lib/network.py.Introduce new class: AddressPool.
AddressPool implements all operations needed for managing IPsinside the IP pool.
Given a Network config object (nobj), the class:
Add support for cpu_cap and cpu_weight Xen params
This patch adds support for Xen's CPU scheduler 'cpu_cap' and'cpu_weight' parameters.
Ganeti default values (cap: 0=unlimited, weight: 256) are Xen defaults.
cpu_cap is not validated correctly because of actual Ganeti limitation...
LUClusterVerifyGroup: Localize virtual file paths
The check for file consistency didn't properly handle virtual pathsin case of a virtual cluster. This didn't cause any breakage as ina standard virtual cluster setup with only one node all files arevisible for every node....
Enable query socket usage in gnt-node/gnt-group
This switches gnt-node/gnt-group (and their equivalent RAPI resources)to go over the query socket.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
vcluster: Don't virtualize /etc/hosts path
/etc/hosts is a bit special as it's a system-wide file and the virtualcluster/node root doesn't apply. The modification of /etc/hosts shouldbe disabled in virtual clusters. If it isn't, however, the vclusterfunctions would raise an exception complaining about a path outside of...
cli: Stop hardcoding /etc/hosts path
There is a constant for this purpose.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Move constant for /etc/hosts to pathutils
Needed for coming patches.
Merge branch 'devel-2.6'
Merge branch 'stable-2.6' into devel-2.6
gnt-job: List archived jobs if requested
If requested via a filter or by including the “archived” output,archived jobs will be loaded and shown. This is significantly slowerthan just listing normal jobs, therefore by default they are not loadedat all....
gnt-job list: Add option to include archived jobs
This provides a convenience option to include archived jobs in theoutput list. It's equivalent to using “-o +archived”, but tab completionis nicer.
Signed-off-by: Michael Hanselmann <hansmi@google.com>...
jqueue: Correct docstring
The description was not accurate.
jqueue: Add new in-memory attribute for archived jobs
This attribute is set to True for jobs which were restored from anarchived file. A new filter will act on this field.
query: Report data type for unary operators
All data kinds (used to restrict the data collected) referenced in afilter can be requested once it's been “compiled”. However, the kindsof fields used in boolean expressions (e.g. ["?", "xyz"]) were notrecorded. This patch changes the code accordingly and provides a unit...
verify-disks: Explicitely state nothing has to be done
Example output:$ gnt-cluster verify-disksSubmitted jobs 4327Waiting for job 4327 ...No disks need to be activated.
Add basic unit tests for "gnt-cluster epo"
This patch adds some unit tests for “gnt-cluster epo”. Not everything iscovered, but at least the bug fixed in the previous patch is.
Fix pylint breakage due to unused var in gnt_cluster
The usage of that variable was removed in 45a36f36, but accidentallythe enumerate() was left in.
cluster epo: Fix bug where IndexError is raised
Updating the “node_query_list” variable would fail if no arguments werepassed and the “--all” option wasn't specified. A follow-up patch willadd unit tests.
Fix usage of errors.ResolverError
This exception is documented to have three arguments, but in one casewe raise it with a simple string argument. Let's fix that.
Remove unused/deprecated error classes
It seems a few of the error classes are no longer used:
- LVMError, deprecated in 8c5533a5 (before ganeti 1.2.2!)- ConfdRequestError, deprecated in b0dcdc10- SshKeyError, introduced in the initial open source commit but never used (⁈)...
backend: Use utils.IsBelowDir instead of local code
utils.IsBelowDir is actually tested and doesn't allow writes to“…/queue*”, like the old code here did.
jstore: Nicer error message on non-numeric file content
An error like “invalid literal for int() with base 10” can be quiteconfusing.
bdev: Remove unnecessary empty line
My local pylint didn't complain.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>
Better list of replace-disks arguments + typos fixed
The man page and the bultin-in help for gnt-instance replace-disks wereinconsistent. Also fixed some typos in man pages.
Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Check fingerprint of file with allowed file storage paths
This makes differences show up in “gnt-cluster verify”.
Explicitly ask for the default iallocator in commands
Now "gnt-instance recreate-disks" uses the default iallocator when "." isspecified as the iallocator. For uniformity, the same behavior applies tothese commands: gnt-node evacuate gnt-instance migrate...
Support for the default iallocator in replace-disks
"gnt-instance replace-disks" now behaves like the other commands, and usesthe default iallocator when "." is passed as the iallocator parameter.
bdev: Add functions to verify file storage paths
- LoadAllowedFileStoragePaths: Loads a list of allowed file storage paths from a file- CheckFileStoragePath: Checks a path against the list of allowed paths
The unit test for “utils.IsBelowDir” is updated with cases which weren't...
jqueue: Look at archived jobs when watching
First: This enables the use of “gnt-job watch $id” for archived jobs.
Now, the reason for actually making this work is that duringsufficiently large group or node evacuations jobs are archived beforethe client gets to poll for their output. This led to situations where...
backend: Check for shared storage also
If normal file storage was disabled but shared storage enabled,“_TransformFileStorageDir” would still throw an exception.
in “opcodes._CheckStorageType” there's also a check, but I wasn't quitesure what the correct way of handling it was, so I added a TODO comment....
utils.FilterEmptyLinesAndComments: Return list
We don't use generators often and lists are easier to re-use.
Wipe added space when growing disks
This patch adds code to wipe newly added disk space when growing disksusing “gnt-instance grow-disk”. “New disk space” is defined as the deltabetween the old block device size (not necessarily equal to the amountrecorded in the configuration) and the new recorded size. Extra caution...
cmdlib._WipeDisks: Code formatting
- LogInfo takes *args, no need to replace values right away- Don't overwrite wipe_chunk_size right after it's been set
Factorize removing comments and empty lines from string
This will also be used for verifying the file storage directory.
ssconf: Fix mistake made in commit ee501db
Move a function from backend to ssconf
The “WriteSsconfFiles” function is used to write ssconf files. By movingit we can avoid importing backend into bootstrap. The latter is importedby CLI programs and backend doesn't have much to do with them.
Show old primary/secondary node on disk replacement
People unfamiliar with Ganeti's internals might be confused with thedifferent hostnames showing up later in the process.
cmdlib: Change wording of messages during disk wipe
Error messages don't need to say “please” and it's already obvious someinvestigation is needed. LogWarning already logs the message using“logging.error” internally.
Remove constant for disk wipe block size
It is dangerous to have this block size as a global constant as thatcould give the impression of it being easily changed. Doing so withoutfurther adjustments to how “dd” is called will lead to disks not beingwiped properly....
gnt-instance reinstall: Don't always exit with success
If one or more jobs failed the exit status should be set accordingly.
LUClusterVerify: Ignore /proc/drbd if DRBD is disabled
This fixes issue 190. The problem was that the check for DRBD wasenabled if LVM storage is used and didn't depend at all on whether DRBDis enabled.
cli: Exit with status 0 for --help
This patch is somewhat longer than was anticipated. Before, commands like“gnt-instance --help” would exit with the status code 1 (failure). Withthis patch, those commands exits with 0 (success) while unknown commandsstill print the usage screen and exit with status 1....
Remove option to select the Python version of confd
This will need some more configure.ac checks for required libraries,which will come later with the Haskell dependencies reorganisation.
Remove the python confd server side code
In 2.7 we will only support the Haskell version, if enabled.
Since the original hconfd enabling was a bit hack-ish (copying overthe actual installed ganeti-confd, Python version), the Makefile.amchanges are a bit more involved than just the removal of the Python...
Pylint cleanup
The previous commits introduced some pylint errors.
Signed-off-by: René Nussbaumer <rn@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Modify batch-create to use MultiAlloc
This is the CLI part of the OpInstanceMultiAlloc change. There is someroom for improvement especially with user handling, but it works for nowand the code got simplified significantly.
QA tests still needs to be written....
Make validation error message more useful
Provide a custom Validate for OpInstanceMultiAlloc
This is needed, as we're not strictly separating validation frompopulating the defaults. We do this all in one function. If we nowreceive a non complete OpInstanceCreate opcode in instances, we wouldrun into AttributeErrors on those....
ganeti-cleaner: Separate queue cleaning code
This code does not need to run as root, therefore it's better to splitit out. It is now run with the same permissions as the master daemon.
Stop hardcoding root user
Some parts of the code still use a hardcoded user name: root. This patchreplaces all with a constant specified at build time. The end goal is tomake it possible to run a Ganeti cluster without any special privileges(of course this will prevent some functionality from working)....
ensure-dirs: Don't hardcode ssconf file group
Otherwise chown(2) will fail when noded doesn't run as root.
Fix missing locks in InstanceRecreateDisks
In case of in-place recreate-disks operation, all node locks were releasedbefore starting the actual execution.
InstanceRecreateDisks: new assertion for node locks
Make sure that all the nodes where a disk operation is peformed are locked.
ensure-dirs: Don't convert list to tuple
Tuples are data structures, not containers.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: René Nussbaumer <rn@google.com>
Always_failover doesn't require --allow-failover anymore
If an administrator sets always_failover, it means that there is no needfor another explicit approval to failover instead of migrating.
Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>...
Populate the instance dict with opcode infos
This is needed so we can load it as an opcode. However, this informationshould not be available on the client, so we inject that info when wereceive the request.
Provided unittest to verify behaviour.
Signed-off-by: René Nussbaumer <rn@google.com>...
Adding RAPI client for instance multi allocation
It was very easy to refactor CreateInstance to repurpose some part of itfor the instance multi allocation request. So we do this.
Signed-off-by: René Nussbaumer <rn@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Revert unintentional change of daemon log file names
Commit 3329f4dea6 unintentionally changed the filenames of all daemonlog files. This patch reverts part of those changes.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
instance_info now returns vcpus
instance_info and all_instances_info calls had different per-instancereturn types, this commit fixes the mismatch.
Signed-off-by: Agata Murawska <agatamurawska@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Verify the node count just if the allocation was successful
Implement virtual cluster support in Python code
- pathutils: Prepend node-specific prefix path- RPC: Use virtual paths (see vcluster.py)- SSH: Pass environment variables, use destination's node directory when copying files using scp, use GANETI_HOSTNAME to determine hostname...
vcluster: Add more details to docstrings
As requested by René Nussbaumer. Hopefully things are more clear now.
Adding RAPI resource for multi-allocation
This is straightforward.
Adding multi-allocation logic
This patch adds the Logical Unit for the instance multi allocationopcode.
Adding the new opcode for multi-allocation
Skeleton for the multi-allocation opcode
Refactor shared code
We've some work which we need to do for the multi allocation request aswell, so lets refactor it to separate functions.
_ComputeNics is kinda ugly, as it reserves the MAC. I added a TODO tothink more about how we factor this behaviour out....
Fix REQ_RESULT for MultiInstanceAllocRequest
Fix a validation issue
We want to validate the result only if the iallocation run was asuccess.
Signed-off-by: René Nussbaumer <rn@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>
netutils: Use virtual hostname if set
This enables the hostname seen by other code through Hostname.GetFqdn tobe changed through the environment variable “GANETI_HOSTNAME”.
Add new module for virtual clusters
This module will take care of managing paths for virtual clusters.Unittests are included (100% coverage).
bootstrap.SetupNodeDaemon: Stop hardcoding bind address
Commit b43dcc5a11 added support for IPv6. To have the node daemon bindto an IPv6 address on startup it changed the code to pass a static bindaddress (0.0.0.0 or ::0). If a user had configured another bind address...
hv_kvm: Use pu.CONF_DIR variable
… instead of using SYSCONFDIR directly.
utils.filelock: Remove executable bit from lock files
There's no need for lock files to be executable.
LUInstanceCreate: Include group name in error message
“pnode.group” contains the UUID, which isn't very user-friendly.
ShellWriter: Add parameter to disable indentation
This will be used to write a more compact bash completion script.
constants: Stop using wildcard import for pathutils
It still needs to be imported for hypervisor parameter defaults, butafter this change paths are no longer exported from constants.
Migrate lib/uidpool.py from constants to pathutils
File system paths moved from constants to pathutils.
Migrate lib/utils/*.py from constants to pathutils
Migrate lib/watcher/__init__.py from constants to pathutils
Migrate lib/tools/ensure_dirs.py to pathutils
Migrate lib/ssh.py from constants to pathutils