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.
Reviewed-by: ultrotter
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
Reviewed-by: iustinp
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
Reviewed-by: imsnah
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...
Provide more flexible version numbers to the code
Having the individual parts in the code allows us to build versionnumbers like "1.2" while leaving "3" out in a clean fashion, that iswithout regular expressions or the like. This might be used together...
Modify hypervisor to support file backend
The driver in the xen config file needs to be changed when dealing withfiles rather then bdevs.
This patch does two things:- Add _GetConfigFileDiskData to XenHypervisor which returns the correct disk xen config line. This function checks the logical disk type of...
Implement selective job query
This patch implements query-ing of only selected jobs instead of all.
Move some checks from cli.py to luxi.py
The idea of cli.py and luxi.py is that all protocol checks should be inluxi, and cli.py should just offer some helpful shortcuts for thecommand line scripts.
This patch removes the result checks from cli and adds some other checks...
A small capitalization change (OpCode.LoadOpcode)
This small patch fixed the opcodes.OpCode.LoadOpcode capitalization towhat was intented to be (as the comment says): LoadOpCode.
Implement forking/master role checking in masterd
This patch adds checks for the master role and daemonize support toganeti-masterd.
The patch modifies the startup/shutdown of the server because: - we want bind()/listen() to the master socket to occur before forking...
Add FileStorage class
This is the representation of file VBDs on the backend. It's the firstimplementation an supports only raw files.
rpc directory functions for file backend
Backend directory functions for file backend
Add _[Create,Remove,Rename]FileStorageDir function which are needed forfile-based instance management. These function check whether the givendirectory to operate on is under the cluster-wide defined default file...
Fix SetVGName() to access object not dict
Allow utils.Daemonize() to not close some fds
This patch implements an optional parameter to utils.Daemonize() whichallows that function to not close some file descriptors.
This will allow the master daemon to open the listening socket beforefork - in order to be able to notify errors and return a meaningful exit...
Add a simple gnt-job script
This patch adds a very basic gnt-job script that allows job querying.This goes on top of the previous master daemon patches.
Currently, because of the not-changed cmd lock, you can't query the jobsas long as a job is running - you have to rm the cmd lock and then you...
Move the daemonize function to utils.py
Currently, in ganeti-noded we have the createDaemon function. Sincewe'll need the same in other daemons, we move this function to utils.py
With the move, a few changes were also done: - change the name to Daemonize()...
Improve disk consistency error message again
This new version includes all the possible failure options.
Fix misleading error message when checking disks
_CheckDiskConsistency outputs "Can't get any data from node NODE" when no drbdis found on the target node. This causes a misleading error message to beoutput for example on failover (when the primary node is down, or the instance...
Handle better failing over non-running instances
Right now if you try to failover an instance which is not marked as up theoperation will fail unless you pass the --ignore-consistency flag because thedisks won't be considered to be consistent. Allow them to be if we know the...
Improve export and fix export-on-norun bug
Currently gnt-backup export chains the ShutdownInstance and StartupInstanceopcodes to itself. This works but (a) it's suboptimal, because there's no needto deactivate the instance's disks as we are about to restart it anyway, and...
Forcibly convert export data to str object
ConfigParser.SafeConfigParser doesn't support unicode string objects.Unicode string objects are returned by simplejson.
failover: only start instance if we should
gnt-instance failover on an instance marked as down will mistakenly bring itup. The watcher will then shut it down again, but it's a lot better (and safer)not to start it at all.
Locking: fix one indentation error (codestyle)
Locking: fix superlong lines (codestyle)
Check whether path is valid before accessing it
Add submit function to lib/cli.py
This patch adds function that submit jobs or queries over the unix socketinterface to lib/cli.py. The will be used by the scripts instead of theSubmitOpCode function.
A dumb queue implementation
This patch adds a very dumb in-memory only queue implementation.
Initial implementation of the client unix socket
This patch adds an initial implementation of the client-side of the unixsocket interface. The code is not yet used by other parts of ganeti.
Change the 'gnt-cluster command' execution order
This patch makes the command execute last on the master (if the masteris selected). The order for the other nodes is unchanged.
The patch also updates the man page with some explanations and anexample....
parms->params Refactoring
- Substitute all occurences of name 'parms' with 'params'- Small codestyle fix
Map OpSetClusterParams to correponding LU
Add OpSetClusterParams to opcodes
Skip HasValidVG when --no-lvm-storage on cluster init
This patch does two things:- Remove "vg_name" from _OP_REQP due to the introduction of --no-lvm-storage. Since vg_name option has as default now None and is only set to the DEFAULT_VG if lvm_storage is enabled, this is needed...
Add LUSetClusterParams to cmdlib
Add LUSetClusterParams, which is the LU to modify cluster options.This includes checks:- not to disable lvm storage when it's already disabled- not to enable lvm storage when it is already enabled- not to disable lvm when lvm-based instances are present...
Add method SetVGName() to config.py
Add lvm-storage check when creating instances
This adds a check to fail instance creation if lvm-storage is disabled(cluster-wide). If lvm-storage is disabled (by initializing the clusterwith --no-lvm-storage) only instances with disk template in frozenset...
Add DEFAULT_VG and DTS_NOT_LVM to constants.py
DTS_NOT_LVM:This constant is needed when checking if an instance can be created withthe given disk template if no lvm-storage is available, i.e. the ganeticluster does not have a volume group
DEFAULT_VG:...
Change the order of config updates in some LUs
In the start and stop instance LUs, the configuration update is doneright at the end. This means that if, for example, the instance shutdownsucceeds, but the drive deactivation fails, the next run of the watcher...
Return first parameter of console command only once
Modify Disk.GetNodes() to support LD_FILE
Add constants for file-based storage
Remove the option to create md/drbd7 instances
This patch removes the options that allow to create local_raid1 orremote_raid1 instances. It also modifies the documentation and removesthese disk templates from burnin and from qa.
Remove the add/remove mirror operations
These two operations are related to md/drbd7 code (remote_raid1). Removethem as part of the md/drbd7 removal.
Modify cluster-init to create file-storage-dir
This patch adds three things:- it normalizes the file storage directory path passed to gnt-cluster init- if the file-storage-path doesn't exist on the master node, ganeti tries to create it- adds additional check if the passed file-storage-dir is not a directory...
Remove some deprecated code in bdev.py
The BlockDev.GetStatus() method and some associated constants were neverused in the rest of the code. This patch removes them.
Change the opcode hierarchy and implementation
This patch adds a new top-level class (BaseJO) that is used for bothopcodes and a new Job class.
This new class and the related changes to the OpCode abstract class areused to implement simple to-dict/from-dict transformations, so that we...
Add support for file_storage_dir to LUInitCluster
Author: manuel.franceschiniReviewed-by: iustinp
Add file_storage_dir to opcodes.OpInitCluster
Add SS_FILE_STORAGE_DIR to ssconf
Add DEFAULT_FILE_STORAGE_DIR to constants