Skip to content

Commit

Permalink
Fix the VM zone information to be retrieved from GCP VM Info instead …
Browse files Browse the repository at this point in the history
…of a fixed VMHandler value
  • Loading branch information
powerkimhub committed Jan 13, 2025
1 parent dc5ccc8 commit d382cf1
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,8 @@ func (vmHandler *GCPVMHandler) mappingServerInfo(server *compute.Instance) irs.V

Region: irs.RegionInfo{
Region: vmHandler.Region.Region,
Zone: vmHandler.Region.Zone,
//Zone: vmHandler.Region.Zone,
Zone: extractZoneName(server.Zone),
},
VMUserId: "cb-user",
NetworkInterface: server.NetworkInterfaces[0].Name,
Expand Down Expand Up @@ -1311,6 +1312,12 @@ func (vmHandler *GCPVMHandler) mappingServerInfo(server *compute.Instance) irs.V
return vmInfo
}

func extractZoneName(zoneURL string) string {
// zoneURL : https://www.googleapis.com/compute/v1/projects/sonic-arcadia-286903/zones/us-central1-a
parts := strings.Split(zoneURL, "/")
return parts[len(parts)-1]
}

func (vmHandler *GCPVMHandler) getImageType(sourceMachineImage string) irs.ImageType {
var imageType irs.ImageType

Expand Down

0 comments on commit d382cf1

Please sign in to comment.