@Override
public void run() {
application.isSwingThread();
addServiceMenuItem.removeAll();
final Point2D pos = addServiceMenuItem.getPos();
final CrmXml crmXML = servicesInfo.getBrowser().getCrmXml();
if (crmXML == null) {
return;
}
final ResourceAgent fsService = crmXML.getResourceAgent(
"Filesystem",
ResourceAgent.HEARTBEAT_PROVIDER,
ResourceAgent.OCF_CLASS_NAME);
if (crmXML.isLinbitDrbdResourceAgentPresent()) { /* just skip it, if it is not */
final MyMenuItem ldMenuItem = menuFactory.createMenuItem(
Tools.getString("ClusterBrowser.linbitDrbdMenuName"),
null,
null,
new AccessMode(AccessMode.ADMIN, AccessMode.NORMAL),
new AccessMode(AccessMode.OP, AccessMode.NORMAL))
.addAction(new MenuAction() {
@Override
public void run(final String text) {
servicesInfo.hidePopup();
if (!servicesInfo.getBrowser().linbitDrbdConfirmDialog()) {
return;
}
final FilesystemRaInfo fsi = (FilesystemRaInfo) servicesInfo.addServicePanel(
fsService,
addServiceMenuItem.getPos(),
true,
null,
null,
runMode);
fsi.setDrbddiskIsPreferred(false);
servicesInfo.getBrowser().getCrmGraph().repaint();
}
});
if (servicesInfo.getBrowser().atLeastOneDrbddiskConfigured()
|| !crmXML.isLinbitDrbdResourceAgentPresent()) {
ldMenuItem.setEnabled(false);
}
ldMenuItem.setPos(pos);
addServiceMenuItem.add(ldMenuItem);
}
final ResourceAgent ipService = crmXML.getResourceAgent(
"IPaddr2",
ResourceAgent.HEARTBEAT_PROVIDER,
ResourceAgent.OCF_CLASS_NAME);
if (ipService != null) { /* just skip it, if it is not*/
final MyMenuItem ipMenuItem =
menuFactory.createMenuItem(ipService.getPullDownMenuName(),
null,
null,
new AccessMode(AccessMode.ADMIN, AccessMode.NORMAL),
new AccessMode(AccessMode.OP, AccessMode.NORMAL))
.addAction(new MenuAction() {
@Override
public void run(final String text) {
servicesInfo.hidePopup();
servicesInfo.addServicePanel(ipService,
addServiceMenuItem.getPos(),
true,
null,
null,
runMode);
servicesInfo.getBrowser().getCrmGraph().repaint();
}
});
ipMenuItem.setPos(pos);
addServiceMenuItem.add(ipMenuItem);
}
if (crmXML.isDrbddiskResourceAgentPresent()
&& (servicesInfo.getBrowser().isDrbddiskRAPreferred()
|| servicesInfo.getBrowser().atLeastOneDrbddiskConfigured()
|| !crmXML.isLinbitDrbdResourceAgentPresent())) {
final MyMenuItem ddMenuItem = menuFactory.createMenuItem(
Tools.getString("ClusterBrowser.DrbddiskMenuName"),
null,
null,
new AccessMode(AccessMode.ADMIN, AccessMode.NORMAL),
new AccessMode(AccessMode.OP, AccessMode.NORMAL))
.addAction(new MenuAction() {
@Override
public void run(final String text) {
servicesInfo.hidePopup();
final FilesystemRaInfo fsi = (FilesystemRaInfo) servicesInfo.addServicePanel(
fsService,
addServiceMenuItem.getPos(),
true,
null,
null,
runMode);
fsi.setDrbddiskIsPreferred(true);
servicesInfo.getBrowser().getCrmGraph().repaint();
}
});
if (servicesInfo.getBrowser().isOneLinbitDrbdRaConfigured()
|| !crmXML.isDrbddiskResourceAgentPresent()) {
ddMenuItem.setEnabled(false);
}
ddMenuItem.setPos(pos);
addServiceMenuItem.add(ddMenuItem);
}