Package org.jclouds.cloudstack.domain

Examples of org.jclouds.cloudstack.domain.VirtualMachine


                        return ImmutableSet.of(IPForwardingRule.builder().id("1234l").IPAddress("1.1.1.1").build());
                     }
                  }), namingConvention);

      // notice if we've already parsed this properly here, we can rely on it.
      VirtualMachine guest = Iterables.get(new ListVirtualMachinesResponseTest().expected(), 0);

      NodeMetadata node = parser.apply(guest);

      assertEquals(
            node.toString(),
View Full Code Here


                     public Set<IPForwardingRule> load(String arg0) throws Exception {
                        return ImmutableSet.of();
                     }
                  }), namingConvention);

      VirtualMachine guest = VirtualMachine.builder()
         .id("54")
         .name("i-3-54-VM")
         .displayName("i-3-54-VM")
         .account("adrian")
         .domainId("1")
View Full Code Here

                     }

                  }), namingConvention);

      // notice if we've already parsed this properly here, we can rely on it.
      VirtualMachine guest = Iterables.get(new ListVirtualMachinesResponseTest().expected(), 0);

      NodeMetadata node = parser.apply(guest);

      assertEquals(
            node.toString(),
View Full Code Here

      AsyncJob<VirtualMachine> jobWithResult = client.getAsyncJobApi().<VirtualMachine> getAsyncJob(job.getJobId());
      if (jobWithResult.getError() != null)
         Throwables.propagate(new ExecutionException(String.format("job %s failed with exception %s", job.getId(),
               jobWithResult.getError().toString())) {
         });
      VirtualMachine vm = jobWithResult.getResult();
      if (vm.isPasswordEnabled()) {
         assert vm.getPassword() != null : vm;
      }
      assertTrue(virtualMachineRunning.apply(vm));
      assertEquals(vm.getServiceOfferingId(), serviceOfferingId);
      assertEquals(vm.getTemplateId(), templateId);
      assertEquals(vm.getZoneId(), zoneId);
      return vm;
   }
View Full Code Here

   public void testListVirtualMachines() throws Exception {
      Set<VirtualMachine> response = client.getVirtualMachineApi().listVirtualMachines();
      assert null != response;
      assertTrue(response.size() >= 0);
      for (VirtualMachine vm : response) {
         VirtualMachine newDetails = getOnlyElement(client.getVirtualMachineApi().listVirtualMachines(
               ListVirtualMachinesOptions.Builder.id(vm.getId())));
         assertEquals(vm.getId(), newDetails.getId());
         checkVm(vm);
      }
   }
View Full Code Here

      final Volume volume = createPreferredVolumeFromDisk();
      try {

         checkVolume(volume);

         VirtualMachine virtualMachine = getPreferredVirtualMachine();

         logger.info("attaching volume %s to vm %s", volume, virtualMachine);
         AsyncCreateResponse job = client.getVolumeApi().attachVolume(volume.getId(), virtualMachine.getId());
         assertTrue(jobComplete.apply(job.getJobId()));
         Volume attachedVolume = findVolumeWithId(volume.getId());

         checkVolume(attachedVolume);
         assertEquals(virtualMachine.getId(), attachedVolume.getVirtualMachineId());
         assertNotNull(attachedVolume.getAttached());

         logger.info("detaching volume %s from vm %s", volume, virtualMachine);
         job = client.getVolumeApi().detachVolume(volume.getId());
         assertTrue(jobComplete.apply(job.getJobId()));
View Full Code Here

        return ImmutableList.copyOf(jobIds);
    }

    public static void waitForVMtoStart(final CloudStackClient client, final String vmName) {
        checkNotEmpty(vmName);
        VirtualMachine machine = getVirtualMachineByName(client, vmName);
        String id = machine.getId();
        long startTime = System.currentTimeMillis();
        while (machine.getState() == STARTING) {
            try {
                LOG.info("Waiting for VM {} - id {} to start", machine.getName(), machine.getId());
                TimeUnit.SECONDS.sleep(BETWEEN_REQUESTS_SLEEP_TIME);
                machine = client.getVirtualMachineClient().getVirtualMachine(id);
            } catch (InterruptedException e) {
                LOG.info("Interrupted while waiting for VM's to start");
                Throwables.propagateIfPossible(e);
            }
            if (timeOutExceeded(startTime)) {
                break;
            }
        }

        switch (machine.getState()) {
            case RUNNING:
                LOG.info("VM {} is running, as expected", vmName);
                break;
            default:
                throw new IllegalStateException("VM " + machine + "is not in RUNNING state");
View Full Code Here

TOP

Related Classes of org.jclouds.cloudstack.domain.VirtualMachine

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.