Examples of VirtualGuest


Examples of org.jclouds.softlayer.domain.VirtualGuest

   @Test
   public void testApplyWhereVirtualGuestIsPaused() {

      // notice if we've already parsed this properly here, we can rely on it.
      VirtualGuest guest = new ParseVirtualGuestPausedTest().expected();

      // setup so that we have an expected Location to be parsed from the guest.
      Location expectedLocation = DatacenterToLocationTest.function.apply(guest.getDatacenter());
      Supplier<Set<? extends Location>> locationSupplier = Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet
            .<Location> of(expectedLocation));

      VirtualGuestToNodeMetadata parser = new VirtualGuestToNodeMetadata(locationSupplier,
            new GetHardwareForVirtualGuestMock(), new GetImageForVirtualGuestMock(), namingConvention);
View Full Code Here

Examples of org.jclouds.softlayer.domain.VirtualGuest

   @Test
   public void testApplyWhereVirtualGuestIsRunning() {

      // notice if we've already parsed this properly here, we can rely on it.
      VirtualGuest guest = new ParseVirtualGuestRunningTest().expected();

      // setup so that we have an expected Location to be parsed from the guest.
      Location expectedLocation = DatacenterToLocationTest.function.apply(guest.getDatacenter());
      Supplier<Set<? extends Location>> locationSupplier = Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet
            .<Location> of(expectedLocation));

      VirtualGuestToNodeMetadata parser = new VirtualGuestToNodeMetadata(locationSupplier,
            new GetHardwareForVirtualGuestMock(), new GetImageForVirtualGuestMock(), namingConvention);
View Full Code Here

Examples of org.jclouds.softlayer.domain.VirtualGuest

   public void testCorrect() {

      ProductItemPrice price1 = ProductItemPrice.builder().id(100).build();
      ProductItemPrice price2 = ProductItemPrice.builder().id(101).build();

      VirtualGuest guest = VirtualGuest.builder().hostname("myhost")
                                                 .domain("mydomain")
                                                 .build();

      ProductOrder order = ProductOrder.builder()
                                       .packageId(123)
View Full Code Here

Examples of org.jclouds.softlayer.domain.VirtualGuest

            "options class %s should have been assignable from SoftLayerTemplateOptions", template.getOptions()
                  .getClass());

      String domainName = template.getOptions().as(SoftLayerTemplateOptions.class).getDomainName();

      VirtualGuest newGuest = VirtualGuest.builder().domain(domainName).hostname(name).build();

      ProductOrder order = ProductOrder.builder().packageId(productPackageSupplier.get().getId())
            .location(template.getLocation().getId()).quantity(1).useHourlyPricing(true).prices(getPrices(template))
            .virtualGuests(newGuest).build();

      logger.debug(">> ordering new virtualGuest domain(%s) hostname(%s)", domainName, name);
      ProductOrderReceipt productOrderReceipt = client.getVirtualGuestApi().orderVirtualGuest(order);
      VirtualGuest result = get(productOrderReceipt.getOrderDetails().getVirtualGuests(), 0);
      logger.trace("<< virtualGuest(%s)", result.getId());

      logger.debug(">> awaiting login details for virtualGuest(%s)", result.getId());
      boolean orderInSystem = loginDetailsTester.apply(result);
      logger.trace("<< virtualGuest(%s) complete(%s)", result.getId(), orderInSystem);

      checkState(orderInSystem, "order for guest %s doesn't have login details within %sms", result,
            Long.toString(guestLoginDelay));
      result = client.getVirtualGuestApi().getVirtualGuest(result.getId());

      Password pw = get(result.getOperatingSystem().getPasswords(), 0);
      return new NodeAndInitialCredentials<VirtualGuest>(result, result.getId() + "", LoginCredentials.builder().user(pw.getUsername()).password(
            pw.getPassword()).build());
   }
View Full Code Here

Examples of org.jclouds.softlayer.domain.VirtualGuest

      return client.getVirtualGuestApi().getVirtualGuest(serverId);
   }

   @Override
   public void destroyNode(String id) {
      VirtualGuest guest = getNode(id);
      if (guest == null)
         return;

      if (guest.getBillingItemId() == -1)
         throw new IllegalStateException(String.format("no billing item for guest(%s) so we cannot cancel the order",
               id));

      logger.debug(">> canceling service for guest(%s) billingItem(%s)", id, guest.getBillingItemId());
      client.getVirtualGuestApi().cancelService(guest.getBillingItemId());
   }
View Full Code Here

