Revision 76968973 src/Ganeti/Objects.hs
b/src/Ganeti/Objects.hs | ||
---|---|---|
44 | 44 |
, DiskType(..) |
45 | 45 |
, DiskLogicalId(..) |
46 | 46 |
, Disk(..) |
47 |
, includesLogicalId |
|
47 | 48 |
, DiskTemplate(..) |
48 | 49 |
, PartialBeParams(..) |
49 | 50 |
, FilledBeParams(..) |
... | ... | |
446 | 447 |
instance UuidObject Disk where |
447 | 448 |
uuidOf = diskUuid |
448 | 449 |
|
450 |
-- | Determines whether a disk or one of his children has the given logical id |
|
451 |
-- (determined by the volume group name and by the logical volume name). |
|
452 |
-- This can be true only for DRBD or LVM disks. |
|
453 |
includesLogicalId :: String -> String -> Disk -> Bool |
|
454 |
includesLogicalId vg_name lv_name disk = |
|
455 |
case diskLogicalId disk of |
|
456 |
LIDPlain vg lv -> vg_name == vg && lv_name == lv |
|
457 |
LIDDrbd8 {} -> |
|
458 |
any (includesLogicalId vg_name lv_name) $ diskChildren disk |
|
459 |
_ -> False |
|
460 |
|
|
461 |
|
|
449 | 462 |
-- * Instance definitions |
450 | 463 |
|
451 | 464 |
$(declareSADT "AdminState" |
Also available in: Unified diff