Package com.cloud.agent.api

Examples of com.cloud.agent.api.GetStorageStatsAnswer


    protected Answer execute(GetStorageStatsCommand cmd) {
        if (s_logger.isInfoEnabled()) {
            s_logger.info("Executing GetStorageStatsCommand command: " + _gson.toJson(cmd));
        }
        // FIXME: get the actual storage capacity and storage stats of CSV volume
        return new GetStorageStatsAnswer(cmd, 1024*1024*1024*1024L, 512*1024*1024*1024L);
    }
View Full Code Here


  protected GetStorageStatsAnswer execute(final GetStorageStatsCommand cmd) {
        final long usedSize = getUsedSize();
        final long totalSize = getTotalSize();
        if (usedSize == -1 || totalSize == -1) {
          return new GetStorageStatsAnswer(cmd, "Unable to get storage stats");
        } else {
          return new GetStorageStatsAnswer(cmd, totalSize, usedSize) ;
        }
    }
View Full Code Here

            txn.start();
            if (uuid == null) {
                String secUrl = cmd.getSecUrl();
                MockSecStorageVO secondary = _mockSecStorageDao.findByUrl(secUrl);
                if (secondary == null) {
                    return new GetStorageStatsAnswer(cmd, "Can't find the secondary storage:" + secUrl);
                }
                Long totalUsed = _mockVolumeDao.findTotalStorageId(secondary.getId());
                txn.commit();
                return new GetStorageStatsAnswer(cmd, secondary.getCapacity(), totalUsed);
            } else {
                MockStoragePoolVO pool = _mockStoragePoolDao.findByUuid(uuid);
                if (pool == null) {
                    return new GetStorageStatsAnswer(cmd, "Can't find the pool");
                }
                Long totalUsed = _mockVolumeDao.findTotalStorageId(pool.getId());
                if (totalUsed == null) {
                    totalUsed = 0L;
                }
                txn.commit();
                return new GetStorageStatsAnswer(cmd, pool.getCapacity(), totalUsed);
            }
        } catch (Exception ex) {
            txn.rollback();
            throw new CloudRuntimeException("DBException during storage stats collection for pool " + uuid, ex);
        } finally {
View Full Code Here

  }
 
  protected GetStorageStatsAnswer execute(final GetStorageStatsCommand cmd) {
    try {
      OvmStoragePool.Details d = OvmStoragePool.getDetailsByUuid(_conn, cmd.getStorageId());
      return new GetStorageStatsAnswer(cmd, d.totalSpace, d.usedSpace);
    } catch (Exception e) {
      s_logger.debug("GetStorageStatsCommand on pool " + cmd.getStorageId() + " failed", e);
      return new GetStorageStatsAnswer(cmd, e.getMessage());
    }
  }
View Full Code Here

        return new StartupCommand[] {cmd};
    }

    protected GetStorageStatsAnswer execute(GetStorageStatsCommand cmd) {
        long size = 1024 * 1024 * 1024 * 100L;
        return new GetStorageStatsAnswer(cmd, 0, size);
    }
View Full Code Here

      txn.start();
      if (uuid == null) {
        String secUrl = cmd.getSecUrl();
        MockSecStorageVO secondary = _mockSecStorageDao.findByUrl(secUrl);
        if (secondary == null) {
          return new GetStorageStatsAnswer(cmd, "Can't find the secondary storage:" + secUrl);
        }
        Long totalUsed = _mockVolumeDao.findTotalStorageId(secondary.getId());
        txn.commit();
        return new GetStorageStatsAnswer(cmd, secondary.getCapacity(), totalUsed);
      } else {
        MockStoragePoolVO pool = _mockStoragePoolDao.findByUuid(uuid);
        if (pool == null) {
          return new GetStorageStatsAnswer(cmd, "Can't find the pool");
        }
        Long totalUsed = _mockVolumeDao.findTotalStorageId(pool.getId());
        if (totalUsed == null) {
          totalUsed = 0L;
        }
        txn.commit();
        return new GetStorageStatsAnswer(cmd, pool.getCapacity(), totalUsed);
      }
    } catch (Exception ex) {
      txn.rollback();
      throw new CloudRuntimeException("DBException during storage stats collection for pool " + uuid, ex);
    } finally {
View Full Code Here

    protected GetStorageStatsAnswer execute(final GetStorageStatsCommand cmd) {
        try {
            KVMStoragePool sp = _storagePoolMgr.getStoragePool(
                    cmd.getPooltype(),
                    cmd.getStorageId());
            return new GetStorageStatsAnswer(cmd, sp.getCapacity(),
                    sp.getUsed());
        } catch (CloudRuntimeException e) {
            return new GetStorageStatsAnswer(cmd, e.toString());
        }
    }
View Full Code Here

    protected GetStorageStatsAnswer execute(final GetStorageStatsCommand cmd) {
        try {
            KVMStoragePool sp = _storagePoolMgr.getStoragePool(
                    cmd.getPooltype(),
                    cmd.getStorageId());
            return new GetStorageStatsAnswer(cmd, sp.getCapacity(),
                    sp.getUsed());
        } catch (CloudRuntimeException e) {
            return new GetStorageStatsAnswer(cmd, e.toString());
        }
    }
View Full Code Here

            txn.start();
            if (uuid == null) {
                String secUrl = cmd.getSecUrl();
                MockSecStorageVO secondary = _mockSecStorageDao.findByUrl(secUrl);
                if (secondary == null) {
                    return new GetStorageStatsAnswer(cmd, "Can't find the secondary storage:" + secUrl);
                }
                Long totalUsed = _mockVolumeDao.findTotalStorageId(secondary.getId());
                txn.commit();
                return new GetStorageStatsAnswer(cmd, secondary.getCapacity(), totalUsed);
            } else {
                MockStoragePoolVO pool = _mockStoragePoolDao.findByUuid(uuid);
                if (pool == null) {
                    return new GetStorageStatsAnswer(cmd, "Can't find the pool");
                }
                Long totalUsed = _mockVolumeDao.findTotalStorageId(pool.getId());
                if (totalUsed == null) {
                    totalUsed = 0L;
                }
                txn.commit();
                return new GetStorageStatsAnswer(cmd, pool.getCapacity(), totalUsed);
            }
        } catch (Exception ex) {
            txn.rollback();
            throw new CloudRuntimeException("DBException during storage stats collection for pool " + uuid, ex);
        } finally {
View Full Code Here

                if (summary.getCapacity() <= 0) {
                    s_logger.warn("Something is wrong with vSphere NFS datastore, rebooting ESX(ESXi) host should help");
                }

                return new GetStorageStatsAnswer(cmd, capacity, used);
            } else {
                String msg = "Could not find datastore for GetStorageStatsCommand storageId : " + cmd.getStorageId() + ", localPath: " + cmd.getLocalPath() + ", poolType: " + cmd.getPooltype();

                s_logger.error(msg);
                return new GetStorageStatsAnswer(cmd, msg);
            }
        } catch (Throwable e) {
            if (e instanceof RemoteException) {
                s_logger.warn("Encounter remote exception to vCenter, invalidate VMware session context");
                invalidateServiceContext();
            }

            String msg = "Unable to execute GetStorageStatsCommand(storageId : " + cmd.getStorageId() + ", localPath: " + cmd.getLocalPath() + ", poolType: " + cmd.getPooltype() + ") due to "
                    + VmwareHelper.getExceptionMessage(e);
            s_logger.error(msg, e);
            return new GetStorageStatsAnswer(cmd, msg);
        }
    }
View Full Code Here

TOP

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

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.