Example #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()));
   }
 }
Example #2
0
 @Override
 public boolean apply(ServiceConfiguration config) {
   if (config.isVmLocal()) {
     if (!Databases.isSynchronized()) {
       throw Faults.failure(
           config,
           Exceptions.error(
               config.getFullName()
                   + ":fireCheck(): eucalyptus service "
                   + config.getFullName()
                   + " is currently synchronizing: "
                   + Hosts.getCoordinator()));
     } else if (Topology.isEnabledLocally(Eucalyptus.class)) {
       throw Faults.failure(
           config,
           Exceptions.error(
               config.getFullName()
                   + ":fireCheck(): eucalyptus service "
                   + config.getFullName()
                   + " cant be enabled when it is not the coordinator: "
                   + Hosts.getCoordinator()));
     } else {
       LOG.debug(
           config.getFullName()
               + ":fireCheck() completed with coordinator currently: "
               + Hosts.getCoordinator());
     }
   }
   return true;
 }
 @Override
 public void fireDisable(final ServiceConfiguration config) {
   if (config.isVmLocal() && noOtherEnabled(config))
     try {
       WorkflowClientManager.stop();
     } catch (Exception e) {
       logger.error("Error stopping workflow client", e);
     }
 }
 @Override
 public void fireEnable(final ServiceConfiguration config) throws ServiceRegistrationException {
   if (config.isVmLocal() && noOtherEnabled(config))
     try {
       WorkflowClientManager.start();
     } catch (Exception e) {
       throw new ServiceRegistrationException("Error creating workflow client", e);
     }
 }
 public static DestroyServiceResponseType destroyService(final DestroyServiceType request)
     throws Exception {
   DestroyServiceResponseType reply = request.getReply();
   for (final ServiceId serviceInfo : request.getServices()) {
     try {
       final ServiceConfiguration service =
           TypeMappers.transform(serviceInfo, ServiceConfiguration.class);
       if (service.isVmLocal()) {
         try {
           Topology.destroy(service).get();
         } catch (final IllegalStateException ex) {
           LOG.error(ex, ex);
         }
       }
       reply.getServices().add(serviceInfo);
     } catch (final Exception ex) {
       LOG.error(ex);
       Logs.extreme().debug(ex, ex);
     }
   }
   return reply;
 }
 public static DisableServiceResponseType disableService(final DisableServiceType request)
     throws Exception {
   final DisableServiceResponseType reply = request.getReply();
   for (final ServiceId serviceInfo : request.getServices()) {
     try {
       final Component comp = Components.lookup(serviceInfo.getType());
       final ServiceConfiguration service =
           TypeMappers.transform(serviceInfo, ServiceConfiguration.class);
       if (service.isVmLocal()) {
         try {
           Topology.disable(service).get();
           reply.getServices().add(serviceInfo);
         } catch (final IllegalStateException ex) {
           LOG.error(ex, ex);
           throw ex;
         }
       }
     } catch (final NoSuchElementException ex) {
       LOG.error(ex, ex);
       throw ex;
     }
   }
   return reply;
 }