Package org.jclouds.vcloud.compute.options

Examples of org.jclouds.vcloud.compute.options.VCloudTemplateOptions


      vAppResponse = client.getVAppClient().getVApp(vAppResponse.getHref());

      // per above check, we know there is only a single VM
      Vm vm = get(vAppResponse.getChildren(), 0);

      VCloudTemplateOptions vOptions = VCloudTemplateOptions.class.cast(template.getOptions());

      // note we cannot do tasks in parallel or VCD will throw "is busy" errors

      // note we must do this before any other customizations as there is a dependency on
      // valid naming conventions before you can perform commands such as updateCPUCount
      logger.trace(">> updating customization vm(%s) name->(%s)", vm.getName(), name);
      waitForTask(updateVmWithNameAndCustomizationScript(vm, name, vOptions.getCustomizationScript()));
      logger.trace("<< updated customization vm(%s)", name);

      ensureVmHasAllocationModeOrPooled(vAppResponse, vOptions.getIpAddressAllocationMode());

      int cpuCount = (int) getCores(template.getHardware());
      logger.trace(">> updating cpuCount(%d) vm(%s)", cpuCount, vm.getName());
      waitForTask(updateCPUCountOfVm(vm, cpuCount));
      logger.trace("<< updated cpuCount vm(%s)", vm.getName());


   }
 
   @VisibleForTesting
   protected VApp instantiateVAppFromTemplate(String name, Template template) {
      VCloudTemplateOptions vOptions = VCloudTemplateOptions.class.cast(template.getOptions());
     
      URI templateId = URI.create(template.getImage().getId());

      VAppTemplate vAppTemplate = vAppTemplates.getUnchecked(templateId);

      // per above check, we know there is only a single VM
      Vm vm = get(vAppResponse.getChildren(), 0);

      template.getOptions().userMetadata(ComputeServiceConstants.NODE_GROUP_KEY, group);
      VCloudTemplateOptions vOptions = VCloudTemplateOptions.class.cast(template.getOptions());

      // note we cannot do tasks in parallel or VCD will throw "is busy" errors

      // note we must do this before any other customizations as there is a dependency on
      // valid naming conventions before you can perform commands such as updateCPUCount
      logger.trace(">> updating customization vm(%s) name->(%s)", vm.getName(), name);
      waitForTask(updateVmWithNameAndCustomizationScript(vm, name, vOptions.getCustomizationScript()));
      logger.trace("<< updated customization vm(%s)", name);

      ensureVmHasAllocationModeOrPooled(vAppResponse, vOptions.getIpAddressAllocationMode());

      int cpuCount = (int) getCores(template.getHardware());
      logger.trace(">> updating cpuCount(%d) vm(%s)", cpuCount, vm.getName());
      waitForTask(updateCPUCountOfVm(vm, cpuCount));
      logger.trace("<< updated cpuCount vm(%s)", vm.getName());

   }
 
   @VisibleForTesting
   protected VApp instantiateVAppFromTemplate(String name, Template template) {
      VCloudTemplateOptions vOptions = VCloudTemplateOptions.class.cast(template.getOptions());
     
      URI templateId = URI.create(template.getImage().getId());

      VAppTemplate vAppTemplate = vAppTemplates.getUnchecked(templateId);

      // per above check, we know there is only a single VM
      Vm vm = get(vAppResponse.getChildren(), 0);

      template.getOptions().userMetadata(ComputeServiceConstants.NODE_GROUP_KEY, group);
      VCloudTemplateOptions vOptions = VCloudTemplateOptions.class.cast(template.getOptions());

      // note we cannot do tasks in parallel or VCD will throw "is busy" errors

      // note we must do this before any other customizations as there is a dependency on
      // valid naming conventions before you can perform commands such as updateCPUCount
      logger.trace(">> updating customization vm(%s) name->(%s)", vm.getName(), name);
      waitForTask(updateVmWithNameAndCustomizationScript(vm, name, vOptions.getCustomizationScript()));
      logger.trace("<< updated customization vm(%s)", name);

      ensureVmHasAllocationModeOrPooled(vAppResponse, vOptions.getIpAddressAllocationMode());

      int cpuCount = (int) getCores(template.getHardware());
      logger.trace(">> updating cpuCount(%d) vm(%s)", cpuCount, vm.getName());
      waitForTask(updateCPUCountOfVm(vm, cpuCount));
      logger.trace("<< updated cpuCount vm(%s)", vm.getName());

   }
 
   @VisibleForTesting
   protected VApp instantiateVAppFromTemplate(String name, Template template) {
      VCloudTemplateOptions vOptions = VCloudTemplateOptions.class.cast(template.getOptions());
     
      URI templateId = URI.create(template.getImage().getId());

      VAppTemplate vAppTemplate = vAppTemplates.getUnchecked(templateId);

      vAppResponse = client.getVAppClient().getVApp(vAppResponse.getHref());

      // per above check, we know there is only a single VM
      Vm vm = get(vAppResponse.getChildren(), 0);

      VCloudTemplateOptions vOptions = VCloudTemplateOptions.class.cast(template.getOptions());

      // note we cannot do tasks in parallel or VCD will throw "is busy" errors

      // note we must do this before any other customizations as there is a dependency on
      // valid naming conventions before you can perform commands such as updateCPUCount
      logger.trace(">> updating customization vm(%s) name->(%s)", vm.getName(), name);
      waitForTask(updateVmWithNameAndCustomizationScript(vm, name, vOptions.getCustomizationScript()));
      logger.trace("<< updated customization vm(%s)", name);

      ensureVmHasAllocationModeOrPooled(vAppResponse, vOptions.getIpAddressAllocationMode());

      int cpuCount = (int) getCores(template.getHardware());
      logger.trace(">> updating cpuCount(%d) vm(%s)", cpuCount, vm.getName());
      waitForTask(updateCPUCountOfVm(vm, cpuCount));
      logger.trace("<< updated cpuCount vm(%s)", vm.getName());

   }
 
   @VisibleForTesting
   protected VApp instantiateVAppFromTemplate(String name, Template template) {
      VCloudTemplateOptions vOptions = VCloudTemplateOptions.class.cast(template.getOptions());
     
      URI templateId = URI.create(template.getImage().getId());

      VAppTemplate vAppTemplate = vAppTemplates.getUnchecked(templateId);

      // per above check, we know there is only a single VM
      Vm vm = get(vAppResponse.getChildren(), 0);

      template.getOptions().userMetadata(ComputeServiceConstants.NODE_GROUP_KEY, group);
      VCloudTemplateOptions vOptions = VCloudTemplateOptions.class.cast(template.getOptions());

      // note we cannot do tasks in parallel or VCD will throw "is busy" errors

      // note we must do this before any other customizations as there is a dependency on
      // valid naming conventions before you can perform commands such as updateCPUCount
      logger.trace(">> updating customization vm(%s) name->(%s)", vm.getName(), name);
      waitForTask(updateVmWithNameAndCustomizationScript(vm, name, vOptions.getCustomizationScript()));
      logger.trace("<< updated customization vm(%s)", name);

      ensureVmHasAllocationModeOrPooled(vAppResponse, vOptions.getIpAddressAllocationMode());

      int cpuCount = (int) getCores(template.getHardware());
      logger.trace(">> updating cpuCount(%d) vm(%s)", cpuCount, vm.getName());
      waitForTask(updateCPUCountOfVm(vm, cpuCount));
      logger.trace("<< updated cpuCount vm(%s)", vm.getName());

   }

   @VisibleForTesting
   protected VApp instantiateVAppFromTemplate(String name, Template template) {
      VCloudTemplateOptions vOptions = VCloudTemplateOptions.class.cast(template.getOptions());

      URI templateId = URI.create(template.getImage().getId());

      VAppTemplate vAppTemplate = vAppTemplates.getUnchecked(templateId);

TOP

Related Classes of org.jclouds.vcloud.compute.options.VCloudTemplateOptions

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.