List of usage examples for com.amazonaws.services.ec2.model Image getRamdiskId
public String getRamdiskId()
The RAM disk associated with the image, if any.
From source file:com.zotoh.cloudapi.aws.AMImage.java
License:Open Source License
private MachineImage toMI(Image i) { MachineImage m = null;/*from ww w . java 2s.c o m*/ if (i != null) { m = new MachineImage(); m.setProviderRegionId(_svc.getCloud().getContext().getRegionId()); m.setArchitecture(toArch(i.getArchitecture())); m.setCurrentState(toImageState(i.getState())); m.setProviderMachineImageId(i.getImageId()); m.setName(i.getName()); m.setProviderOwnerId(i.getOwnerId()); m.setSoftware(""); m.setType(toImageType(i.getRootDeviceType())); m.addTag("manifest-location", nsb(i.getImageLocation())); m.addTag("hypervisor", nsb(i.getHypervisor())); m.addTag("alias", nsb(i.getImageOwnerAlias())); m.addTag("kernel", nsb(i.getKernelId())); m.addTag("public", i.getPublic() ? "true" : "false"); m.addTag("ramdisk", nsb(i.getRamdiskId())); m.addTag("root-dev-name", nsb(i.getRootDeviceName())); m.addTag("state-reason", nsb(i.getStateReason())); m.addTag("virtualization-type", nsb(i.getVirtualizationType())); m.setDescription(i.getDescription()); m.setPlatform(nsb(i.getPlatform()).toLowerCase().indexOf("windows") >= 0 ? Platform.WINDOWS : Platform.UBUNTU); } return m; }
From source file:org.gridgain.grid.spi.cloud.ec2lite.GridEc2LiteCloudSpi.java
License:GNU General Public License
/** * Gets image resource from EC2 image./*ww w. j a v a 2s .c om*/ * * @param img EC2 image. * @return Image resource. */ private GridCloudSpiResourceAdapter createImageResource(Image img) { assert img != null; Map<String, String> params = new HashMap<String, String>(); params.put(IMG_ARCH, img.getArchitecture()); params.put(IMG_LOC, img.getImageLocation()); params.put(IMG_STATE, img.getState()); params.put(INST_TYPE, img.getImageType()); params.put(IMG_KERNEL_ID, img.getKernelId()); params.put(OWNER_ID, img.getOwnerId()); params.put(INST_PLATFORM, img.getPlatform()); params.put(IMG_RAMDISK_ID, img.getRamdiskId()); params.put(IMG_PUBLIC, String.valueOf(img.isPublic())); params.put(PRODUCT_CODE_IDS, F.concat(F.transform(img.getProductCodes(), new C1<ProductCode, String>() { @Override public String apply(ProductCode e) { return e.getProductCodeId(); } }), VAL_DELIM)); return new GridCloudSpiResourceAdapter(img.getImageId(), CLD_IMAGE, cloudId, params); }
From source file:pl.edu.agh.samm.tadapter.eucalyptus.EucalyptusTransportAdapter.java
License:Open Source License
/** * starts new VM instance, <b>does not add new resource to core</b> * * @param resource// w ww . ja va 2 s .c om * @param imageId * @param instanceType * @return * @throws Exception */ private Instance startOneInstanceAction(Resource resource, final String imageId, String instanceType, String userData) throws Exception { AmazonEC2Client client = ec2Clients.get(resource); Image image = getImageByImageID(client, imageId); if (!IMAGE_TYPE_MACHINE.equals(image.getImageType())) { throw new RuntimeException("Provided image type is not machine!"); } if (!IMAGE_STATE_AVAILABLE.equals(image.getState())) { throw new RuntimeException("Provided image state is not " + IMAGE_STATE_AVAILABLE); } RunInstancesRequest command = new RunInstancesRequest(); if (userData != null) { command.setUserData(userData); } command.setImageId(image.getImageId()); command.setInstanceType(instanceType); command.setKernelId(image.getKernelId()); command.setMaxCount(1); command.setMinCount(1); command.setRamdiskId(image.getRamdiskId()); command.setKeyName(resource.getProperty(EUCALYPTUS_KEY_NAME).toString()); RunInstancesResult result = client.runInstances(command); List<Instance> instances = result.getReservation().getInstances(); if (instances.size() < 1) { logger.error("Something bad happend while running VM instance"); } Instance instance = instances.get(0); instance = EC2Util.waitForRunningState(client, instance); logger.info("Started new instance of image " + imageId + "! InstanceId = " + instance.getInstanceId()); instance = EC2Util.waitForPublicDNS(client, instance); logger.info("Instance IP address is: " + instance.getPublicDnsName()); return instance; }