Revision 59726e15 lib/utils/__init__.py
b/lib/utils/__init__.py | ||
---|---|---|
48 | 48 |
from ganeti.utils.hash import * |
49 | 49 |
from ganeti.utils.io import * |
50 | 50 |
from ganeti.utils.log import * |
51 |
from ganeti.utils.lvm import * |
|
51 | 52 |
from ganeti.utils.mlock import * |
52 | 53 |
from ganeti.utils.nodesetup import * |
53 | 54 |
from ganeti.utils.process import * |
... | ... | |
488 | 489 |
return True |
489 | 490 |
|
490 | 491 |
|
491 |
def CheckVolumeGroupSize(vglist, vgname, minsize): |
|
492 |
"""Checks if the volume group list is valid. |
|
493 |
|
|
494 |
The function will check if a given volume group is in the list of |
|
495 |
volume groups and has a minimum size. |
|
496 |
|
|
497 |
@type vglist: dict |
|
498 |
@param vglist: dictionary of volume group names and their size |
|
499 |
@type vgname: str |
|
500 |
@param vgname: the volume group we should check |
|
501 |
@type minsize: int |
|
502 |
@param minsize: the minimum size we accept |
|
503 |
@rtype: None or str |
|
504 |
@return: None for success, otherwise the error message |
|
505 |
|
|
506 |
""" |
|
507 |
vgsize = vglist.get(vgname, None) |
|
508 |
if vgsize is None: |
|
509 |
return "volume group '%s' missing" % vgname |
|
510 |
elif vgsize < minsize: |
|
511 |
return ("volume group '%s' too small (%s MiB required, %d MiB found)" % |
|
512 |
(vgname, minsize, vgsize)) |
|
513 |
return None |
|
514 |
|
|
515 |
|
|
516 | 492 |
def SplitTime(value): |
517 | 493 |
"""Splits time as floating point number into a tuple. |
518 | 494 |
|
Also available in: Unified diff