new AccessMode(AccessMode.OP, AccessMode.NORMAL),
new AccessMode(AccessMode.OP, AccessMode.NORMAL))
.visiblePredicate(new VisiblePredicate() {
@Override
public boolean check() {
final BlockDevice bd;
if (getBlockDevice().isDrbd()) {
if (!getBlockDevice().isPrimary()) {
return false;
}
bd = getBlockDevice().getDrbdBlockDevice();
if (bd == null) {
return false;
}
} else {
bd = getBlockDevice();
}
return bd.isVolumeGroupOnPhysicalVolume();
}
})
.enablePredicate(new EnablePredicate() {
@Override
public String check() {
final String vg;
final BlockDevice bd = getBlockDevice();
final BlockDevice drbdBD = bd.getDrbdBlockDevice();
if (drbdBD == null) {
vg = bd.getVgOnPhysicalVolume();
} else {
vg = drbdBD.getVgOnPhysicalVolume();
}
if (getHost().getLogicalVolumesFromVolumeGroup(vg) != null) {
return "has LV on it";
}
return null;