Move cmdlib._HasValidVG to utils.CheckVolumeGroupSize
This is required for splitting the cluster initialization code.
Reviewed-by: iustinp
Move {Set,Remove}EtcHostsEntry wrappers to utils.py
This is required for the split of the cluster initialization code.
Reviewed-by: iustinp, ultrotter
Remove REQ_CLUSTER from opcode handling code
It's not needed anymore now that all opcodes require a cluster. Clusterinitialization was the only exception.
Remove unreachable code from cli.SubmitOpCode
Rename master socket to ganeti-master.sock
…/run/master.sock is not specific enough.
Remove SimpleStore cache
SimpleStore is instantiated anew most of the times it's used, so havinga cache inside it serves no purpose. Removing it.
Forward-port: Alias Dump/Load functions in ganeti.serializer to DumpJson/LoadJson
The remote API will use JSON for the foreseable future, so it's betterto put the serialization format in the function name. We can stilluse another serialization format for Ganeti's core....
Add check for node memory in instance creation
Currently the check for enough memory is done only on instance startcommand and failover command. But we also start an instance in instancecreate, therefore we need to check this instead of failing to start in...
Show cluster hypervisor for gnt-cluster info
Author: schreiberalReviewed-by: iustinp
Forward-port: make gnt-modify work with new HVM parameters
This fixes gnt-instance modify so it actually works with thenew HVM parameters for Ganeti 1.2
Forward-port: show only parameters relevant to the instance
This patch modifies the code for "gnt-instance info .." to only displayinstance parameters that actually apply to that instance, i.e. for PVMinstances no HVM parameters are shown and vice versa....
Forward-port: patch 3/4 extended HVM features for 1.2
This patch adds hypervisor support for the extended HVM features.
Forward-port: patch 2/4 extended HVM features for 1.2
This patch adds the commandline extensions and the code to storeand display the extended HVM features.
Complete removal of md/drbd 0.7 code
This patch removes the last of the md and drbd 0.7 code. Cluster whichhave the old device types will be broken if they have this applied.
Reviewed-by: imsnah
LURemoveInstance: fix op.ignore_failures usage
Currently: the LURemoveInstance.Exec() method uses the ignore_failuresattribute of the OpRemoveInstance opcode, but it doesn't check for itsexistence. The patch adds this attribute to _OP_REQP and to all the...
Fix drbd show parser to handle valueless keywords
It turns out in some cases there can exist keywords without anassociated value exported by drbdsetup show. This patch makes the valuepart optional in our parser, so that if it's not present the parsingresult will contain an array with just the keyword in it. This is not a...
Split drbd command creation and execution
Make _AssembleDisk more similar to _AssembleNet by splitting thegeneration of the drbdsetup command and its execution. While notchanging anything this makes it easier to manipulate the command just incertain cases, which in the future we'll need to do....
Implement node daemon conectivity tests
This patch adds in gnt-cluster verify checks for inter-node tcpcommunication checks on the node daemon port for both the primary and(if defined) secondary networks.
The output looks like (4-node cluster, one with the secondary interface...
Forward-port changes made to readd in 1.2
qa_node.py: Fix typo in messagecmdlib.py: Don't add readded node to node listganeti-qa.py: Make sure readd isn't done for master node
CLI: retry: remove command opts/args in "gnt-X"
This new version of the patch removes only the listing of the usage inthe "gnt-X" list, but keeps the strings in since we'll want to enhanceand use them in "gnt-X $cmd --help".
Reviewed-by: ultrotter
Revert "CLI: remove command opts/args in "gnt-X""
This reverts commit 976.
CLI: remove command opts/args in "gnt-X"
[Forward-port of the 1.2 branch patch]
This patch removes all the parameters and options from the output"gnt-X" (i.e. the subcommand list for command). This is done in order touniformize the output, currently only some parameters are shown and they...
Reduce chance of ssh failures in verify cluster
The cluster verify builds a sorted list of nodes and passes that to allthe nodes (in parallel) for ssh checks. This means that for a clusterwith N nodes, there will be approximately N simultaneous connections to...
bdev: always log command output if it failed
Currently many error handling code paths in bdev.py log onlyresult.fail_reason (i.e. exit code or signal that killed the command)but not its output. This makes debugging very hard.
The patch changes all places where we only log fail_reason to also log...
DRBD: Fix another bug in diskless activation
DRBD8 requires that we pass ‘--create-device’ to the first command thatwants to activate a new DRBD minor. We do this currently when we run the“drbdsetup ... disk” command which we run before the network setup....
Remove utils.CheckDaemonAlive and use “xm info” instead
There are a couple of reasons for doing so:- /proc is not OS independent, it's only supported by Linux (there are emulations on other systems, but those might differ from the way Linux represents data)....
Improve DRBD8.Open's docstring a bit more
Fix comment typo in bdev.py
Fix DRBD8 diskless assembling
The algorithm for attaching to existing DRBD devices is not trivial. Ithas four alternatives, and there is a bug in the last one when we havediskless devices.
The last case (local disk info matches but remote/network configuration...
Use new ssconf function to check configuration version
Upgrades will be handled in future patches.
Use dict instead of if/elif map for hypervisor classes
Rename hypervisor code to lowercase filenames
Export the number of cpus to iallocator scripts
Now that we have the number of cpus available from the hypervisors, wecan export this to the iallocator scripts.
Add node cpu count to gnt-node list
This patch adds the backend and frontend changes needed for being ableto list the cpu count.
Wrap exception in _DistributeConfig code
nodelist.remove(X) could potentially raise a ValueError (even if the chancethat the current node is not in the list are pretty scarce, and its absenceshould raise a red flag anyway). If this happens let things go on, as that's...
Simplify target generation in DistributeConfig
Currently we get the list of nodes, and for each one extract all its info, andjust to exclude it if the name matches ours. Since the list of nodes is a listof names just use .remove() to exclude ourself from it, and use that list...
ssconf: update the SetKey docstring
SetKey is used, other than for adding new nodes, in another few cases. Updatethe docstring to reflect this, so we don't mislead people reading it.
Delete hypervisor.py
This completes the changes in r898 by actually getting rid of the old unusedhypervisor.py code which was left in the code tree.
Add cluster-verify hooks
Only post-hooks are run on cluster verify, and then their output is sent backto the LU, which upon failure displays it to the user and changes the result ofthe execution to a failure.
Add a LU Hooks notification function
Previously LUs could be failed by pre-hooks, and post-hooks just had effects bythemselves. This patch allows a LU to define the HooksCallBack function if itwants to know about its hooks' results and alter its results in response....
HooksMaster: Make RunPhase return the rpc output
Right now the hooks output is propagated from the nodes all the way up toHooksMaster.RunPhase, which uses it for debugging PRE hooks, but then silentlydiscards them. We'll now propagate it up to the Processor.ExecOpCode function,...
Remove NoHooksLU.BuildHooksEnv
Since NoHooksLU defines HPATH as None, BuildHooksEnv will never be called (asthe LogicalUnit.BuildHooksEnv docstring correctly states). Removing thefunction altogether, to avoid having dead code lying around, and to make sure...
LogicalUnit.BuildHooksEnv, update docstring
The LogicalUnit.BuildHooksEnv docstring used to say that the node list shouldnot include the master node. This is obviously not the case checking therelevant code, and double-checking with iustin he confirmed it just document...
Remove non-existing arguments from some docstrings
A fewdocstrings in the HooksRunner backend class list arguments the relevantfunctions do not take. Clean them up.
Support config version in ssconf
Disable forking in the master daemon
This patch adds a mechanism to disable utils.RunCmd in selectedprograms. This is needed in the master daemon unless we confirmthreading doesn't pose any problems.
This makes cluster init fail, but creating new trunk clusters is anyway...
Raise PrereqError when exporting file-based instance
This patch adds a check to LUExportInstance.CheckPrereq to raise anerror when an instance with file disks is exported.
Split hypervisor.py into several files
Before it was a huge file with more than 700 lines. No code changes weremade except for changing imports and class names where needed. In thefuture, we could even think about only importing the hypervisors weactually need. The patch finished QA scripts and distcheck successfully....
Move the 'cmd' lock from cli.py to ganeti-masterd
This patch removes the lock and the lock options from cli.py and movesthem to the master.
Later during development we can remove it completely, but for now it'sgood to protect any other tool that uses the lock directly....
Convert cli.SubmitOpCode to use the master
This patch converts the cli.py SubmitOpCode method to use the unixprotocol and thus execute the opcodes via the master.
The patch allows a partial burnin to work with the master. Currently thequery opcodes, since they are executed via the SubmitOpCode, are...
Move iallocator script execution to ganeti-noded
Currently the iallocator execution takes place in the master, which is aviolation of the current architecture, and will create problems with athreaded master daemon.
This patch moves the execution to the backend, similar to the hooks...
Fix iallocator instance info
The commit "IAllocator: some more info exported" broke the instance listgeneration due to a wrong index variable. This patch fixes that.
Extend utils.WriteFile
Add parameters to not check the path for absoluteness, implement a dryrun mode and automatically create a backup if requested. This will beused by the cfgupgrade utility.
Reviewed-by: schreiberal
IAllocator: some more info exported
This patch adds the following information to the exported info: - hypervisor type (in the main dict) - total memory used by primary instances (in each node dict) (can be computed from the node+instance dicts, but it's cheap to compute...
IAllocator: simplify node info computation
Currently we try to convert the values returned by call_node_info toints, and if all succeed, we actually do the conversion. Simplify thisby doing it in one step.
The patch also adds exporting of node memory as 'reserved_memory'....
patch 1/4 extended HVM features for 1.2
This patch extends the config objects with the slots to handlemore HVM configuration items.
Author: schreiberalReviewed-by: iustinp,imsnah
Move target creating symlinks in lib/ into Makefile.libcommon
backend.FinalizeExport: safely initialize some vars
This patch initializes nic_count and disk_count with 0. This preventssome reference errors if the snap_disks block device list is empty.
Style fixes for trunk
This small patch fixes: - wrong indentation in two places - use of 'os' variable that hides global scope os module
Implement replace secondary via the iallocator
This patch implements secondary replace via the iallocator. The newopcode parameter 'iallocator' behaves like this: if passed, it willalways compute and assign a new secondary, behaving in effect as if the...
Fix generalized relocate mode of IAllocator
The patch which generalized the IAllocator was half-true: it actuallyput the selection of the node inside the IAllocator, so callers were notable to specify replace primary node.
This patch does: - split the arguments to the constructor in three sets: mode and name...
Add gnt-backup remove functionality
This patch also fixes the LUExportInstance Prereq docstring.
Generalize the replace_secondary mode in iallocator
Currently the replace_secondary mode is too restrictive. This patchchanges this to a general 'relocate' mode where the node(s) to bechanged are specified via a new key in the request dict ('nodes') so...
Send required_nodes field to the iallocator scripts
This patch adds the 'required_nodes' field in the request dict for theiallocator.
This means that the handmade-checks in the create instance can besimplified, and that the dumb allocator can be made simple. Therefore...
Move all iallocator functions into a class
This patch moves all the iallocator function into a separate class thatis then somewhat easier to use. It doesn't bring any new functionality.
The patch also changes the way the iallocator is called - theOpTestAllocator opcode is no longer needed, and all its parameters...
Correctly filter out Domain-0 from domain list if requested.
Only change instance status if not already so
This patch makes the _SetInstanceStatus only change the status of theinstance (in the config file) if it's not already in the desired state.This skips the increase of the config serial no without actual data...
Reuse common code between MarkInstance{Up,Down}
This patch creates a new method ConfigWriter._SetInstanceStatus thatconsists of the common code between MarkInstanceUp and MarkInstanceDown.These two methods become wrappers over the _SetInstanceStatus.
Abstract the json functions into a separate module
This simple patch adds a new module that holds the simplejson functionsfor serialization/deserialization. This reduces the amount of redundantcode.
The patch also adds some normalizations to the json output:...
Add --readd option to “gnt-node add”
This allows us to readd a node after it failed and required areinstallation or replacement.
IAllocator part 3: LUCreateInstance changes
This (final) patch allows the instance's nodes to be selectedautomatically based on the passed allocator algorithm.
The patch changes the pnode opcode parameter from required to optional,now either the pnode or the iallocator must be passed....
Reorder checks in instance create
This patch reorders the checks in the instance create prereq so that allchecks and normalisations that are not node-dependent are done beforethe node dependent checks.
This is done so that, after the instance-related opcode parameters are...
Implement 'out' direction on allocator tests
This patch adds the paths for searching for instance allocators andmakes the LUTestAllocator code run the allocator and return the resultsif the direction specified is 'out'. 'out' means that the opcode will...
Allocator framework, 1st part: allocator input generation
In preparation for the introduction of automatic instance allocator,this patch adds an allocator simulation opcode, that based on the inputparameters, will return either the input message to the allocator...
Fix two pylint uninitialized variable errors
Bugfix: wrong identifier in CheckPrereq message
Move the disk size computation to its own function
This is currently hard-coded for the two drive case and will need to bereworked for multi-disk support.
The patch is needed to support passing the total required size to theiallocator interface.
SharedLock: restrict assertion condition
When we release a shared lock if there are no exclusive waiter then the numberof shared waiters must be exactly equal to the ones scheduled to pass.
Verify: make skipping checks possible
Add a general way to skip some checks at cluster-verify time and make the N+1memory redundancy check optional.
Verify: add N+1 Memory redundancy verification
For every node we check that we can host all the instances it's currentlysecondary for belonging to the same primary. This ensures that if a node failsall its instances can fit on their secondary node. The code only works when...
Verify: save instance config
Save the instance config after we queried it in an instance_cfg dict. This canbe used later by any function that wants it, without reloading it from theconfiguration module. It will be used for N+1 memory resilience checking....
Verify: add more instance information to node_info
The sisnt-by-pnode field contains all secondary instances of a node, grouped bytheir primary node. This information allows us to see quickly if when a nodedies some of its instances cannot be started on their secondary node....
Verify: add instance information to node_info
With this patch node_info is changed to store information about which primaryand secondary instances are configured on a node. This information is useful tocheck memory and disk allocation. A list of non-redundant instances is also...
Verify: Add and populate node_info dict
During information gathering we collect information from call_node_info, andthen when we cycle trough the nodes add it into a node_info dict containing anode's free memory and disk. This will be useful later to verify that the...
Rework the results of OpDiagnoseOS opcode
Currently, the opcode DiagnoseOS is the only opcode that return astructure of objects.OS (which is a custom class, and not a simplepython object) and furthermore all the processing of OS validity acrossnodes is left to the clients of this opcode....
Change client protocol to raise exception on failures
Currently the luxi.client.SubmitJob and Query methods return the unserializedresult without processing it at all. This patch changes this by adding a'RequestException' error that is raised if the query itself or the...
Add per-opcode results to job processing
This patch changes the definition of a job and introduces per-opcoderesults.
First, the result and status fields of a job are condensed into a single'status' attribute. Then, we introduce an opcode status and one result...
Move the OS search code into an abstract function
Based on the previous OS search code changes, we can now move the OSsearch code into a generic look-for-file function in utils.py. Thismeans that the allocator code can use the same function.
Change backend._OSSearch return values
Currently, the function backend._OSSearch() returns the (first) base dirin which this OS can be found. Thereafter the full actual path to the OSdir is built in the backend.OSFromDisk() function.
This patch changes this so that _OSSearch() always returns the full path...
Verify: remove useless check in _VerifyInstance
The list of instances passed to _VerifyInstance is the one coming fromself.cfg.GetInstanceList(). So there's no point, inside that function, inchecking whether the current instance is a member of that list. Moreover...
Verify: instance verification cleanup
The instance configuration is grabbed both in the _VerifyInstance function andin the loop that calls it. Clean this up by passing the configuration as aparameter.
Verify: fix crash when a node is down
Currently if ganeti-noded doesn't respond on a node gnt-cluster verify will diewhen verifying primary instances for that node. Fix this by just emitting anerror message if no information about running instances is returned from the...
Verify: fix ERROR message indentation
All ERROR messages in cluster verify are indented by four spaces, this one isindented by two. Fixing this skew.
Reviewed-by: imsnah, iustinp
Fix spelling mistake in constants.py
Of course instance creation don't have any modem, and the comment was justtalking about modes. Sorry to everybody expecting whistles.
Small code style fix
Bugfix instance create when file-storage-dir None
os.path.join does not like None as argument and fails withAttributeError: 'NoneType' object has no attribute 'startswith'.
This patch makes sure the passed argument is a string in any case.
Two small code style fixes
Add file_storage_dir,file_driver to OpCreateInstance
Reviewed-by: ultrotter, iustinp
Modify LURenameInstance to support file backend
This patch does two things:- Modify LURenameInstance.Exec to rename directory when a file-based instance is renamed- Modify config.RenameInstance() to replace the directory name in config.data for file devices...
Modify LUCreateInstance to support file backend
- Modfiy _GenerateDiskTemplate to support file-based disk template- Modify _CreateDisks to create directory needed for file-based instances before creating the actual files- Modify _RemoveDisks to delete directory for file-based instances...