Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Not getting appropriate error from disk createsnapshot API

Hi,

Consider following scenario. 

I have one Linux VM and having one data disk. I wanted to take application consistent snapshot of the disk. I am using disk's createsnapshot api and passing guest-flush flag as true.

1. When I deployed the custom script on the Linux VM, the create snapshot is working as expected.

But when there is an error in the  custom script that are deployed on the Linux VM and calling createsnapshot api with guest-flush as true. It should return appropriate error message. But create snapshot api return 200  and when I check for the snapshot using snapshot's get call I am getting 'snapshot' not found error.

Instead I want the exact error like : 'error in the custom scripts that are deployed ', from the GCP's createsnapshot API.

I am using Nodejs for this application.

Can someone help me on How can I get the appropriate error message from GCP API.

Solved Solved
0 2 273
1 ACCEPTED SOLUTION

Hi @TusharG ,

Per this doc: https://cloud.google.com/compute/docs/disks/creating-linux-application-consistent-pd-snapshots#troub... <quote>If no script is found, no snapshot is created.</quote>, which is the behavior that you observed. That said, the user experience could certainly be improved to indicate somehow that though the API operation was completed as designed, the snapshot wasn't created because no script was found. I suggest that you create a feature request: https://issuetracker.google.com/issues/new?component=187134&template=0.

View solution in original post

2 REPLIES 2

Hi @TusharG ,

Per this doc: https://cloud.google.com/compute/docs/disks/creating-linux-application-consistent-pd-snapshots#troub... <quote>If no script is found, no snapshot is created.</quote>, which is the behavior that you observed. That said, the user experience could certainly be improved to indicate somehow that though the API operation was completed as designed, the snapshot wasn't created because no script was found. I suggest that you create a feature request: https://issuetracker.google.com/issues/new?component=187134&template=0.

Thank you kumards for the reply.

I will definitely create a feature request for this requirement.