Examples of MHostMount


Examples of com.cloud.bridge.model.MHostMount

   
    public void testHosts() {
    Session session;
    SHost shost;
    MHost mhost;
    MHostMount hostMount;

      session = CloudSessionFactory.getInstance().openSession();
      try {
        Transaction txn = session.beginTransaction();
        shost = new SHost();
        shost.setHost("Storage host1");
        shost.setUserOnHost("root");
        shost.setUserPassword("password");
      shost.setExportRoot("/");
        session.save(shost);
       
        mhost = new MHost();
        mhost.setHostKey("1");
        mhost.setHost("management host1");
        mhost.setVersion("v1");
        session.save(mhost);

        hostMount = new MHostMount();
        hostMount.setMhost(mhost);
        hostMount.setShost(shost);
        hostMount.setMountPath("/mnt");
        session.save(hostMount);
        txn.commit();
      } finally {
        session.close();
      }
     
      session = CloudSessionFactory.getInstance().openSession();
      try {
        Transaction txn = session.beginTransaction();
        mhost = (MHost)session.createQuery("from MHost where hostKey=?").
          setLong(0, new Long(1)).uniqueResult();
       
        if(mhost != null) {
          Iterator it = mhost.getMounts().iterator();
          while(it.hasNext()) {
            MHostMount mount = (MHostMount)it.next();
            Assert.assertTrue(mount.getMountPath().equals("/mnt"));
           
            logger.info(mount.getMountPath());
          }
        }
        txn.commit();
      } finally {
        session.close();
View Full Code Here

Examples of com.cloud.bridge.model.MHostMount

   
    public void testHosts() {
    Session session;
    SHost shost;
    MHost mhost;
    MHostMount hostMount;

      session = CloudSessionFactory.getInstance().openSession();
      try {
        Transaction txn = session.beginTransaction();
        shost = new SHost();
        shost.setHost("Storage host1");
        shost.setUserOnHost("root");
        shost.setUserPassword("password");
      shost.setExportRoot("/");
        session.save(shost);
       
        mhost = new MHost();
        mhost.setHostKey("1");
        mhost.setHost("management host1");
        mhost.setVersion("v1");
        session.save(mhost);

        hostMount = new MHostMount();
        hostMount.setMhost(mhost);
        hostMount.setShost(shost);
        hostMount.setMountPath("/mnt");
        session.save(hostMount);
        txn.commit();
      } finally {
        session.close();
      }
     
      session = CloudSessionFactory.getInstance().openSession();
      try {
        Transaction txn = session.beginTransaction();
        mhost = (MHost)session.createQuery("from MHost where hostKey=?").
          setLong(0, new Long(1)).uniqueResult();
       
        if(mhost != null) {
          Iterator it = mhost.getMounts().iterator();
          while(it.hasNext()) {
            MHostMount mount = (MHostMount)it.next();
            Assert.assertTrue(mount.getMountPath().equals("/mnt"));
           
            logger.info(mount.getMountPath());
          }
        }
        txn.commit();
      } finally {
        session.close();
View Full Code Here

Examples of com.cloud.bridge.model.MHostMount

    SHost shost = bucket.getShost();
    if(shost.getHostType() == SHost.STORAGE_HOST_TYPE_LOCAL) {
      return new Tuple<SHost, String>(shost, shost.getExportRoot());
    }
   
    MHostMount mount = mountDao.getHostMount(ServiceProvider.getInstance().getManagementHostId(), shost.getId());
    if(mount != null) {
      return new Tuple<SHost, String>(shost, mount.getMountPath());
    }

    // need to redirect request to other node
    throw new HostNotMountedException("Storage host " + shost.getHost() + " is not locally mounted");
  }
View Full Code Here

Examples of com.cloud.bridge.model.MHostMount

      throw new OutOfServiceException("Temporarily out of service");
     
    if(mhost.getMounts().size() > 0) {
      Random random = new Random();
      MHostMount[] mounts = (MHostMount[])mhost.getMounts().toArray();
      MHostMount mount = mounts[random.nextInt(mounts.length)];
      S3BucketAdapter bucketAdapter =  getStorageHostBucketAdapter(mount.getShost());
      bucketAdapter.createContainer(mount.getMountPath(), (null != overrideName ? overrideName : bucketName));
      return new Tuple<SHost, String>(mount.getShost(), mount.getMountPath());
    }
   
    // To make things simple, only allow one local mounted storage root
    String localStorageRoot = ServiceProvider.getInstance().getStartupProperties().getProperty("storage.root");
    if(localStorageRoot != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.