Call fsync() after modifying /etc/hosts.
This is a critical file. Breaking it would be very bad. Thus, if the systemcrashes before the data is synched to the disk, it should have the completefile afterwards.
Reviewed-by: iustinp
Fix functions for /etc/hosts.
- Combine hostname and aliases on one line- Fix bug with wrongfully removed newline characters- Use wrapper for SetEtcHostsEntry in cmdlib
Reviewed-by: iustin
Rollback commit 356.
Add functions for known_hosts files.
Reviewed-by: TODO
Add missing descriptions to {Add,Remove}EtcHostsEntry.
Reviewed-by: schreiberal
Relax replace_disks_all meaning for drbd8
In order to make the replace secondary action to be done via the sameopcode parameters for both remote_raid1 and drbd, we must allow theLUReplaceDisks to change replace_disks_all for drbd with non-emptyremote_node into replace_disks_sec....
Soften the requirements for hooks execution
Currently, an unreachable node (or one that return undetermined failure)in the hooks pre-phase will abort the curren operation. This is notgood, as a down node could prevent many operation on the cluster.
This patch changes a RPC-level failure (and not a hook execution...
Use new functions to modify /etc/hosts.
Add functions to modify /etc/hosts.
Cleanup temporary file in RemoveAuthorizedKey.
Changes related to logging
This patch modifes: - mcpu.Processor.LogWarning to have its 'hint' parameter as optional and only log it if not None - cmdlib._WaitForSync to not log directly to stdout/stderr but via the proc.Log(Info|Warning) methods...
Enhance secondary node replace for drbd8
This (big) patch does two things: - add "local disk status" to the block device checks (BlockDevice.GetSyncStatus and the rpc calls that call this function, and therefore cmdlib._CheckDiskConsistency) - improve the drbd8 secondary replace operation using the above...
Check whether init.d script is executable.
Remove --secondary-node option.
Replace --secondary-node option with an optional parameter for --node.
Enhance DBRD8 disk replacement (same nodes)
This patch adds enhanced reporting and much more checks to the diskreplacement (when not switching the secondary).
Reviewed-by: imsnah
Implement degraded status for logical volumes
Logical volumes can be 'degraded' in a similar way to mirrored devices,when their underlying storage has gone away (i.e. after a physical diskfailure and 'vgreduce --removemissing'). If we can detect this, we can...
Add better error logging functions for LUs
Currently, some LUs use logger.Error, others just feedback_fn, etc. Thispatch adds three functions to mcpu.Processor than can be used to logmessages to both the log and to the user.
These function will be used to enhance the output of replace-disks for...
Enhance mirror operations for DRBD8
Currently, the mirror operations (add and remove children) test againstthe instance's attributes. This patch changes the check tests to workagainst the actual status of the device (i.e. live data) which is morerealistic....
Allow DRBD8 operation without backing storage
This patch adds the following functionality: - DRBD8 devices can assemble without local storage (done by allowing None in the list of children, and making DRBD8 to ignore all children if any is None)...
Make DRBD8 disks show 'degraded' status if diskless
This patch enables the bdev.DRBD8 class report a degraded status if thelocal disk is missing. This allows `gnt-instance info` to report theactual situation in this case.
Note that DRBD7 should also behave like this, however the diskless case...
Change the way remove children is called in bdev
For some cases, we don't have to have access to the children of a devicein order to remove them (e.g. md over lvs, or drbd over lvs). In orderto ease the removal process, skip over finding the child if it provides...
Add a support function to objects.Disk
This patch adds a function returning the device path if it is computablefrom the disk object (and we don't need to instantiate a bdev object onthe target node in order to compute this). Only LVs support this.
Small cleanup for error formatting
Reviewed-by: ultrotter
Handle missing init script at cluster init
This patch adds a check in the prereq of LUInitCluster for the existenceof the init script. This allows a clean abort instead of a stack dump.
Based on a report by admin@steibei.net
Fix a unhandled error case in device creation
The block device creation process is the following: - device create - device assembly (on primary or depending on dev_type, on secondary too) - set sync speed - return
The problem is that device assembly after creation was not checked for...
Miscellaneous style fixes
This patch fixes some minor pylint warnings (unused variables, wrongindentation, etc.) and a real bug in the recovery for drbd8 renameprocedure.
Rename utils.GetUUID to utils.NewUUID.
Bump protocol version up
The OS cleanup patches change the wire protocol. Increment the protocol numberby one.
Reviewed-By: iustinp
Convert os_get to use OS rather than InvalidOS
In order to do this for simplicity we leave the OSFromDisk function as-is andwe convert the eventual exception to an OS object in ganeti-noded. Theunmangling gets simplified and so does the code for checking whether the OS is...
Simplify diagnose mangling/unmangling functions
The functions in ganeti-noded and rpc.py still deal with the fact that anInvalidOS error could be returned by DiagnoseOS. As this is not the caseanymore simplify their code for the current behavior.
Make DiagnoseOS use the modified OS objects
Modify backend.py so that DiagnoseOS only returns OS objects rather thanInvalidOS errors, and make sure gnt-os understands the new objects. Also deletethe deprecated helper functions from gnt-os.
Create OS from an InvalidOS error
Add a new FromInvalidOS static function to objects.OS that makes it easy tocreate an object representing a broken OS starting from the relevant exception.
Make the OS object able to represent broken OSes
Till now the OS object just represents a correct OS instance. Change it so itcan represent a broken one too, by adding a "status" field: if this field isdifferent from the OS_VALID_STATUS constant the object is considered to be an...
Make call_os_get a single node function
call_os_get is never called with a real list of nodes, so there's no point init being multi-node. Making it single-node till a usage for multi-node call isfound.
Fix two typos in a doc string
Remove a wrong "i" and add a missing ")" to the DiagnoseOS function doc string.
Implement tag searching
This patch adds a search command for locating tags on all objects of thecluster using a regex pattern.
Reviewed-by: aat
Implement device to instance mapping cache
Currently, troubleshooting DRBD problems involves a manual process of goingbackwards from the DRBD device to the instance that owns it.
This patch adds a weak (i.e. not guaranteed to be correct or up-to-date)cache of device to instance. The cache should be, in normal operation,...
Update the dev_path on LVs on rename
When renaming a logical volume, we should change the dev_path (and otherinternal variables) in order to be consistent.
Revision 302 is broken, this fixes it
I forgot a pair of parentheses in that revision which break the commoncase. This patch adds them.
Fix printing of unconfigured DRBD devices
If the device is unconfigured (not yet did SetDiskID for it ever), itmight have a physical_id of None. This patch fixes that case.
Whitespace fixes
More sane handling of errors during failover
Currently we ignore errors on instance shutdown (on the source node)during instance failover. We should do this only if the user gave acommand line options allowing this, as it's a dangerous thing to do.
This patch fixes this by using the same "--ignore-consistency" option...
Fix bridge checking in instance failover
The current code checks the bridge on the primary node of the instance,but we need to check it on the destination node.
This was caught by testing failover with a down primary node.
Fix _UpdateEtcHosts to understand empty lines.
Change the signature of some methods of mcpu.Processor
This patch moves the passing of the feedback_fn argument from the(Exec|Chain)OpCode to the initialization of the Processor instance.
Remove a redundant assignment
The major is declared in the base class, we do not need to overwrite it.
Fix some style issues (whitespace changes only)
Fix a non-clear error message
Implement replace-disks for drbd8 devices
This patch adds three modes of disk replacement for drbd8: - replace the disk on the primary node - replace the disk on the secondary node - replace the secondary node
It also adds some debugging code to backend.py and increments the...
Allow drbd8 devices to work without local storage
This patch adds functionality to drbd8 for: - removing local storage - initializing without local storage - adding local storage
This is needed for the being able to replace disks for drbd8.
Implement block device renaming
This patch add code for renaming a device; more precisely, for changingthe unique_id of the device. This means: - logical volumes, rename the volume - drbd8, change the remote peer
This is needed for the being able to replace disks for drbd8....
Import two itertools recipes
The two function 'any' and 'all' are copied as-is from the python 2.4documentation for the itertools module. They are useful (and are alreadybuiltin function in python 2.5).
Add a custom str() method for objects.Disk
This is done in order to easy debugging of disk-related issues.
Modify two mirror-device related rpc calls
The two calls mirror_addchild and mirror_removechild take only one childfor addition/removal. While this is enough for our md usage, for localdisk replacement in drbd8, we need to be able to specify both the data...
Initial implementation of drbd8 template type
This is a partially working drbd8 template type. It does: - add/remove - startup/failover/shutdown
Not working is replace disks, which needs custom code for this template.
Allow DRBD8 to sync after sb1-pri with no changes
Currently the way we shutdown or startup disks seems to make DRBD8unhappy. Until we rewrite the sequence of (de)activation, allow DRBD toconnect after a sb1-pri condition with no changes to the data.
Fix a disk handling bug triggered by failover
This leaves an instance's disks configured for the primary node as afterdisk activation we want to start the instance anyway. As such,_GatherBlockDevs in backend.py will need the disks configured for theprimary....
Add DRBD8 class for handling drbd version 8.x
This duplicates some code from the DRBDev class, but not very much, andit will be expanded with the new functionality available for the 8.xversion. Currently the code is not accessible outside the module.
This patch introduces a dependency on the pyparsing module....
Move/rename _IsValidMeta to base drbd class
The DRBDev._IsValidMeta only checks for the metadata device size. Sincethis is a useful check (but not complete) for DRBD8, move it to the baseclass and name it _CheckMetaSize.
More abstractions from DRBD7 to base class
This moves the _SetFromMinor and _MassageProcData to the base class.
Improve out-of-minors handling
Currently, the out-of-minors handling is not very good: though both MDand DRBD functions for finding an unused minor can return None, only theDRBD code checks for this case.
This patch improves this by making the functions _FindUnusedMinor raise...
Move some methods from DRBDev to BaseDRBD
Since some of the methods and constants are valid for both 0.7 and 8.xversions, we move them to the base class.
Some tiny style fixes
Split some DRBD functionality based on versions
This is a small split of some functionality from the DRBDev class into abase drbd class that holds just a few things, in order to make migrationto drbd 8.x easier.
Abstract more strings values into constants
Currently, the disk types are defined using constants in the code.Convert those into constants so that we can easily find them and checktheir usage.
Note that we don't rename the values of the constants as they are used...
Patch series for reboot feature, part 2
This patch series implements the reboot command for gnt-instance. Itsupports three types of reboot: soft (hypervisor reboot), hard (instanceconfig rebuild and reboot) and full (full instance shutdown and startupagain)....
Patch series for reboot feature, part 1
Make “gnt-cluster verify” exit 0 if there's no problem with instances.
Add the number of VCPUs in gnt-instance info
Allow force removal of instances
This patch adds a new option to the instance removal command"--ignore-failures" that forces the removal of the instance from theconfiguration even if the removal process encounters errors.
In order to be able to do this when the remote node(s) is(are) down, we...
Replace more ssh paths with proper constants
The node's ssh keys filenames are now provided as constants; this shouldallow easier customization.
Also, the user's ssh key computing has been abstracted into ssh.py
Trivial typing fixups.
Remove some hardcoded names/paths from backend.py
This patch does the following: - add constants.GANETI_RUNAS = "root", which is used to compute the homedir (and thus the .ssh directory) instead of hardcoding "/root/.ssh" in backend.AddNode and backend.LeaveCluster...
Add a generic write file function
Currently there are a few version of "write a file safely" in the code.This patch adds a generic function that should be able to replace allthe other versions.
The "take attributes from the target file" option, while useful, is not...
Do not walk the whole DATA_DIR on node leave
Since we remove only files from DATA_DIR and not from subdirectories,let's not walk the entire tree, a simple listdir suffices. Also switchto utils.RemoveFile from simple os.unlink.
Enhance GetHomeDir to accept either names or UIDs
Currently GetHomeDir accepts UIDs only. Enhance it to accept either auser name or a user id, to allow for nicer usage.
Some small improvements to the hooks environment
For the configuration update hook, it's useful to have a consistent namefor the target of the operation. As such, the LU code is modified toinclude an GANETI_OP_TARGET that points either to the cluster (name),...
Implement post-configuration-update hook
This patch adds a special hook: the post-configuration update hook. Thishook has only a post phase that runs after a top-level LU that modifiedthe configuration.
Since the hook is a post-phase one, no error checking is done on the...
Split the hooks env building in two parts
This patch moves some of the environment processing from _BuildEnv to anew _RunWrapper command which does the stringification and adds thesstore variables.
The reasoning is that the sstore can be fresher than before the...
Move hook execution decision to HooksMaster
Currently, the HooksMaster creation and execution decision is in theProcessor class. This is not optimal, so we change to always create ahooks master and instead make the decision inside that class, bycreating empty node lists for both pre and post if the lu doesn't...
Remove cfg and sstore parameters to HooksMaster
The HooksMaster class doesn't use the cfg parameter, and it's better touse it from the LU anyway (if needed). Let's remove it.
Also, the sstore of the LU can be fresher than the sstore we got at inittime, so use that instead and remove our own....
Enable the ConfigWriter to keep track of updates
This allows external callers to determine if the configuration has beenchanged.
Infrastructure for detailed instance restarts, part one
The beginning of the infrastructure for detailed instance restarts. Doesnot affect behaviour if code yet.
Use the kernel's ability to generate UUIDs.
This removes the dependency on either the uuid module or e2fsprogs' uuidgen.
Add small function to read the homedir of a user
This can be used to replace hardcoded "/root/" paths.
Remove fping as a dependency for Ganeti.
This patch completely gets rid of fping - replace all fping invocations with TcpPing calls - update documentation accordingly. - associated cleanups (use constant for localhost IP, use more sensible defaults for TcpPing and use those)...
Some small fixes to utils.GenerateTable
This adds: - fix the case when a dumb caller didn't stringify its values - explicitly raise a ProgrammerError in case a field is missing from the headers dictionary
Fix AskUser to not die on extra input
Currently, AskUser dies with -ESPIPE if the user gives more than onecharacter plus newline. This is because the python library, whilereturning only two chars from the readline(2) call, will cache the restof the input, and when we do a write, it will try to seek back to just...
Implement gnt-node evacuate
This patch adds a new 'evacuate' subcommand to gnt-node. The commandwill do a replace disks for all instances having that node as secondarywith the new target being the new node given.
The syntax is: gnt-node evacuate src_node target_node...
Make Xen DomU kernel and initrd configurable at build time.
Remove the shebang from modules
Since modules are not directly executables, remove the shebang fromthem. This helps with lintian warnings.
Also make the autogenerated _autoconf.py contain two comment lines atthe beginning, like the other modules.
Detect node restarts and reactivate disks.
- Change format of watcher state file to JSON.- Move log path for watcher script to constants.py.
Fix a wrong exception name
This was introduced in rev 208.
Separate error formatting out of cli.GenericMain
This patch moves the error formatting into a separate function that willbe exported so that scripts that execute multiple opcodes can create thesame output as for GenericMain. Also, GenericMain becomes more readable....
Revert a debugging 'raise' from rev 195
As far as I understand, this was just a debugging aid. Remove it so thatconfiguration errors are nicely handled.
Enhance cli.SubmitOpcode to use custom parameters
This patch allows the SubmitOpcode function to take a pre-createdProcessor instance and a different feedback function. This is helpfulwhen submitting more than one opcode from a shell script.
Add boot id to “gnt-node list”.
Add handler for errors.TagError
This patch adds a simple handler for TagError that prints the error(better than having a stack dump).
Add source file option for {add,remove}-tags
This patch adds a '--from' option to the {add,remove}-tags commands thatallows the command to read from a file or from stdin (when passing adash for the filename).
Implement command-line tags support
This patch adds generic functions for tag manipulations to cli.py andmodifies gnt-{cluster,node,instance} to export {list,add,remove}-tagscommands that use those.