Package com.cloud.agent.api

Examples of com.cloud.agent.api.StartupStorageCommand


       
        if (!(startup instanceof StartupStorageCommand)) {
            return;
        }

        StartupStorageCommand ssCmd = (StartupStorageCommand) startup;
        if (ssCmd.getResourceType() == Storage.StorageResourceType.STORAGE_HOST) {
            CapacityVO capacity = new CapacityVO(server.getId(),
                    server.getDataCenterId(), server.getPodId(), server.getClusterId(), 0L,
                    (long) (server.getTotalSize() * _overProvisioningFactor),
                    CapacityVO.CAPACITY_TYPE_STORAGE_ALLOCATED);
            _capacityDao.persist(capacity);
View Full Code Here


        } catch (ConfigurationException e) {
            s_logger.warn("Caught problem while configuring folers", e);
            return null;
        }*/
       
        final StartupStorageCommand cmd = new StartupStorageCommand(_parent, StoragePoolType.NetworkFilesystem, getTotalSize(), new HashMap<String, TemplateInfo>());
       
        cmd.setResourceType(Storage.StorageResourceType.SECONDARY_STORAGE);
        cmd.setIqn(null);
       
        fillNetworkInformation(cmd);
        cmd.setDataCenter(_dc);
        cmd.setPod(_pod);
        cmd.setGuid(_guid);
        cmd.setName(_guid);
        cmd.setVersion(NfsSecondaryStorageResource.class.getPackage().getImplementationVersion());
        cmd.getHostDetails().put("mount.parent", _mountParent);
        cmd.getHostDetails().put("mount.path", _nfsPath);
        String tok[] = _nfsPath.split(":");
        cmd.setNfsShare("nfs://" + tok[0] + tok[1]);
        if (cmd.getHostDetails().get("orig.url") == null) {
            if (tok.length != 2) {
                throw new CloudRuntimeException("Not valid NFS path" + _nfsPath);
            }
            String nfsUrl = "nfs://" + tok[0] + tok[1];
            cmd.getHostDetails().put("orig.url", nfsUrl);
        }
        InetAddress addr;
        try {
            addr = InetAddress.getByName(tok[0]);
            cmd.setPrivateIpAddress(addr.getHostAddress());
        } catch (UnknownHostException e) {
            cmd.setPrivateIpAddress(tok[0]);
        }
        return new StartupCommand [] {cmd};
    }
View Full Code Here

    public void processConnect(HostVO host, StartupCommand cmd, boolean forRebalance) throws ConnectionException {
        if (!(cmd instanceof StartupStorageCommand)) {
            return;
        }
       
        StartupStorageCommand ssCmd = (StartupStorageCommand)cmd;
       
        if (ssCmd.getResourceType() != Storage.StorageResourceType.STORAGE_POOL) {
            return;
        }
       
        StoragePoolInfo pInfo = ssCmd.getPoolInfo();
        if (pInfo == null) {
            return;
        }

        DataCenterVO dc = _dcDao.findById(host.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 " +
View Full Code Here

                RouterPrivateIpStrategy.HostLocal, changes, null);
        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

        cmd.setAgentTag("agent-simulator");
        cmd.setDataCenter(String.valueOf(agentHost.getDataCenterId()));
        cmd.setPod(String.valueOf(agentHost.getPodId()));
        cmd.setCluster(String.valueOf(agentHost.getClusterId()));

        StartupStorageCommand ssCmd = initializeLocalSR();
     
        return new StartupCommand[] { cmd, ssCmd };
    }
View Full Code Here

    private StartupStorageCommand initializeLocalSR() {
        Map<String, TemplateInfo> tInfo = new HashMap<String, TemplateInfo>();
     
        StoragePoolInfo poolInfo = _simMgr.getLocalStorage(hostGuid);

        StartupStorageCommand cmd = new StartupStorageCommand(poolInfo.getHostPath(), poolInfo.getPoolType(), poolInfo.getCapacityBytes(), tInfo);

        cmd.setPoolInfo(poolInfo);
        cmd.setGuid(agentHost.getGuid());
        cmd.setResourceType(StorageResourceType.STORAGE_POOL);
        return 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

            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

        if (!(startup instanceof StartupStorageCommand)) {
            return;
        }

        StartupStorageCommand ssCmd = (StartupStorageCommand)startup;
        if (ssCmd.getResourceType() == Storage.StorageResourceType.STORAGE_HOST) {
            BigDecimal overProvFactor = BigDecimal.valueOf(CapacityManager.StorageOverprovisioningFactor.value());
            CapacityVO capacity =
                new CapacityVO(server.getId(), server.getDataCenterId(), server.getPodId(), server.getClusterId(), 0L, (overProvFactor.multiply(new BigDecimal(
                    server.getTotalSize()))).longValue(), Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED);
            _capacityDao.persist(capacity);
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.