1. remove plugin check Sr, heartbeat does that

2. if pbd.plug fails, moves on, and report warnning
This commit is contained in:
anthony 2010-10-22 12:10:03 -07:00
parent 4a96e1f633
commit 9896043205

View File

@ -372,12 +372,8 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
try {
if (pbdr.host.getUuid(conn).equals(_host.uuid)) {
if (!currentlyAttached(sr.getKey(), rec, pbd, pbdr)) {
pbd.unplug(conn);
pbd.destroy(conn);
cleanSR(sr.getKey(), rec);
} else if (!pbdr.currentlyAttached) {
pbd.plug(conn);
if (!pbdr.currentlyAttached) {
pbdPlug(conn, pbd);
}
}
@ -4283,6 +4279,21 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
return new GetStorageStatsAnswer(cmd, msg);
}
}
private void pbdPlug(Connection conn, PBD pbd) {
String pbdUuid = "";
String hostAddr = "";
try {
pbdUuid = pbd.getUuid(conn);
hostAddr = pbd.getHost(conn).getAddress(conn);
pbd.plug(conn);
} catch (Exception e) {
String msg = "PBD " + pbdUuid + " is not attached! and PBD plug failed due to "
+ e.toString() + ". Please check this PBD in host : " + hostAddr;
s_logger.warn(msg, e);
}
}
protected boolean checkSR(SR sr) {
@ -4304,15 +4315,8 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
for (PBD pbd : pbds) {
if (host.equals(pbd.getHost(conn))) {
PBD.Record pbdr = pbd.getRecord(conn);
if (currentlyAttached(sr, srr, pbd, pbdr)) {
if (!pbdr.currentlyAttached) {
pbd.plug(conn);
}
} else {
if (pbdr.currentlyAttached) {
pbd.unplug(conn);
}
pbd.plug(conn);
if (!pbdr.currentlyAttached) {
pbdPlug(conn, pbd);
}
pbds.remove(pbd);
found = true;
@ -4324,20 +4328,20 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
pbdr.host = host;
pbdr.uuid = "";
PBD pbd = PBD.create(conn, pbdr);
pbd.plug(conn);
pbdPlug(conn, pbd);
}
}
} else {
for (PBD pbd : pbds) {
PBD.Record pbdr = pbd.getRecord(conn);
if (!pbdr.currentlyAttached) {
pbd.plug(conn);
pbdPlug(conn, pbd);
}
}
}
} catch (Exception e) {
String msg = "checkSR failed host:" + _host.uuid;
String msg = "checkSR failed host:" + _host.uuid + " due to " + e.toString();
s_logger.warn(msg);
return false;
}