fog / fog-google

Fog for Google Cloud Platform
MIT License
99 stars 146 forks source link

Add support for discard_local_ssd when stopping an instance #621

Closed rchekaluk closed 3 months ago

rchekaluk commented 7 months ago

Stopping an instance with local SSD throws this error:

badRequest: VM has a Local SSD attached but an undefined value for `discard-local-ssd`. If using gcloud, please add `--discard-local-ssd=false` or `--discard-local-ssd=true` to your command.

The Google API Google::Apis::Compute::stop_instance (in service.rb) supports a keyword argument discard_local_ssd, but fog-google does not. This PR adds an optional argument to allow assigning a value when stopping an instance. The default is false, both to mimic Google default, and to preserve backward compatibility with existing fog-google users.

To stop an instance containing local SSD:

async = true
discard_local_ssd = true
resp = instance.stop(async, discard_local_ssd)

References:

Temikus commented 3 months ago

LGTM. Thank you for your contribution! Apologies that it took this long to get back to you, didn't have a lot of time for OSS in the past couple of months and am just catching up.