Examples of MHost


Examples of com.cloud.bridge.model.MHost

    }
   
    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());
View Full Code Here

Examples of com.cloud.bridge.model.MHost

    }
   
    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());
View Full Code Here

Examples of com.cloud.bridge.model.MHost

  private Tuple<SHost, String> allocBucketStorageHost(String bucketName, String overrideName)
  {
    MHostDao mhostDao = new MHostDao();
    SHostDao shostDao = new SHostDao();
   
    MHost mhost = mhostDao.get(ServiceProvider.getInstance().getManagementHostId());
    if(mhost == null)
      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) {
      SHost localSHost = shostDao.getLocalStorageHost(mhost.getId(), localStorageRoot);
      if(localSHost == null)
        throw new InternalErrorException("storage.root is configured but not initialized");
     
      S3BucketAdapter bucketAdapter =  getStorageHostBucketAdapter(localSHost);
      bucketAdapter.createContainer(localSHost.getExportRoot(),(null != overrideName ? overrideName : bucketName));
View Full Code Here

Examples of com.cloud.bridge.model.MHost

  private void setupHost(String hostKey, String host) {
    MHostDao mhostDao = new MHostDao();
    mhost = mhostDao.getByHostKey(hostKey);
    if(mhost == null) {
      mhost = new MHost();
      mhost.setHostKey(hostKey);
      mhost.setHost(host);
      mhost.setLastHeartbeatTime(DateHelper.currentGMTTime());
      mhostDao.save(mhost);
    } else {
View Full Code Here

Examples of com.webobjects.monitor._private.MHost

import er.extensions.eof.ERXQ;
import er.rest.ERXRestContext;

public class MHostRestDelegate extends JavaMonitorRestDelegate {
    public Object createObjectOfEntityWithID(EOClassDescription entity, Object id, ERXRestContext context) {
    return new MHost(siteConfig(), (String)id, MHost.MAC_HOST_TYPE);
  }
View Full Code Here

Examples of com.webobjects.monitor._private.MHost

  }
 
  @Override
  public WOActionResults createAction() throws Throwable {
    checkPassword();
    MHost host = create(ERXKeyFilter.filterWithAttributes());
        siteConfig().addHost_M(host);
        if (siteConfig().hostArray().count() != 0) {
            handler().sendAddHostToWotaskds(host, siteConfig().hostArray());
        }
    return response(host, ERXKeyFilter.filterWithAttributes());
View Full Code Here

Examples of com.webobjects.monitor._private.MHost

  }

  @Override
  public WOActionResults showAction() throws Throwable {
    checkPassword();
    MHost host = siteConfig().hostWithName((String) routeObjectForKey("mHost"));   
    return response(host, ERXKeyFilter.filterWithAttributes());
  }
View Full Code Here

Examples of com.webobjects.monitor._private.MHost

    checkPassword();
    MApplication application = (MApplication) routeObjectForKey("name");
    // Old code. The if statement replaces this code along with the addInstanceOnAllHostsAction() method. kib 20110622
    //    addInstance(application, (MHost)routeObjectForKey("host"), false);
    if (request().stringFormValueForKey("host") != null) {
      MHost mHost = siteConfig().hostWithName(request().stringFormValueForKey("host"));
      addInstance(application, mHost, false);
    } else
      addInstance(application, null, true);
    return response(application, ERXKeyFilter.filterWithNone());
  }
View Full Code Here

Examples of com.webobjects.monitor._private.MHost

        WOResponse[] responses = sendQueryToWotaskds("HOST", hostArray);

        NSMutableArray errorArray = new NSMutableArray();
        NSDictionary responseDict = null;
        for (int i = 0; i < responses.length; i++) {
            MHost aHost = siteConfig().hostArray().objectAtIndex(i);

            if ((responses[i] == null) || (responses[i].content() == null)) {
                responseDict = emptyResponse;
            } else {
                try {
                    responseDict = (NSDictionary) new _JavaMonitorDecoder().decodeRootObject(responses[i].content());
                } catch (WOXMLException wxe) {
                    NSLog.err.appendln("MonitorComponent pageWithName(HostsPage) Error decoding response: "
                            + responses[i].contentString());
                    responseDict = responseParsingFailed;
                }
            }
            getGlobalErrorFromResponse(responseDict, errorArray);

            NSDictionary queryResponse = (NSDictionary) responseDict.valueForKey("queryWotaskdResponse");
            if (queryResponse != null) {
                NSDictionary hostResponse = (NSDictionary) queryResponse.valueForKey("hostResponse");
                aHost._setHostInfo(hostResponse);
                aHost.isAvailable = true;
            } else {
                aHost.isAvailable = false;
            }
        } // for
View Full Code Here

Examples of com.webobjects.monitor._private.MHost

                    }

                    if ((nullOrError == null) && (siteConfig().hostWithAddress(anAddress) == null)) {
                        if (hostMeetsMinimumVersion(anAddress)) {

                            MHost host = new MHost(siteConfig(), newHostName, hostTypeSelection.toUpperCase());

                            // To avoid overwriting hosts
                            NSArray tempHostArray = new NSArray(siteConfig().hostArray());
                            siteConfig().addHost_M(host);
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.