History | View | Annotate | Download (28.9 kB)
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 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)....
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...
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
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.
Reviewed-by: ultrotter
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...
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()...
Modify utils.TcpPing to make source address optional
This patch modifies TcpPing and its callers to make the source addressselection optional. Usually, the kernel will know better whatsource address to use, just in some cases we want to enforce a given...
Codestyle fixes: adding a few empty lines
Add a test opcode that sleeps for a given duration
This can be used for testing purposes.
Reviewed-by: ultrotter,imsnah
Allow instance MAC address to be set.
Allow the MAC address of an instance to be specified optionally duringinstance creation and later to be changed via instance modify.
Make utils.RunCmd() deal with interleaved stdout/stderr
Currently, RunCmd is written with the assumption that programs will havea small stderr output, therefore we read the child's stdout (which canbe big, so we don't want to block the child) and then the stderr (which...
Replace hardcoded lock dir
This patch replaces the hardcoded ‘/var/lock/’ directory with one based onLOCALSTATEDIR.
Reviewed-by: imsnah
Make utils.RunCmd log failures when using debug
This patch adds logging of command failures to the debug log in case theuser either started the command (gnt-*) or the node daemon with thedebug flag.
Sort list returned by ListVisibleFiles.
If we didn't sort this list, files would be in arbitrary order.
Make sure aliases written to /etc/hosts are unique.
Add function to return list with unique elements.
Fix another breakage in SetEtcHostsEntry
The code assumes all lines have at least two elements which arewhitespace separated - i.e. it does not deal with empty lines or commentlines with no spaces. This patch fixes this.
Also, the patch replaces the blank between IP and the canonical name...
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.
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.
Use new functions to modify /etc/hosts.
Add functions to modify /etc/hosts.
Cleanup temporary file in RemoveAuthorizedKey.
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.
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 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...
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.
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)...
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.
Add function to list files in a directory, excluding those beginning with adot.
Prevent race condition in CreateBackup().
Remove requirement that host names are FQDN
We currently require that hostnames are FQDN not short names(node1.example.com instead of node1). We can allow short names as longas: - we always resolve the names as returned by socket.gethostname() - we rely on having a working resolver...
Change resolved hostname from dict to a class
The current result of utils.LookupHostname() is a dict, but this doesnot allow static checkers to check the correctness of the code. Thispatch introduces a new class names HostInfo and changes LookupHostname...
Cleanup up selective imports for utils and utils unit test.
Reviewed-by: iustinp, imsnah
Added TcpPing to do ping-alike via TCP connect(2) with defined source address.To be used to replace the currently fping(8) based reachability test.
Change the way how locales are overridden:- Set only LC_ALL, it overrides any other variable- Restore environment after unittest
Filters out LANG and LC_* on RunCmd
This filters out the LANG and LC_ variables from the environment of programsexecuted by RunCmd, in order to get consistent output of execute programs likelvs, etc.
Add function to get all local IP addresses, will be used in cmdlib.py.
Switch utils.RunCmd from popen2 to subprocess
This changes the implementation of RunCmd from using the popen2 moduleto using the (new in 2.4) subprocess module.
This is helpful because the subprocess module has more advanced featuresthan popen2, the most important ones being the ability to run code in the...
Style changes for pep-8 and python-3000 compliance.
This changes the raising of exceptions from: raise Exception, valueto raise Exception(value)
as the first form will be removed in python-3000 and the second form ispreferred now.
The changes also involve a few cases of changing from raising standard...
Comment formatting updates.
Initial commit.