History | View | Annotate | Download (66.7 kB)
Migrate call from backend._GetVGInfo to bdev.LogicalVolume.GetVGInfo
This patch removes duplicate code found in backend which also needs toget VG infos. To make it simpler we moved to bdev.LogicalVolume.GetVGInfo.
Signed-off-by: René Nussbaumer <rn@google.com>...
Use free space in vg instead of biggest free pv space for a snapshot
Even for snapshot we looked at the biggest free pv space even thoughthe vg might have fit the snapshot we aborted if one of the pvs was toosmall. This patch fixes this by looking at the vg size instead of the pv...
Introduce new IPAddress classes
This patch unifies the netutils functions dealing with IP addresses tothree classes:- IPAddress: Common IP address functionality- IPv4Address: IPv4 specific functionality- IPv6address: IPv6-specific functionality
Furthermore it adds methods to check whether an address is a loopback...
Fix bug in bdev when drbd version format is x.x.x.x
This patch fixes a bug reported in [0]. Newer drbd versions can haveanother digit beyond the regular major, minor and point release digits.We modify the regex used to match that with an optional parts which is...
Introduce lib/netutils.py
This patch moves network utility functions to a dedicated module.
Signed-off-by: Manuel Franceschini <livewire@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
BaseDRBD: provide a way to query usermode_helper parameter
Signed-off-by: Luca Bigliardi <shammash@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
DRBD IPv6 support
Support IPv6 configuration for 'drbdsetup show' parser and add unittestsconcerning that case. Renames some data files to use consistent namesclarifying their usage.
Signed-off-by: Manuel Franceschini <livewire@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Remove pred from compat.any/all
This makes it compatible with the python builtin, and we can even usethe builtin when running under the right version of python. The all andany functions are renamed to _all and _any, so that they can be tested,and (non)existing unittests are updated (translation: there are no unit...
Fix warnings with Python 2.6
'format' is a new built-in function, and 'bytes' is a new builtin type.We rename this to make pylint happy (and remove potential bugs).
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Add separate module for backported language functionality
utils.py, where they were before, is already huge.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Write grow support for file storage
Signed-off-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Remove race condition in FileStorage.Create
Rather than checking that the file doesn't exist, and then creating it,we create it with O_CREAT | O_EXCL, making sure the checking/creation isatomic.
Signed-off-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Clarify the error message for ':' in PV names
As described in issue 93, just saying ':' is not a valid char can beconfusing.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Add strict name validation for the LVM backend
Currently we don't enforce name validation for the LVM backend, on theidea that LVM itself will reject invalid names and we catch thoseerrors.
However, recent LVM documents the accepted VG/LV name space, so it's...
Implement disabling of file-based storage
Rationale: the file-based storage backend can add/remove files under acertain directory. However, the master node is also controlling thesetting of the file-based root directory, so basically it means we can'tprevent arbitrary modifications by the master of the node's filesystem....
Unify a few re.compile calls in DRBD
These are both cleanups and, in the case of _MassageProcData, switchingfrom a weaker RE to a stronger one (we now need cs: in the line,previosuly any line starting with \d+: was accepted).
Signed-off-by: Iustin Pop <iustin@google.com>...
Merge branch 'devel-2.0' into devel-2.1
Conflicts: lib/backend.py - trivial merge...
Add a crude disable for DRBD barriers
Ideally we want to/will have per-device DRBD controls of disk/metadataflushes. In the meantime, we want at least a disable of the barrierfunctionality for cases where one has battery-backed caches.
Background: DRBD has four mechanism of handling ordered disk-writes....
Ensure all int/float conversions are handled right
int()/float() can raise either ValueError (in case of int("a")), orTypeError (in case of int(None)). We had many bugs over time due tothis, and a recent one was just diagnosed, so we go over the codebase...
bdev: Add a TODO and a pylint silence
A piece of old code in bdev.py uses a for loop over a single variablebecause we can 'break' out of the loop or exit on the 'else' path. Thisis not a nice usage of the for loop, it should be converted to astandard if...elif...else structure....
Add some stubs to bdev.FileStorage
This patch adds explicit errors (instead of notimplemented) inFileStorage (and the associated TODOs).
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Olivier Tharan <olive@google.com>
Remove many 'Unused variable' warnings
Note there are some cases left which need extra cleanup.
Add targetted pylint disables
This patch adds targeted pylint disables, where it makes sense (eitherdue to limitations in pylint or due to historical usage), and also a fewblanket ones in rapi where all the names are… “different”.
DRBD: ignore unreadable meta devices
The DRBD driver can ignore dead disks but not dead meta devices (forwhich it refuses to configure the minor). To handle this case, we checkthat the meta device is readable and if not we ignore it (the same aswhen backend._RecursiveAssembleBD didn't find it)....
Another round of pylint-related style fixes
A newer version of pylint, more warnings…
Throw specific error when ':' exists in PV names
While ':' is not actually a supporte character in PV names (it has aspecial meaning for commands like lvcreate), we should throw specificerrors for this case instead of generic “Can't create LV”.
This patch does two things:...
Change bdev.LogicalVolume.GetPVInfo usage
We will need to enumerate selectively the PVs of (possible) many VGs andnot only the allocatable ones. For this we make the VG selection and theallocatable filtering optional. The two callers are modified for this...
bdev: Convert to utils.Retry
Also replaces a hardcoded limit of 15 seconds with 1/4of NET_RECONFIG_TIMEOUT.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Merge remote branch 'origin/master' into mogu
Merge commit 'origin/next'
Use ReadFile/WriteFile in more places
This survived QA, burnin and unittests.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Luca Bigliardi <shammash@google.com>
Fix /proc/drbd parsing in presence of gaps
In case there are gaps in /proc/drbd related to the minors sequence,this can lead to empty lines (see the attached data file). In this case,we currently fail to parse the file correctly.
The patch fixes this by skipping empty lines in...
Merge commit 'origin/next' into branch-2.1
Merge branch 'master' into next
Convert ldisk_degraded to tri-state value
This allows us to report “uncertain” states (LDS_UNKNOWN) for caseswhere the code can't easily detect or report what's wrong with ablock device.
Use object for blockdev_find RPC call result
This patch changes the return type for backend.BlockdevFind to an object(objects.BlockDevStatus). Before a tuple was used. Adding more values tothis tuple causes a lot of work. Converting the result to an object with...
bdev: Add function for reading actual disk size
This patch adds a GetActualSize for block devices that returns theactual disk size. It is done using blockdev (and stat for file storage).
While this could be done via reading /sys/block/N/size, that is not as...
bdev: allow ignoring of size in Assemble()
This patch changes the DRBD8 class (the only one to use the size inAssemble) to ignore the size in Assemble when a zero size is passed.This will allow activation of disks even when the size recorded in theconfiguration is wrong....
Use full-stripe size in LVM growth
LVM has issues when growing stripped volumes, so it's best to specifythe growth in exact multiples of the full stripe size (as precise aspossible). For this we need to do a couple of changes: - in LVM Attach(), we query additionally the VG extent size and the LV...
Fix some typos
Increase maximum accepted size for a DRBD meta dev
With the change to stripped LVs, the actual size of a meta device (whichis small) can be more than we expected (for non-stripped LVs). Thispatch increases from 160MB to 1GB the accepted size, and updates the...
Enable stripped LVs
This patch enables stripped LVs, falling back to non-stripped if thestripped creation fails. If the configure-time lvm-stripecount is 1,this patch becomes a noop (with an insignificant python-level overhead,but no extra lvm calls)....
Add more constants for DRBD and change sync tests
This patch adds constants for the connection status, peer roles and diskstatus, and it changes the rules for when the disk is considered as“resyncing” - previously it was only for syncsource/synctarget, but...
Assemble DRBD using the known size
This patch changes DRBD disk attachment to force the wanted size, as opposed toletting the device auto-discover its size.
This should make the disks more resilient with regard to small differences insize (e.g. due to LVM rounding). This still works with regard to disk...
Change the bdev init signatures
This patch changes all the bdev.BlockDev constructors to take anadditional ‘size’ parameter, all the backend functions that call thosefunctions to pass it and also changes backend.BlocdevCreate() to not usethe size passed via the rpc call but instead directly disk.size (this is...
Fix compatibility with DRBD 8.2
This patch adds (and suppresses) the extra ipv4/ipv6 words before theactual address that newer DRBD versions add.
[iustin@google.com: slightly changed the patch to conform to styleguide, and changed the commit message]Signed-off-by: Iustin Pop <iustin@google.com>...
Fix compatibility with DRBD 8.3
DRBD 8.3 changes two more things compared to 8.2: - /proc/drbd format changed in multiple ways; the part we're interested is the ‘st:’ to ‘ro:‘ change (in the changelog named as “Renamed 'state' to 'role'” - “drbdsetup /dev/drbdN show” changed the ‘device’ stanza from:...
Convert IOErrors for /proc/drbd into our errors
If /proc/drbd can't be opened, this raises an IOError, but all theerror-handling behaviour in backend treats only BlockDeviceErrors. Thiscreates a plain failure in cluster verify and in other RPC calls.
This patch simply converts EnvironmentErrors into BlockDeviceErrors, and...
FileStorage: abort creating over an existing file
In FileStorage there is a TODO: decide whether we should check for existing files and abort or notAfter Ganeti ate my instance data I decided. Let's abort.In general there is no reason we should overwrite existing files, and...
Some error message cleanups
Reviewed-by: imsnah
Cleanup of DRBD8._CheckMetaSize
This patch converts the _CheckMetaSize method to raise exceptionsinstead of logging and returning False. This fits now in the new rpcreturn types, so it's a cheap change.
Reviewed-by: ultrotter
Change the disk assembly to raise exceptions
This big patch converts the bdev Assemble() methods and the supportingfunctions to raise exceptions instead of returning False. This is a bigpatch, since the assembly functions touch other functions: add children,...
Change BlockDev.Remove() failure result
Currently, the Remove() methods of block devices return True/False.This doesn't permit any error detail reporting.
This patch changes the return type to None for success, and raisesBlockDeviceError in case of failure. This permits the details to be...
Change BlockDev.Shutdown() failure result
Currently, the Shutdown() methods of block devices return True/False.This doesn't permit any error detail reporting.
bdev: add and use two utility functions
This patch adds two utility functions for raising BlockDeviceErrorexceptions and for running functions while ignoring this error. Most ofthe manual “raise errors.BlockDeviceError” cases are converted to_ThrowError, as this makes the code clearer....
Remove checking of DRBD metadata for validity
Currently the DRBD code checks that the metadata devices are validbefore creation, initial disk attachment and add children.
However, the process for checking validity requires a free DRBD minor,and this conflict with parallel checking....
Make cluster-verify check the drbd minors space
This patch adds support for verification of drbd minors space in clusterverify: minors which belong to running instances and should be onlinebut are not, and minors which do not belong to any instace but are in...
DRBD: check for in-use minor during Create
In order to prevent errors with old, in-use DRBD minors, we check andabort at create time if our minor is already in use. For this we need toalso modify DRBD8Status to be able to parse cs:Unconfigured devices....
Block device creation cleanup
Currently when creation LVM-based instances, we always get theextremely-confusing message "ERROR Can't find LV /dev/xenvg/..." whichis actually expected. This behaviour was introduced before we hadUUID-style LV names, since at that point it was not a unexpected to have...
Forward-port DrbdNetReconfig
This is a modified forward-port of DrbdNetReconfig and their associatedRPCs. In Ganeti 2.0, these functions will be used for two things: - live migration (as in 1.2) - and for other network reconfiguration tasks, since DRBD8.Attach()...
backend: rename AttachOrAssemble to Assemble
Since now the Assemble function is different than Attach, we rename thisbackend function to show that the intent is to fully assemble the device(and it's always allowed to modify the device).
drbd: change the semantics of Attach vs. Assemble
Currently, both the Attach and Assemble methods for DRBD8 devices will use andalter the device state. This is suboptimal, and it has been workedaround in 1.2 via a special cache in the node daemon so that we don't...
bdev: Do not call Assemble() on children
The caller of dev.Assemble() (backend._RecursiveAssembleBD) is doing anexplicit recursion over all the children of the device, with bettererror reporting. As such, we don't need this repeated assembly insidethe base BlockDev class....
Work around a DRBD sync speed race condition
This is modified forward-port of commit 1544 on the 1.2 branch:
When DRBD is doing its dance to establish a connection with its peer, it also sends the synchronization speed over the wire. In some cases setting the sync speed only after setting up both...
bdev: forward-port ReAttachNet/DisconnectNet
This is plain copy of the 1.2 ReAttachNet and DisconnectNet methods onthe DRBD8 device, with the logger to logging module changes and theReAttachNet method renamed to AttachNet.
These methods are not used anywhere right now, but will be used for...
Fix epydoc format warnings
This patch should fix all outstanding epydoc parsing errors; as such, weswitch epydoc into verbose mode so that any new errors will be visible.
Fix file-based block devices
We changed a while ago the protocol for opening block devices, butFileStorage was not changed. This patch makes it work again.
Move a hardcoded constant to constants.py
For now we only use the ‘C’ protocol so we can put it in constants.pyinstead of hardcoding it.
Enable the use of shared secrets
This patch enables the use of the shared secrets for DRBD8 disks, using(hardcoded in constants.py) the md5 digest algorithm.
For making this more flexible, either we implement a cluster parameter(once the new model is in place), or we can make it ./configure-time...
Extend DRBD disks with shared secret attribute
This patch, which is similar to r1679 (Extend DRBD disks with minorsattribute), extends the logical and physical id of the DRBD disks with ashared secret attribute. This is generated at disk creation time and...
Switch to static minors for DRBD
With some todos remaining, this patch switches the DRBD devices to usethe passed minors, and the cmdlib code (add instance and replace disks)to request and assign minors to the DRBD disks.
Todos: - look at the disk RPC calls to see which can be optimized away, since...
Extend DRBD disks with minors attribute
This patch converts the DRBD disks to contain also a minor (per eachnode) attribute. This minor is not yet used and is always initializedwith None, so the patch does not have any real-world impact - except forautomatically upgrading config files (it adds the minors as None, None)....
Reduce duplicate Attach() calls in bdev
Currently, the 'public' functions of bdev (FindDevice andAttachOrAssemble) will call the Attach() method right after classinstantiation.
But the constructor itself calls this function, and therefore we haveduplicate Attach() calls (which are not cheap at all)....
Convert bdev.py to the logging module
This does not enhance in any way the messages; it just switches to thenew module.
Cleanup LV status computation
Currently, when seeing if a LV is degraded or not (i.e. virtual volume),we first attach to the device (which does an lvdisplay), then do a lvsin order to display the lv_attr. This generates two external commands todo (almost) the same thing....
Rework the DRBD8 device status computation
Currently, compute the status of a drbd8 device in GetSyncStatus andreturn only the values that we need (and fit in the framework ofGetSyncStatus). However, the full status details are useful (and needed)in other places, so the patch attempts to improve this situation....
bdev: implement disk resize for lvm/drbd8
This patch implements disk resize at the bdev level for the LVM andDRBD8 disk types. It is not implemented for DRBD7 and MD since the wayMD works with its underlaying devices makes it harder and thiscombination is also deprecated....
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.
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....
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....
Improve DRBD8.Open's docstring a bit more
Reviewed-by: iustinp
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...
Fix two pylint uninitialized variable errors
Add FileStorage class
This is the representation of file VBDs on the backend. It's the firstimplementation an supports only raw files.
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.
Fixes small spell mistakes and comments
Parse double protocol version in drbd8.2
DRBD 8.2 uses a double integer field ad protocol version, rather than a singleone. This patch fixes the ganeti parsing code, allowing both the old and thenew version type. In order to do so the internal _GetVersion function is...
Reduce the chance of DRBD errors with stale primaries
This patch is a first step in reducing the chance of causing DRBDactivation failures when the primary node has not-perfect data.
This issue is more seen with DRBD8, which has an 'outdate' state (inwhich it can get more often). But it can (and before this patch, usually...
Activate logical volumes at Assemble() time
This patch changes the Assemble() method for logical volumes from a noopto do a `lvchange -ay` on the logical volume; this ensures that if thelogical volume is not active, we are able to activate and use it....
Improve speed of activating block devs
This patch fixes the double attach operation in bdev.AttachOrAssemble,which was an indentation mistake in the first place.
Add unittest for DRBD8 drdbsetup show parser
This patch changes the bdev.DRBD8._GetDevInfo to take a string insteadof a minor, separates the `drbdsetup show` invocation into a newseparate method (bdev.DRBD8._GetShowData) and modifies the rest of theDRBD8 class to make the appropriate calls....
Fix parsing of drbdsetup show output
This fixes the parsing of integers in the drbdsetup show output withnewer pyparsing versions.
Basically, the convert-to-int action that we use was taken from theexample documentation of an older pyparsing version that automatically...
Drop the Rename method of DRBD8 devices
Since we now do changes of remote peers in two steps (Attach with nonetwork information and then Attach with the new peer's data), we don'tneed this operation anymore.
Relax even more the identification of DRBD8 devices
This patch adds a new success condition for identifying DRBD8 devices:if the local device is correct, but the network peer is not, we shutdownthe network and attach to the correct one (this also handles going to...
Add support for DRBD8 devices to work standalone
This patch adds a check in _AssembleNet so that if we are passed Nonevalue in the unique_id, we instead switch to standalone mode.