Package com.cloud.agent.api

Examples of com.cloud.agent.api.StartupStorageCommand


            }
        } catch (Throwable e) {
            s_logger.warn("Check for master failed, failing the FULL Cluster sync command");
        }

        StartupStorageCommand sscmd = initializeLocalSR(conn);
        if (sscmd != null) {
            return new StartupCommand[] { cmd, sscmd };
        }
        return new StartupCommand[] { cmd };
    }
View Full Code Here


                    }

                    DatastoreSummary dsSummary = dsMo.getSummary();
                    String address = hostMo.getHostName();
                    StoragePoolInfo pInfo = new StoragePoolInfo(poolUuid, address, dsMo.getMor().get_value(), "", StoragePoolType.LVM, dsSummary.getCapacity(), dsSummary.getFreeSpace());
                    StartupStorageCommand cmd = new StartupStorageCommand();
                    cmd.setName(poolUuid);
                    cmd.setPoolInfo(pInfo);
                    cmd.setGuid(poolUuid); // give storage host the same UUID as the local storage pool itself
                    cmd.setResourceType(Storage.StorageResourceType.STORAGE_POOL);
                    cmd.setDataCenter(_dcId);
                    cmd.setPod(_pod);
                    cmd.setCluster(_cluster);

                    s_logger.info("Add local storage startup command: " + _gson.toJson(cmd));
                    storageCmds.add(cmd);
                }
View Full Code Here

                    String name = "Cloud Stack Local LVM Storage Pool for " + _host.uuid;
                    lvmsr.setNameDescription(conn, name);
                    Host host = Host.getByUuid(conn, _host.uuid);
                    String address = host.getAddress(conn);
                    StoragePoolInfo pInfo = new StoragePoolInfo(lvmuuid, address, SRType.LVM.toString(), SRType.LVM.toString(), StoragePoolType.LVM, cap, avail);
                    StartupStorageCommand cmd = new StartupStorageCommand();
                    cmd.setPoolInfo(pInfo);
                    cmd.setGuid(_host.uuid);
                    cmd.setDataCenter(Long.toString(_dcId));
                    cmd.setResourceType(Storage.StorageResourceType.STORAGE_POOL);
                    return cmd;
                }
            } catch (XenAPIException e) {
                String msg = "build local LVM info err in host:" + _host.uuid + e.toString();
                s_logger.warn(msg);
            } catch (XmlRpcException e) {
                String msg = "build local LVM info err in host:" + _host.uuid + e.getMessage();
                s_logger.warn(msg);
            }
        }

        SR extsr = getLocalEXTSR(conn);
        if (extsr != null) {
            try {
                String extuuid = extsr.getUuid(conn);
                _host.localSRuuid = extuuid;
                long cap = extsr.getPhysicalSize(conn);
                if (cap > 0) {
                    long avail = cap - extsr.getPhysicalUtilisation(conn);
                    extsr.setNameLabel(conn, extuuid);
                    String name = "Cloud Stack Local EXT Storage Pool for " + _host.uuid;
                    extsr.setNameDescription(conn, name);
                    Host host = Host.getByUuid(conn, _host.uuid);
                    String address = host.getAddress(conn);
                    StoragePoolInfo pInfo = new StoragePoolInfo(extuuid, address, SRType.EXT.toString(), SRType.EXT.toString(), StoragePoolType.EXT, cap, avail);
                    StartupStorageCommand cmd = new StartupStorageCommand();
                    cmd.setPoolInfo(pInfo);
                    cmd.setGuid(_host.uuid);
                    cmd.setDataCenter(Long.toString(_dcId));
                    cmd.setResourceType(Storage.StorageResourceType.STORAGE_POOL);
                    return cmd;
                }
            } catch (XenAPIException e) {
                String msg = "build local EXT info err in host:" + _host.uuid + e.toString();
                s_logger.warn(msg);
View Full Code Here

                RouterPrivateIpStrategy.HostLocal, changes);
        fillNetworkInformation(cmd);
        cmd.getHostDetails().putAll(getVersionStrings());
        cmd.setCluster(getConfiguredProperty("cluster", "1"));
        StoragePoolInfo pi = initializeLocalStorage();
        StartupStorageCommand sscmd = new StartupStorageCommand();
        sscmd.setPoolInfo(pi);
        sscmd.setGuid(pi.getUuid());
        sscmd.setDataCenter((String) _params.get("zone"));
        sscmd.setResourceType(Storage.StorageResourceType.STORAGE_POOL);

        return new StartupCommand[] { cmd, sscmd };
    }
