Needed GCP new virtual image IDs to change Node Type virtual image for every GCP new image release - Automation

Hi, Currently we are using Morpheus for new VM/Instance provisioning in the cloud environment (GCP) using layouts. Layouts will have Node-type which as the Virtual image details. The Problem we are facing is everything the Google Cloud Provider Updates the New image (happens once in a month) then the image present in our Node-type is automatically become NULL. Due to the new release in GCP image the old image which i selected in the node-type disappears as per the GCP policy.
PAINPOINT: Due to this issues we need to check the layout/node-type daily manually whether the image is present or not
While trying to automate the updation of image in the node-type i used the ‘’’ API Get All Node Types’ "https://apidocs.morpheusdata.com/reference/listnodetypes " to check whether the image is present or not. i completed that using my script.
NEXT Tried to update the node-type if the Virtual GCP image is empty. used the GCP Command “GET-GCEIMAGE” to collect latest image details from GCP powershell command. TO update in the Morpheus layout i used Update a Node Type “https://apidocs.morpheusdata.com/reference/updatenodetype
Using Powershell Command i can able to find the name of new GCP image.(Example windows2019-v20221212). I think Morpheus is storing the new images id in a table which i cannot able to find.
PROBLEM : I need to send the New GCP Virtual Image ID to API Body (parameter: VirtualimageId:) to append the Morpheus Layout which i cannot able to find.

Hi @Praveen_Kumar

You should be able to query the Morpheus API for the virtual image to get back the image id.
Checking from the GCP console I can see the Windows 2019 DC version is 20221109 which matches the version that was brought in to Morpheus from the GCP cloud sync.

image

I can then query by name like below to get back this id.
api/virtual-images?max=25&offset=0&name=windows-server-2019-dc-v20221109&filterType=Synced

Which will return info like this.

Now using this id I can update the node type with the new image.

/api/library/container-types/1732

My body I’m passing looks like this.

{
“containerType”: {
“virtualImageId”: 2368
}
}

Once this is updated all my layouts referencing this node type will be using the new image.

Another option is to create your own image from one of the public images in GCP and then use this in Morpheus. You will then control when its updated.

1 Like

Hi @rboyd

Thanks for your reply.

I missed the “filterType in my API Calls”. I have used your solution for my reference.

Thanks for your solution. :slightly_smiling_face: