use of com.woorea.openstack.glance.model.v2.Image in project openj9 by eclipse-openj9.
the class XMLIndexReader method setJ9DumpData.
public void setJ9DumpData(long environ, String osType, String osSubType, String cpuType, int cpuCount, long bytesMem, int pointerSize, Image[] imageRef, ImageAddressSpace[] addressSpaceRef, ImageProcess[] processRef) {
Builder builder = null;
if (_stream == null) {
// extract directly from the file
builder = new Builder(_coreFile, _reader, environ, _fileResolvingAgent);
} else {
// extract using the data stream
builder = new Builder(_coreFile, _stream, environ, _fileResolvingAgent);
}
_coreFile.extract(builder);
// Jazz 4961 : chamlain : NumberFormatException opening corrupt dump
if (cpuType == null)
cpuType = builder.getCPUType();
String cpuSubType = builder.getCPUSubType();
if (osType == null)
osType = builder.getOSType();
long creationTime = builder.getCreationTime();
_coreImage = new Image(osType, osSubType, cpuType, cpuSubType, cpuCount, bytesMem, creationTime);
ImageAddressSpace addressSpace = (ImageAddressSpace) builder.getAddressSpaces().next();
ImageProcess process = (ImageProcess) addressSpace.getCurrentProcess();
// If not sure, use the first address space/process pair found
for (Iterator it = builder.getAddressSpaces(); it.hasNext(); ) {
ImageAddressSpace addressSpace1 = (ImageAddressSpace) it.next();
final boolean vb = false;
if (vb)
System.out.println("address space " + addressSpace1);
_coreImage.addAddressSpace(addressSpace1);
for (Iterator it2 = addressSpace1.getProcesses(); it2.hasNext(); ) {
ImageProcess process1 = (ImageProcess) it2.next();
if (vb)
try {
System.out.println("process " + process1.getID());
} catch (DataUnavailable e) {
} catch (CorruptDataException e) {
}
if (process == null || isProcessForEnvironment(environ, addressSpace1, process1)) {
addressSpace = addressSpace1;
process = process1;
if (vb)
System.out.println("default process for Runtime");
}
}
}
if (null != process) {
// z/OS can have 64-bit or 31-bit processes, Java only reports 64-bit or 32-bit.
if (process.getPointerSize() != pointerSize && !(process.getPointerSize() == 31 && pointerSize == 32)) {
System.out.println("XML and core file pointer sizes differ " + process.getPointerSize() + "!=" + pointerSize);
}
} else {
throw new IllegalStateException("No process found in the dump.");
}
imageRef[0] = _coreImage;
addressSpaceRef[0] = addressSpace;
processRef[0] = process;
}
use of com.woorea.openstack.glance.model.v2.Image in project aem-core-wcm-components by adobe.
the class ImageIT method setupBeforeEach.
@BeforeEach
public void setupBeforeEach() throws ClientException {
imageTests = new ImageTests();
imageTests.setup(adminClient, contextPath, label, Commons.RT_IMAGE_V1, rootPage, defaultPageTemplate, clientlibs, new Image());
}
use of com.woorea.openstack.glance.model.v2.Image in project aem-core-wcm-components by adobe.
the class ImageIT method setupBeforeEach.
@BeforeEach
public void setupBeforeEach() throws ClientException {
clientlibs = Commons.CLIENTLIBS_IMAGE_V3;
imageTests = new ImageTests();
imageTests.setup(adminClient, contextPath, label, Commons.RT_IMAGE_V3, rootPage, defaultPageTemplate, clientlibs, new Image());
}
use of com.woorea.openstack.glance.model.v2.Image in project java-docs-samples by GoogleCloudPlatform.
the class CreateInstancesAdvanced method createWithSubnetwork.
// [END compute_instances_create_from_image_plus_snapshot_disk]
// [START compute_instances_create_from_image]
/**
* Create a new VM instance with Debian 10 operating system in specified network and subnetwork.
*
* @param project project ID or project number of the Cloud project you want to use.
* @param zone name of the zone to create the instance in. For example: "us-west3-b"
* @param instanceName name of the new virtual machine (VM) instance.
* @param networkLink name of the network you want the new instance to use. For example:
* "global/networks/default" represents the network named "default", which is created
* automatically for each project.
* @param subnetworkLink name of the subnetwork you want the new instance to use. This value uses
* the following format: "regions/{region}/subnetworks/{subnetwork_name}"
* @return Instance object.
*/
public static Instance createWithSubnetwork(String project, String zone, String instanceName, String networkLink, String subnetworkLink) throws IOException, InterruptedException, ExecutionException, TimeoutException {
try (ImagesClient imagesClient = ImagesClient.create()) {
// List of public operating system (OS) images: https://cloud.google.com/compute/docs/images/os-details
Image image = imagesClient.getFromFamily("debian-cloud", "debian-10");
String diskType = String.format("zones/%s/diskTypes/pd-standard", zone);
Vector<AttachedDisk> disks = new Vector<>();
disks.add(diskFromImage(diskType, 10, true, image.getSelfLink()));
return createWithDisks(project, zone, instanceName, disks, "n1-standard-1", networkLink, subnetworkLink);
}
}
use of com.woorea.openstack.glance.model.v2.Image in project java-docs-samples by GoogleCloudPlatform.
the class ListImages method listImages.
// [START compute_images_list]
// Prints a list of all non-deprecated image names available in given project.
public static void listImages(String project) throws IOException {
// safely clean up any remaining background resources.
try (ImagesClient imagesClient = ImagesClient.create()) {
// Listing only non-deprecated images to reduce the size of the reply.
ListImagesRequest imagesRequest = ListImagesRequest.newBuilder().setProject(project).setMaxResults(100).setFilter("deprecated.state != DEPRECATED").build();
// Although the `setMaxResults` parameter is specified in the request, the iterable returned
// by the `list()` method hides the pagination mechanic. The library makes multiple
// requests to the API for you, so you can simply iterate over all the images.
int imageCount = 0;
for (Image image : imagesClient.list(imagesRequest).iterateAll()) {
imageCount++;
System.out.println(image.getName());
}
System.out.printf("Image count in %s is: %s", project, imageCount);
}
}
Aggregations