@Override public Image apply(Template template) { checkNotNull(template, "template"); OperatingSystem os = templateToOperatingSystem.apply(template); ImageBuilder builder = new ImageBuilder().ids(template.getId() + "").name(template.getName()) .description(template.getDisplayText()).operatingSystem(os); if (!template.isCrossZones()) builder.location(FluentIterable.from(locations.get()).firstMatch(idEquals(template.getZoneId())).orNull()); //TODO: implement status mapping!!! builder.status(Status.AVAILABLE); return builder.build(); } }
@Override public Image apply(Template template) { checkNotNull(template, "template"); OperatingSystem os = templateToOperatingSystem.apply(template); ImageBuilder builder = new ImageBuilder().ids(template.getId() + "").name(template.getName()) .description(template.getDisplayText()).operatingSystem(os); if (!template.isCrossZones()) builder.location(FluentIterable.from(locations.get()).firstMatch(idEquals(template.getZoneId())).orNull()); //TODO: implement status mapping!!! builder.status(Status.AVAILABLE); return builder.build(); } }
@Override public Image apply(Template template) { checkNotNull(template, "template"); OperatingSystem os = templateToOperatingSystem.apply(template); ImageBuilder builder = new ImageBuilder().ids(template.getId() + "").name(template.getName()) .description(template.getDisplayText()).operatingSystem(os); if (!template.isCrossZones()) builder.location(FluentIterable.from(locations.get()).firstMatch(idEquals(template.getZoneId())).orNull()); //TODO: implement status mapping!!! builder.status(Status.AVAILABLE); return builder.build(); } }
@Test(enabled = true, dependsOnMethods = "testRegisterTemplate") public void testExtractTemplate() throws Exception { // Initiate the extraction and wait for it to complete AsyncCreateResponse response = client.getTemplateClient().extractTemplate(registeredTemplate.getId(), ExtractMode.HTTP_DOWNLOAD, registeredTemplate.getZoneId()); assertTrue(jobComplete.apply(response.getJobId()), registeredTemplate.toString()); // Get the result AsyncJob<TemplateExtraction> asyncJob = client.getAsyncJobClient().getAsyncJob(response.getJobId()); TemplateExtraction extract = asyncJob.getResult(); assertNotNull(extract); // Check that the URL can be retrieved String extractUrl = extract.getUrl(); assertNotNull(extractUrl); URI uri = new URI(URLDecoder.decode(extractUrl, "utf-8")); assertTrue(cloudStackContext.utils().http().exists(uri), "does not exist: " + uri); }
@Test(enabled = true, dependsOnMethods = "testRegisterTemplate") public void testExtractTemplate() throws Exception { // Initiate the extraction and wait for it to complete AsyncCreateResponse response = client.getTemplateApi().extractTemplate(registeredTemplate.getId(), ExtractMode.HTTP_DOWNLOAD, registeredTemplate.getZoneId()); assertTrue(jobComplete.apply(response.getJobId()), registeredTemplate.toString()); // Get the result AsyncJob<TemplateExtraction> asyncJob = client.getAsyncJobApi().getAsyncJob(response.getJobId()); TemplateExtraction extract = asyncJob.getResult(); assertNotNull(extract); // Check that the URL can be retrieved String extractUrl = extract.getUrl(); assertNotNull(extractUrl); URI uri = new URI(URLDecoder.decode(extractUrl, "utf-8")); assertTrue(cloudStackContext.utils().http().exists(uri), "does not exist: " + uri); }
for (Template template : response) { Template newDetails = Iterables.getOnlyElement(client.getTemplateApi().listTemplates( zoneId(template.getZoneId()).id(template.getId()))); Logger.CONSOLE.info("Checking template: " + template); assertEquals(template, client.getTemplateApi().getTemplateInZone(template.getId(), template.getZoneId())); assert template.getId() != null : template; assert template.getName() != null : template; assert template.getAccount() != null : template; assert template.getZone() != null : template; assert template.getZoneId() != null : template; assert template.getStatus() == null || template.getStatus() == Template.Status.DOWNLOADED : template;
for (Template template : response) { Template newDetails = Iterables.getOnlyElement(client.getTemplateClient().listTemplates( zoneId(template.getZoneId()).id(template.getId()))); Logger.CONSOLE.info("Checking template: " + template); assertEquals(template, client.getTemplateClient().getTemplateInZone(template.getId(), template.getZoneId())); assert template.getId() != null : template; assert template.getName() != null : template; assert template.getAccount() != null : template; assert template.getZone() != null : template; assert template.getZoneId() != null : template; assert (template.getStatus() == null || template.getStatus() == Template.Status.DOWNLOADED) : template;
ListNetworksOptions.Builder.zoneId(template.getZoneId()).isSystem(false)); for(Network net : allSafeNetworksInZone) { if(net.getName().equals(prefix + "-ip-network")) { ListNetworkOfferingsOptions.Builder.zoneId(template.getZoneId()).specifyVLAN(true)), null); checkNotNull(offering, "No network offering found"); logger.info("Using network offering: " + offering); template.getZoneId(), offering.getId(), prefix + "-ip-network", "", CreateNetworkOptions.Builder.startIP("192.168.0.1").endIP("192.168.0.5") .netmask("255.255.255.0").gateway("192.168.0.1").vlan("21")); ListNetworksOptions.Builder.zoneId(template.getZoneId())), new Predicate<Network>() { @Override public boolean apply(Network network) {
ListNetworksOptions.Builder.zoneId(template.getZoneId()).isSystem(false)); for (Network net : allSafeNetworksInZone) { if (net.getName().equals(prefix + "-ip-network")) { ListNetworkOfferingsOptions.Builder.zoneId(template.getZoneId()).specifyVLAN(true)), null); checkNotNull(offering, "No network offering found"); logger.info("Using network offering: " + offering); template.getZoneId(), offering.getId(), prefix + "-ip-network", "", CreateNetworkOptions.Builder.startIP("192.168.0.1").endIP("192.168.0.5") .netmask("255.255.255.0").gateway("192.168.0.1").vlan("21")); ListNetworksOptions.Builder.zoneId(template.getZoneId())), new Predicate<Network>() { @Override public boolean apply(Network network) {
.accountId(in.getAccountId()) .zone(in.getZone()) .zoneId(in.getZoneId()) .OSType(in.getOSType()) .OSTypeId(in.getOSTypeId())
.accountId(in.getAccountId()) .zone(in.getZone()) .zoneId(in.getZoneId()) .OSType(in.getOSType()) .OSTypeId(in.getOSTypeId())
.accountId(in.getAccountId()) .zone(in.getZone()) .zoneId(in.getZoneId()) .OSType(in.getOSType()) .OSTypeId(in.getOSTypeId())