devNr = mDev.group(1);
}
/* get blockdevice object from device */
final String disk = getBackingDisk(devNr, hostName);
if (disk != null) {
final BlockDevInfo bdi = drbdGraph.findBlockDevInfo(hostName, disk);
if (bdi != null) {
if (bdi.getBlockDevice().isDifferent(cs, ro1, ds1, flags)) {
bdi.getBlockDevice().setDrbdBackingDisk(disk);
bdi.getBlockDevice().setConnectionState(cs);
bdi.getBlockDevice().setNodeState(ro1);
bdi.getBlockDevice().setDiskState(ds1);
bdi.getBlockDevice().setNodeStateOther(ro2);
bdi.getBlockDevice().setDiskStateOther(ds2);
bdi.getBlockDevice().setDrbdFlags(flags);
bdi.updateInfo();
return true;
} else {
return false;
}
}
}
return false;
}
/* 19 SP 0 16.9 */
p = Pattern.compile("^(\\d+)\\s+SP\\s+(\\S+)\\s(\\d+\\.\\d+).*");
m = p.matcher(output);
if (m.matches()) {
/* String counter = m.group(1); // not used */
final String devNrString = m.group(2);
final String synced = m.group(3);
final Matcher mDev = pDev.matcher(devNrString);
String devNr = devNrString;
if (mDev.matches()) { /* since 8.4 */
devNr = mDev.group(1);
}
final BlockDevInfo bdi = getBlockDevInfo(devNr, hostName, drbdGraph);
if (bdi != null && bdi.getBlockDevice().isDrbd()) {
if (Tools.areEqual(bdi.getBlockDevice().getSyncedProgress(), synced)) {
return false;
} else {
bdi.getBlockDevice().setSyncedProgressInPercents(synced);
bdi.updateInfo();
return true;
}
}
return false;
}
/* 19 UH 1 split-brain */
p = Pattern.compile("^(\\d+)\\s+UH\\s+(\\S+)\\s([a-z-]+).*");
m = p.matcher(output);
if (m.matches()) {
/* String counter = m.group(1); // not used */
final String devNrString = m.group(2);
final String what = m.group(3);
final Matcher mDev = pDev.matcher(devNrString);
String devNr = devNrString;
if (mDev.matches()) { /* since 8.4 */
devNr = mDev.group(1);
}
LOG.debug("parseDrbdEvent: event: " + devNr + " - " + what);
if ("split-brain".equals(what)) {
final BlockDevInfo bdi = getBlockDevInfo(devNr, hostName, drbdGraph);
if (bdi != null && bdi.getBlockDevice().isDrbd()) {
if (bdi.getBlockDevice().isSplitBrain()) {
return false;
} else {
bdi.getBlockDevice().setSplitBrain(true);
bdi.updateInfo();
return true;
}
}
}
return false;