Examples of org.jclouds.softlayer.domain.VirtualGuest

      @Override
      public boolean apply(VirtualGuest guest) {
         checkNotNull(guest, "virtual guest was null");

         VirtualGuest newGuest = client.getVirtualGuestApi().getVirtualGuest(guest.getId());
         boolean hasBackendIp = newGuest.getPrimaryBackendIpAddress() != null;
         boolean hasPrimaryIp = newGuest.getPrimaryIpAddress() != null;
         boolean hasPasswords = newGuest.getOperatingSystem() != null
               && newGuest.getOperatingSystem().getPasswords().size() > 0;

         return hasBackendIp && hasPrimaryIp && hasPasswords;
      }
View Full Code Here

Examples of org.jclouds.softlayer.domain.VirtualGuest

         Set<VirtualGuestBlockDevice> blockDevices = getBlockDevices(templateOptions.getBlockDevices().get(), diskType);
         virtualGuestBuilder.blockDevices(blockDevices);
         virtualGuestBuilder.localDiskFlag(isLocalDisk(diskType));
      }

      VirtualGuest virtualGuest = virtualGuestBuilder.build();
      logger.debug(">> creating new VirtualGuest(%s)", virtualGuest);
      VirtualGuest result = api.getVirtualGuestApi().createVirtualGuest(virtualGuest);
      logger.trace("<< VirtualGuest(%s)", result.getId());

      // tags
      if (templateOptions.getTags() != null) {
         api.getVirtualGuestApi().setTags(result.getId(), templateOptions.getTags());
      }

      logger.debug(">> awaiting login details for virtualGuest(%s)", result.getId());
      boolean orderInSystem = loginDetailsTester.apply(result);
      logger.trace("<< VirtualGuest(%s) complete(%s)", result.getId(), orderInSystem);

      if (!orderInSystem) {
         logger.warn("VirtualGuest(%s) doesn't have login details within %sms so it will be destroyed.", result,
              Long.toString(guestLoginDelay));
         api.getVirtualGuestApi().deleteVirtualGuest(result.getId());
         throw new IllegalStateException(format("VirtualGuest(%s) is being destroyed as it doesn't have login details" +
                 " after %sms. Please, try by increasing `jclouds.softlayer.virtualguest.login_details_delay` and " +
                 " try again", result, Long.toString(guestLoginDelay)));
      }
      result = api.getVirtualGuestApi().getVirtualGuest(result.getId());
      Password pwd = get(result.getOperatingSystem().getPasswords(), 0);
      return new NodeAndInitialCredentials<VirtualGuest>(result, result.getId() + "",
              LoginCredentials.builder().user(pwd.getUsername()).password(pwd.getPassword()).build());
   }
View Full Code Here

Examples of org.jclouds.softlayer.domain.VirtualGuest

      return api.getVirtualGuestApi().getVirtualGuest(serverId);
   }

   @Override
   public void destroyNode(String id) {
      VirtualGuest guest = getNode(id);
      if (guest == null) return;
      logger.debug(">> awaiting virtualGuest(%s) without active transactions", guest.getId());
      checkState(retry(new Predicate<VirtualGuest>() {
         public boolean apply(VirtualGuest guest) {
               return getNode(guest.getId() + "").getActiveTransactionCount() == 0;
         }
      }, activeTransactionsDelay).apply(guest), "%s still has active transactions!", guest);
      logger.debug(">> canceling virtualGuest with globalIdentifier(%s)", id);
      checkState(api.getVirtualGuestApi().deleteVirtualGuest(guest.getId()), "server(%s) still there after deleting!?", id);
   }
View Full Code Here

Examples of org.jclouds.softlayer.domain.VirtualGuest

      @Override
      public boolean apply(VirtualGuest guest) {
         checkNotNull(guest, "virtual guest was null");

         VirtualGuest newGuest = client.getVirtualGuestApi().getVirtualGuest(guest.getId());
         boolean hasBackendIp = newGuest.getPrimaryBackendIpAddress() != null;
         boolean hasPrimaryIp = newGuest.getPrimaryIpAddress() != null;
         boolean hasPasswords = newGuest.getOperatingSystem() != null
               && newGuest.getOperatingSystem().getPasswords().size() > 0;

         return hasBackendIp && hasPrimaryIp && hasPasswords;
      }
View Full Code Here

Examples of org.jclouds.softlayer.domain.VirtualGuest

      HttpResponse createVirtualGuestResponse = HttpResponse.builder().statusCode(200)
              .payload(payloadFromResource("/virtual_guest_create_response.json")).build();

      VirtualGuestApi api = requestSendsResponse(createVirtualGuest, createVirtualGuestResponse).getVirtualGuestApi();
      VirtualGuest virtualGuest = createVirtualGuest();
      VirtualGuest result = api.createVirtualGuest(virtualGuest);
      assertEquals(result, new CreateVirtualGuestResponseTest().expected());
   }
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.