Exemplo n.º 1
0
 @Override
 public void fireEnable(ServiceConfiguration config) throws ServiceRegistrationException {
   if (!config.isVmLocal()) {
     for (Host h : Hosts.list()) {
       if (h.getHostAddresses().contains(config.getInetAddress())) {
         EventRecord.here(
                 EucalyptusBuilder.class, EventType.COMPONENT_SERVICE_ENABLED, config.toString())
             .info();
         return;
       }
     }
     throw Faults.failure(
         config,
         Exceptions.error(
             "There is no host in the system (yet) for the given cloud controller configuration: "
                 + config.getFullName()
                 + ".\nHosts are: "
                 + Hosts.list()));
   } else if (config.isVmLocal() && !Hosts.isCoordinator()) {
     throw Faults.failure(
         config,
         Exceptions.error(
             "This cloud controller "
                 + config.getFullName()
                 + " is not currently the coordinator "
                 + Hosts.list()));
   }
 }
Exemplo n.º 2
0
 @Override
 public void fireCheck(ServiceConfiguration config) throws ServiceRegistrationException {
   Host coordinator = Hosts.getCoordinator();
   if (coordinator == null) {
     throw Faults.failure(
         config,
         Exceptions.error(
             config.getFullName()
                 + ":fireCheck(): failed to lookup coordinator ("
                 + coordinator
                 + ")."));
   } else if (coordinator.isLocalHost()) {
     Check.COORDINATOR.apply(config);
   } else if (!coordinator.isLocalHost()) {
     Check.SECONDARY.apply(config);
   }
 }