View Full Code Here

    }

    @Override
    public void processConnect(HostVO agent, StartupCommand cmd, boolean forRebalance) {
        if ((cmd instanceof StartupStorageCommand) ) {
            StartupStorageCommand scmd = (StartupStorageCommand)cmd;
            if (scmd.getResourceType() ==  Storage.StorageResourceType.SECONDARY_STORAGE ) {
                _ssVmMgr.generateSetupCommand(agent.getId());
                return;
            }
        } else if (cmd instanceof StartupSecondaryStorageCommand) {
            if(s_logger.isInfoEnabled()) {
View Full Code Here

          return;
      }
    
      long agentId = agent.getId();
     
      StartupStorageCommand storage = (StartupStorageCommand)cmd;
      if (storage.getResourceType() == Storage.StorageResourceType.STORAGE_HOST ||
      storage.getResourceType() == Storage.StorageResourceType.SECONDARY_STORAGE )
      {
        uploadMonitor.handleUploadSync(agentId);
      }
  }
View Full Code Here

        return Host.Type.SecondaryStorage;
  }

  @Override
  public StartupCommand[] initialize() {
        final StartupStorageCommand cmd = new StartupStorageCommand("dummy",
          StoragePoolType.NetworkFilesystem, 1024*1024*1024*100L,
          new HashMap<String, TemplateInfo>());
       
        cmd.setResourceType(Storage.StorageResourceType.SECONDARY_STORAGE);
        cmd.setIqn(null);
        cmd.setNfsShare(_guid);
       
        fillNetworkInformation(cmd);
        cmd.setDataCenter(_dc);
        cmd.setPod(_pod);
        cmd.setGuid(_guid);
       
        cmd.setName(_guid);
        cmd.setVersion(DummySecondaryStorageResource.class.getPackage().getImplementationVersion());
        /* gather TemplateInfo in second storage */
        cmd.setTemplateInfo(getDefaultSystemVmTemplateInfo());
        cmd.getHostDetails().put("mount.parent", "dummy");
        cmd.getHostDetails().put("mount.path", "dummy");
        cmd.getHostDetails().put("orig.url", _guid);
       
        String tok[] = _dummyPath.split(":");
        cmd.setPrivateIpAddress(tok[0]);
        return new StartupCommand [] {cmd};
  }
View Full Code Here

    if (!(firstCmd instanceof StartupStorageCommand)) {
      return null;
    }

    com.cloud.host.Host.Type type = null;
    StartupStorageCommand ssCmd = ((StartupStorageCommand) firstCmd);
    if (ssCmd.getHostType() == Host.Type.SecondaryStorageCmdExecutor) {
      type = ssCmd.getHostType();
    } else {
      if (ssCmd.getResourceType() == Storage.StorageResourceType.SECONDARY_STORAGE) {
        type = Host.Type.SecondaryStorage;
        if (resource != null && resource instanceof DummySecondaryStorageResource) {
          host.setResource(null);
        }
      } else if (ssCmd.getResourceType() == Storage.StorageResourceType.LOCAL_SECONDARY_STORAGE) {
        type = Host.Type.LocalSecondaryStorage;
      } else {
        type = Host.Type.Storage;
      }

      final Map<String, String> hostDetails = ssCmd.getHostDetails();
      if (hostDetails != null) {
        if (details != null) {
          details.putAll(hostDetails);
        } else {
          details = hostDetails;
        }
      }

      host.setDetails(details);
      host.setParent(ssCmd.getParent());
      host.setTotalSize(ssCmd.getTotalSize());
      host.setHypervisorType(HypervisorType.None);
      host.setType(type);
      if (ssCmd.getNfsShare() != null) {
        host.setStorageUrl(ssCmd.getNfsShare());
      }
    }
   
    return host;
    }
View Full Code Here

  @Override
  public void processConnect(HostVO agent, StartupCommand cmd, boolean forRebalance) throws ConnectionException {
      if (cmd instanceof StartupRoutingCommand) {
          downloadMonitor.handleSysTemplateDownload(agent);
      } else if ( cmd instanceof StartupStorageCommand) {
          StartupStorageCommand storage = (StartupStorageCommand)cmd;
            if( storage.getResourceType() == Storage.StorageResourceType.SECONDARY_STORAGE || 
                    storage.getResourceType() == Storage.StorageResourceType.LOCAL_SECONDARY_STORAGE  ) {
                downloadMonitor.addSystemVMTemplatesToHost(agent, storage.getTemplateInfo());
                downloadMonitor.handleTemplateSync(agent);
                downloadMonitor.handleVolumeSync(agent);
            }
      } else if ( cmd instanceof StartupSecondaryStorageCommand ) {       
          downloadMonitor.handleSync(agent.getDataCenterId());
View Full Code Here

                        answer = new StartupAnswer(startup, attache.getId(), getPingInterval());
                    } else if (cmd instanceof StartupSecondaryStorageCommand) {
                        final StartupSecondaryStorageCommand startup = (StartupSecondaryStorageCommand) cmd;
                        answer = new StartupAnswer(startup, attache.getId(), getPingInterval());
                    } else if (cmd instanceof StartupStorageCommand) {
                        final StartupStorageCommand startup = (StartupStorageCommand) cmd;
                        answer = new StartupAnswer(startup, attache.getId(), getPingInterval());
                    } else if (cmd instanceof ShutdownCommand) {
                        final ShutdownCommand shutdown = (ShutdownCommand) cmd;
                        final String reason = shutdown.getReason();
                        s_logger.info("Host " + attache.getId() + " has informed us that it is shutting down with reason " + reason + " and detail " + shutdown.getDetail());
View Full Code Here

TOP

Related Classes of com.cloud.agent.api.StartupStorageCommand

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.