Michael Benguigui
Michael Benguigui

Reputation: 63

org.jclouds.compute.ComputeService listImages() (jclouds 2.5.0) returns images with "null" location

I am working with jclouds 2.5.0 and cannot get the location of the returned Images when calling org.jclouds.compute.ComputeService listImages(). Here is an exemple;

0 = {ImageImpl@55115} 
 location = null
 operatingSystem = {OperatingSystem@55515}
  family = {OsFamily@55548} "WINDOWS"
  name = null
  arch = null
  version = "server.2022.dc"
  description = "windows-server-2022-dc-v20230615"
  is64Bit = true
 status = {Image$Status@55516}
  name = "AVAILABLE"
  ordinal = 2
 backendStatus = null
 version = "v20230615"
 description = "Microsoft, Windows Server, 2022 Datacenter, Server with Desktop Experience, x64 built on 20230615, supports Shielded VM features"
 defaultCredentials = {LoginCredentials@55519}
  authenticateSudo = false
  password = {Absent@55562} {}
  privateKey = {Absent@55562} {}
  identity = "Administrator"
  credential = null
 id = "https://www.googleapis.com/compute/v1/projects/windows-cloud/global/images/windows-server-2022-dc-v20230615"
 type = {ComputeType@55521} "IMAGE"
 tags = {RegularImmutableSet@55522} []
 providerId = "5860949221769096214"
 name = "windows-server-2022-dc-v20230615"
 uri = {URI@55525} "https://www.googleapis.com/compute/v1/projects/windows-cloud/global/images/windows-server-2022-dc-v20230615"
 userMetadata = {LinkedHashMap@55526} {\n  "deprecatedState": "DEPRECATED"\n}

Any idea? Thx in advance Michael

Upvotes: 0

Views: 80

Answers (1)

minet
minet

Reputation: 162

You are encountering a common issue when using jclouds with Google Compute Engine. This happens as many of Google’s public images are considered global. And although this nature makes it available across all regions by default, a VM itself is run and provisioned within a specific zone— this makes specifying a zone important when calling images to avoid jclouds from returning a null location for them.

To avoid this, I suggest ensuring to set the locationID to a zone within your TemplateBuilder:

TemplateBuilder templateBuilder = compute.templateBuilder();
templateBuilder.fromImage(compute.getImage("debian-7-wheezy-v20140408")); 
templateBuilder.locationId("europe-west1-a"); // specifying the zone

You can also check this documentation for more reference.

Important Note: When uploading images or files, please ensure that you remove any Personally Identifiable Information (PII), such as project IDs, passwords/privateKeys to maintain security.

Upvotes: 2

Related Questions