Package com.cloud.agent.api.to

Examples of com.cloud.agent.api.to.StorageFilerTO


      _isHeartBeat = false;
    }
  }
 
  protected Answer execute(ModifyStoragePoolCommand cmd) {
    StorageFilerTO pool = cmd.getPool();
    try {
      if (pool.getType() == StoragePoolType.NetworkFilesystem) {
        createNfsSr(pool);
      } else if (pool.getType() == StoragePoolType.OCFS2) {
          createOCFS2Sr(pool);
      } else {
              return new Answer(cmd, false, "The pool type: " + pool.getType().name() + " is not supported.");
          }
     
      setupHeartBeat(pool.getUuid());
      OvmStoragePool.Details d = OvmStoragePool.getDetailsByUuid(_conn, pool.getUuid());
      Map<String, TemplateProp> tInfo = new HashMap<String, TemplateProp>();
      ModifyStoragePoolAnswer answer = new ModifyStoragePoolAnswer(cmd, d.totalSpace, d.freeSpace, tInfo);
      return answer;
    } catch (Exception e) {
      s_logger.debug("ModifyStoragePoolCommand failed", e);
View Full Code Here


      return new PrimaryStorageDownloadAnswer(e.getMessage());
    }
  }
 
  protected CreateAnswer execute(CreateCommand cmd) {
    StorageFilerTO primaryStorage = cmd.getPool();
    DiskProfile disk = cmd.getDiskCharacteristics();
   
    try {
      OvmVolume.Details vol = null;
      if (cmd.getTemplateUrl() != null) {
        vol = OvmVolume.createFromTemplate(_conn, primaryStorage.getUuid(),  cmd.getTemplateUrl());
      } else {
        vol = OvmVolume.createDataDsik(_conn, primaryStorage.getUuid(), Long.toString(disk.getSize()), disk.getType() == Volume.Type.ROOT);
      }
     
      VolumeTO volume = new VolumeTO(cmd.getVolumeId(), disk.getType(),
          primaryStorage.getType(), primaryStorage.getUuid(), primaryStorage.getPath(),
          vol.name, vol.path, vol.size, null);
      return new CreateAnswer(cmd, volume);
    } catch (Exception e) {
      s_logger.debug("CreateCommand failed", e);
      return new CreateAnswer(cmd, e.getMessage());
View Full Code Here

            }
        }
    }
    protected Answer execute(CreateStoragePoolCommand cmd) {
        Connection conn = this.hypervisorResource.getConnection();
        StorageFilerTO pool = cmd.getPool();
        try {
            if (pool.getType() == StoragePoolType.NetworkFilesystem) {
                getNfsSR(conn, pool);
            } else if (pool.getType() == StoragePoolType.IscsiLUN) {
                getIscsiSR(conn, pool);
            } else if (pool.getType() == StoragePoolType.PreSetup) {
            } else {
                return new Answer(cmd, false, "The pool type: " + pool.getType().name() + " is not supported.");
            }
            return new Answer(cmd, true, "success");
        } catch (Exception e) {
            String msg = "Catch Exception " + e.getClass().getName() + ", create StoragePool failed due to " + e.toString() + " on host:" + this.hypervisorResource.getHost().uuid + " pool: " + pool.getHost() + pool.getPath();
            s_logger.warn(msg, e);
            return new Answer(cmd, false, msg);
        }

    }
View Full Code Here

    public CreateVolumeOVACommand(String secUrl, String volPath, String volName, StoragePool pool, int wait) {
        this.secUrl = secUrl;
        this.volPath = volPath;
        this.volName = volName;
        this.pool = new StorageFilerTO(pool);
        setWait(wait);
    }
View Full Code Here

            assertTrue(poolUuid.equals("bed9f83e-cac3-11e1-ac8a-0050568b007e"));
        }

        @Test
        public void testGetPool() {
            StorageFilerTO pool = rv.getPool();

            Long id = pool.getId();
            Long expectedL = 1L;
            assertEquals(expectedL, id);

            String uuid = pool.getUuid();
            assertTrue(uuid.equals("bed9f83e-cac3-11e1-ac8a-0050568b007e"));

            String host = pool.getHost();
            assertTrue(host.equals("hostAddress"));

            String path = pool.getPath();
            assertTrue(path.equals("path"));

            String userInfo = pool.getUserInfo();
            assertTrue(userInfo.equals("userInfo"));

            Integer port = pool.getPort();
            Integer expectedI = 25;
            assertEquals(expectedI, port);

            Storage.StoragePoolType type = pool.getType();
            assertEquals(Storage.StoragePoolType.Filesystem, type);

            String str = pool.toString();
            assertTrue(str.equals("Pool[" + id.toString() + "|" + host + ":" + port.toString() + "|" + path + "]"));
        }
View Full Code Here

    public CopyVolumeCommand(long volumeId, String volumePath, StoragePool pool, String secondaryStorageURL, boolean toSecondaryStorage, int wait,
            boolean executeInSequence) {
        this.volumeId = volumeId;
        this.volumePath = volumePath;
        this.pool = new StorageFilerTO(pool);
        this.secondaryStorageURL = secondaryStorageURL;
        this.toSecondaryStorage = toSecondaryStorage;
        setWait(wait);
        this.executeInSequence = executeInSequence;
    }
View Full Code Here

        this.templateUrl = null;
        this.executeInSequence = executeInSequence;
    }

    public CreateCommand(DiskProfile diskCharacteristics, String templateUrl, StoragePool pool, boolean executeInSequence) {
        this(diskCharacteristics, templateUrl, new StorageFilerTO(pool), executeInSequence);
    }
View Full Code Here

    public CreateCommand(DiskProfile diskCharacteristics, String templateUrl, StoragePool pool, boolean executeInSequence) {
        this(diskCharacteristics, templateUrl, new StorageFilerTO(pool), executeInSequence);
    }

    public CreateCommand(DiskProfile diskCharacteristics, StoragePool pool, boolean executeInSequence) {
        this(diskCharacteristics, new StorageFilerTO(pool), executeInSequence);
        this.executeInSequence = executeInSequence;
    }
View Full Code Here

        try {
            List<Pair<VolumeTO, StorageFilerTO>> volumeToFilerto = new ArrayList<Pair<VolumeTO, StorageFilerTO>>();
            for (Map.Entry<VolumeInfo, DataStore> entry : volumeToPool.entrySet()) {
                VolumeInfo volume = entry.getKey();
                VolumeTO volumeTo = new VolumeTO(volume, storagePoolDao.findById(volume.getPoolId()));
                StorageFilerTO filerTo = new StorageFilerTO((StoragePool)entry.getValue());
                volumeToFilerto.add(new Pair<VolumeTO, StorageFilerTO>(volumeTo, filerTo));
            }

            MigrateWithStorageCommand command = new MigrateWithStorageCommand(to, volumeToFilerto, destHost.getPrivateIpAddress());
            MigrateWithStorageAnswer answer = (MigrateWithStorageAnswer) agentMgr.send(srcHost.getId(), command);
View Full Code Here

    public PrimaryStorageDownloadCommand(String url, StoragePool pool, int wait) {
        super(null, url, null, null);
        this.poolId = pool.getId();
        this.poolUuid = pool.getUuid();
        this.primaryPool = new StorageFilerTO(pool);
        setWait(wait);
    }
View Full Code Here

TOP

Related Classes of com.cloud.agent.api.to.StorageFilerTO

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.