Package com.cloud.agent.api

Examples of com.cloud.agent.api.GetStorageStatsCommand


                for (DataStore store : stores) {
                    if ( store.getUri() == null ) {
                        continue;
                    }

                    GetStorageStatsCommand command = new GetStorageStatsCommand(store.getTO());
                    EndPoint ssAhost = _epSelector.select(store);
                    if (ssAhost == null) {
                        s_logger.debug("There is no secondary storage VM for secondary storage host " + store.getName());
                        continue;
                    }
                    long storeId = store.getId();
                    Answer answer = ssAhost.sendMessage(command);
                    if (answer != null && answer.getResult()) {
                        storageStats.put(storeId, (StorageStats)answer);
                        s_logger.trace("HostId: "+storeId+ " Used: " + ((StorageStats)answer).getByteUsed() + " Total Available: " + ((StorageStats)answer).getCapacityBytes());
                    }
                }
                _storageStats = storageStats;
        ConcurrentHashMap<Long, StorageStats> storagePoolStats = new ConcurrentHashMap<Long, StorageStats>();

        List<StoragePoolVO> storagePools = _storagePoolDao.listAll();
        for (StoragePoolVO pool: storagePools) {
          // check if the pool has enabled hosts
          List<Long> hostIds = _storageManager.getUpHostsInPool(pool.getId());
          if (hostIds == null || hostIds.isEmpty()) continue;
          GetStorageStatsCommand command = new GetStorageStatsCommand(pool.getUuid(), pool.getPoolType(), pool.getPath());
          long poolId = pool.getId();
          try {
              Answer answer = _storageManager.sendToPool(pool, command);
              if (answer != null && answer.getResult()) {
                storagePoolStats.put(pool.getId(), (StorageStats)answer);
View Full Code Here


        String sample =
            "{\"id\":\"" + s_testLocalStoreUUID + "\",\"localPath\":" + s_testLocalStorePathJSON + "," + "\"pooltype\":\"Filesystem\"," + "\"contextMap\":{},\"wait\":0}";

        s_logger.info("Sample JSON: " + sample);

        GetStorageStatsCommand cmd = s_gson.fromJson(sample, GetStorageStatsCommand.class);
        s_hypervresource.executeRequest(cmd);
        GetStorageStatsAnswer ans = (GetStorageStatsAnswer)s_hypervresource.executeRequest(cmd);
        Assert.assertTrue(ans.getDetails(), ans.getResult());
        Assert.assertTrue(ans.getByteUsed() != ans.getCapacityBytes());
    }
View Full Code Here

                for (DataStore store : stores) {
                    if ( store.getUri() == null ) {
                        continue;
                    }

                    GetStorageStatsCommand command = new GetStorageStatsCommand(store.getTO());
                    EndPoint ssAhost = _epSelector.select(store);
                    if (ssAhost == null) {
                        s_logger.debug("There is no secondary storage VM for secondary storage host " + store.getName());
                        continue;
                    }
                    long storeId = store.getId();
                    Answer answer = ssAhost.sendMessage(command);
                    if (answer != null && answer.getResult()) {
                        storageStats.put(storeId, (StorageStats)answer);
                        s_logger.trace("HostId: "+storeId+ " Used: " + ((StorageStats)answer).getByteUsed() + " Total Available: " + ((StorageStats)answer).getCapacityBytes());
                    }
                }
                _storageStats = storageStats;
        ConcurrentHashMap<Long, StorageStats> storagePoolStats = new ConcurrentHashMap<Long, StorageStats>();

        List<StoragePoolVO> storagePools = _storagePoolDao.listAll();
        for (StoragePoolVO pool: storagePools) {
          // check if the pool has enabled hosts
          List<Long> hostIds = _storageManager.getUpHostsInPool(pool.getId());
          if (hostIds == null || hostIds.isEmpty()) continue;
          GetStorageStatsCommand command = new GetStorageStatsCommand(pool.getUuid(), pool.getPoolType(), pool.getPath());
          long poolId = pool.getId();
          try {
              Answer answer = _storageManager.sendToPool(pool, command);
              if (answer != null && answer.getResult()) {
                storagePoolStats.put(pool.getId(), (StorageStats)answer);
View Full Code Here

                for (DataStore store : stores) {
                    if (store.getUri() == null) {
                        continue;
                    }

                    GetStorageStatsCommand command = new GetStorageStatsCommand(store.getTO());
                    EndPoint ssAhost = _epSelector.select(store);
                    if (ssAhost == null) {
                        s_logger.debug("There is no secondary storage VM for secondary storage host " + store.getName());
                        continue;
                    }
                    long storeId = store.getId();
                    Answer answer = ssAhost.sendMessage(command);
                    if (answer != null && answer.getResult()) {
                        storageStats.put(storeId, (StorageStats)answer);
                        s_logger.trace("HostId: " + storeId + " Used: " + ((StorageStats)answer).getByteUsed() + " Total Available: " +
                            ((StorageStats)answer).getCapacityBytes());
                    }
                }
                _storageStats = storageStats;
                ConcurrentHashMap<Long, StorageStats> storagePoolStats = new ConcurrentHashMap<Long, StorageStats>();

                List<StoragePoolVO> storagePools = _storagePoolDao.listAll();
                for (StoragePoolVO pool : storagePools) {
                    // check if the pool has enabled hosts
                    List<Long> hostIds = _storageManager.getUpHostsInPool(pool.getId());
                    if (hostIds == null || hostIds.isEmpty())
                        continue;
                    GetStorageStatsCommand command = new GetStorageStatsCommand(pool.getUuid(), pool.getPoolType(), pool.getPath());
                    long poolId = pool.getId();
                    try {
                        Answer answer = _storageManager.sendToPool(pool, command);
                        if (answer != null && answer.getResult()) {
                            storagePoolStats.put(pool.getId(), (StorageStats)answer);
View Full Code Here

                ConcurrentHashMap<Long, StorageStats> storageStats = new ConcurrentHashMap<Long, StorageStats>();
                for (HostVO host : hosts) {
                    if ( host.getStorageUrl() == null ) {
                        continue;
                    }
                    GetStorageStatsCommand command = new GetStorageStatsCommand(host.getStorageUrl());
                    HostVO ssAhost = _ssvmMgr.pickSsvmHost(host);
                    if (ssAhost == null) {
                        s_logger.debug("There is no secondary storage VM for secondary storage host " + host.getName());
                        continue;
                    }
                    long hostId = host.getId();
                    Answer answer = _agentMgr.easySend(ssAhost.getId(), command);
                    if (answer != null && answer.getResult()) {
                        storageStats.put(hostId, (StorageStats)answer);
                        s_logger.trace("HostId: "+hostId+ " Used: " + ((StorageStats)answer).getByteUsed() + " Total Available: " + ((StorageStats)answer).getCapacityBytes());
                        //Seems like we have dynamically updated the sec. storage as prev. size and the current do not match
                        if (_storageStats.get(hostId)!=null &&
                            _storageStats.get(hostId).getCapacityBytes() != ((StorageStats)answer).getCapacityBytes()){
                           host.setTotalSize(((StorageStats)answer).getCapacityBytes());
                           _hostDao.update(hostId, host);
                      }
                    }
                }
                _storageStats = storageStats;
        ConcurrentHashMap<Long, StorageStats> storagePoolStats = new ConcurrentHashMap<Long, StorageStats>();

        List<StoragePoolVO> storagePools = _storagePoolDao.listAll();
        for (StoragePoolVO pool: storagePools) {
          // check if the pool has enabled hosts
          List<Long> hostIds = _storageManager.getUpHostsInPool(pool.getId());
          if (hostIds == null || hostIds.isEmpty()) continue;
          GetStorageStatsCommand command = new GetStorageStatsCommand(pool.getUuid(), pool.getPoolType(), pool.getPath());
          long poolId = pool.getId();
          try {
              Answer answer = _storageManager.sendToPool(pool, command);
              if (answer != null && answer.getResult()) {
                storagePoolStats.put(pool.getId(), (StorageStats)answer);
View Full Code Here

                ConcurrentHashMap<Long, StorageStats> storageStats = new ConcurrentHashMap<Long, StorageStats>();
                for (HostVO host : hosts) {
                    if ( host.getStorageUrl() == null ) {
                        continue;
                    }
                    GetStorageStatsCommand command = new GetStorageStatsCommand(host.getStorageUrl());
                    HostVO ssAhost = _ssvmMgr.pickSsvmHost(host);
                    if (ssAhost == null) {
                        s_logger.debug("There is no secondary storage VM for secondary storage host " + host.getName());
                        continue;
                    }
                    long hostId = host.getId();
                    Answer answer = _agentMgr.easySend(ssAhost.getId(), command);
                    if (answer != null && answer.getResult()) {
                        storageStats.put(hostId, (StorageStats)answer);
                        s_logger.trace("HostId: "+hostId+ " Used: " + ((StorageStats)answer).getByteUsed() + " Total Available: " + ((StorageStats)answer).getCapacityBytes());
                        //Seems like we have dynamically updated the sec. storage as prev. size and the current do not match
                        if (_storageStats.get(hostId)!=null &&
                            _storageStats.get(hostId).getCapacityBytes() != ((StorageStats)answer).getCapacityBytes()){
                           host.setTotalSize(((StorageStats)answer).getCapacityBytes());
                           _hostDao.update(hostId, host);
                      }
                    }
                }
                _storageStats = storageStats;
        ConcurrentHashMap<Long, StorageStats> storagePoolStats = new ConcurrentHashMap<Long, StorageStats>();

        List<StoragePoolVO> storagePools = _storagePoolDao.listAll();
        for (StoragePoolVO pool: storagePools) {
          // check if the pool has enabled hosts
          List<Long> hostIds = _storageManager.getUpHostsInPool(pool.getId());
          if (hostIds == null || hostIds.isEmpty()) continue;
          GetStorageStatsCommand command = new GetStorageStatsCommand(pool.getUuid(), pool.getPoolType(), pool.getPath());
          long poolId = pool.getId();
          try {
              Answer answer = _storageManager.sendToPool(pool, command);
              if (answer != null && answer.getResult()) {
                storagePoolStats.put(pool.getId(), (StorageStats)answer);
View Full Code Here

                        + "\"pooltype\":\"Filesystem\","
                        + "\"contextMap\":{},\"wait\":0}";

        s_logger.info("Sample JSON: " + sample);

        GetStorageStatsCommand cmd =
                s_gson.fromJson(sample, GetStorageStatsCommand.class);
        s_hypervresource.executeRequest(cmd);
        GetStorageStatsAnswer ans =
                (GetStorageStatsAnswer) s_hypervresource.executeRequest(cmd);
        Assert.assertTrue(ans.getDetails(), ans.getResult());
View Full Code Here

                for (DataStore store : stores) {
                    if ( store.getUri() == null ) {
                        continue;
                    }

                    GetStorageStatsCommand command = new GetStorageStatsCommand(store.getTO());
                    EndPoint ssAhost = _epSelector.select(store);
                    if (ssAhost == null) {
                        s_logger.debug("There is no secondary storage VM for secondary storage host " + store.getName());
                        continue;
                    }
                    long storeId = store.getId();
                    Answer answer = ssAhost.sendMessage(command);
                    if (answer != null && answer.getResult()) {
                        storageStats.put(storeId, (StorageStats)answer);
                        s_logger.trace("HostId: "+storeId+ " Used: " + ((StorageStats)answer).getByteUsed() + " Total Available: " + ((StorageStats)answer).getCapacityBytes());
                    }
                }
                _storageStats = storageStats;
        ConcurrentHashMap<Long, StorageStats> storagePoolStats = new ConcurrentHashMap<Long, StorageStats>();

        List<StoragePoolVO> storagePools = _storagePoolDao.listAll();
        for (StoragePoolVO pool: storagePools) {
          // check if the pool has enabled hosts
          List<Long> hostIds = _storageManager.getUpHostsInPool(pool.getId());
          if (hostIds == null || hostIds.isEmpty()) continue;
          GetStorageStatsCommand command = new GetStorageStatsCommand(pool.getUuid(), pool.getPoolType(), pool.getPath());
          long poolId = pool.getId();
          try {
              Answer answer = _storageManager.sendToPool(pool, command);
              if (answer != null && answer.getResult()) {
                storagePoolStats.put(pool.getId(), (StorageStats)answer);
View Full Code Here

TOP

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

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.