mitchellh / vagrant-google

Vagrant provider for GCE.
Apache License 2.0
334 stars 100 forks source link

Improve error message when zone is out of capacity #263

Open gdubicki opened 2 years ago

gdubicki commented 2 years ago

I was unable to create a new vm. The error message was not helpful:

Bringing machine 'default' up with 'google' provider...
==> default: Checking if box 'google/gce' version '0.1.0' is up to date...
==> default: Launching an instance with the following settings...
==> default:  -- Name:                 i-2022031308-b13b93b1
(....)
==> default:  -- Accelerators:         []
Traceback (most recent call last):
        56: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/batch_action.rb:86:in `block (2 levels) in run'
        55: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/machine.rb:201:in `action'
        54: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/machine.rb:201:in `call'
        53: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/environment.rb:614:in `lock'
        52: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/machine.rb:215:in `block in action'
        51: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/machine.rb:246:in `action_raw'
        50: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/runner.rb:89:in `run'
        49: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/util/busy.rb:19:in `busy'
        48: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/runner.rb:89:in `block in run'
        47: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/builder.rb:149:in `call'
        46: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in `call'
        45: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/builtin/handle_box.rb:56:in `call'
        44: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in `call'
        43: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
        42: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in `call'
        41: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/builtin/box_check_outdated.rb:93:in `call'
        40: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in `call'
        39: from /Users/gdubicki/.vagrant.d/gems/2.7.4/gems/vagrant-google-2.7.0/lib/vagrant-google/action/connect_google.rb:47:in `call'
        38: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in `call'
        37: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/builtin/call.rb:53:in `call'
        36: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/runner.rb:89:in `run'
        35: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/util/busy.rb:19:in `busy'
        34: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/runner.rb:89:in `block in run'
        33: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/builder.rb:149:in `call'
        32: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in `call'
        31: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:127:in `block in finalize_action'
        30: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in `call'
        29: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/builtin/provision.rb:80:in `call'
        28: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in `call'
        27: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/builtin/delayed.rb:19:in `call'
        26: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in `call'
        25: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/builtin/synced_folders.rb:87:in `call'
        24: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in `call'
        23: from /Users/gdubicki/.vagrant.d/gems/2.7.4/gems/vagrant-google-2.7.0/lib/vagrant-google/action/warn_networks.rb:28:in `call'
        22: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in `call'
        21: from /Users/gdubicki/.vagrant.d/gems/2.7.4/gems/vagrant-google-2.7.0/lib/vagrant-google/action/warn_ssh_keys.rb:28:in `call'
        20: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in `call'
        19: from /Users/gdubicki/.vagrant.d/gems/2.7.4/gems/vagrant-google-2.7.0/lib/vagrant-google/action/run_instance.rb:306:in `call'
        18: from /Users/gdubicki/.vagrant.d/gems/2.7.4/gems/fog-core-2.1.0/lib/fog/core/collection.rb:50:in `create'
        17: from /Users/gdubicki/.vagrant.d/gems/2.7.4/gems/fog-google-1.17.0/lib/fog/compute/google/models/server.rb:566:in `save'
        16: from /Users/gdubicki/.vagrant.d/gems/2.7.4/gems/fog-google-1.17.0/lib/fog/compute/google/models/server.rb:501:in `reload'
        15: from /Users/gdubicki/.vagrant.d/gems/2.7.4/gems/fog-google-1.17.0/lib/fog/compute/google/requests/get_server.rb:14:in `get_server'
        14: from /Users/gdubicki/.vagrant.d/gems/2.7.4/gems/google-apis-compute_v1-0.27.0/lib/google/apis/compute_v1/service.rb:10777:in `get_instance'
        13: from /Users/gdubicki/.vagrant.d/gems/2.7.4/gems/google-apis-core-0.4.2/lib/google/apis/core/base_service.rb:377:in `execute_or_queue_command'
        12: from /Users/gdubicki/.vagrant.d/gems/2.7.4/gems/google-apis-core-0.4.2/lib/google/apis/core/http_command.rb:102:in `execute'
        11: from /Users/gdubicki/.vagrant.d/gems/2.7.4/gems/retriable-3.1.2/lib/retriable.rb:56:in `retriable'
        10: from /Users/gdubicki/.vagrant.d/gems/2.7.4/gems/retriable-3.1.2/lib/retriable.rb:56:in `times'
         9: from /Users/gdubicki/.vagrant.d/gems/2.7.4/gems/retriable-3.1.2/lib/retriable.rb:61:in `block in retriable'
         8: from /Users/gdubicki/.vagrant.d/gems/2.7.4/gems/google-apis-core-0.4.2/lib/google/apis/core/http_command.rb:111:in `block in execute'
         7: from /Users/gdubicki/.vagrant.d/gems/2.7.4/gems/retriable-3.1.2/lib/retriable.rb:56:in `retriable'
         6: from /Users/gdubicki/.vagrant.d/gems/2.7.4/gems/retriable-3.1.2/lib/retriable.rb:56:in `times'
         5: from /Users/gdubicki/.vagrant.d/gems/2.7.4/gems/retriable-3.1.2/lib/retriable.rb:61:in `block in retriable'
         4: from /Users/gdubicki/.vagrant.d/gems/2.7.4/gems/google-apis-core-0.4.2/lib/google/apis/core/http_command.rb:114:in `block (2 levels) in execute'
         3: from /Users/gdubicki/.vagrant.d/gems/2.7.4/gems/google-apis-core-0.4.2/lib/google/apis/core/http_command.rb:311:in `execute_once'
         2: from /Users/gdubicki/.vagrant.d/gems/2.7.4/gems/google-apis-core-0.4.2/lib/google/apis/core/http_command.rb:195:in `process_response'
         1: from /Users/gdubicki/.vagrant.d/gems/2.7.4/gems/google-apis-core-0.4.2/lib/google/apis/core/api_command.rb:134:in `check_status'
/Users/gdubicki/.vagrant.d/gems/2.7.4/gems/google-apis-core-0.4.2/lib/google/apis/core/http_command.rb:229:in `check_status': notFound: The resource 'projects/(...)/zones/europe-north1-a/instances/i-2022031308-b13b93b1' was not found (Google::Apis::ClientError)

When I checked the GCP Dashboard, Activity view it has shown the real reason - Resource exhausted (HTTP 429): ZONE_RESOURCE_POOL_EXHAUSTED:

Screenshot 2022-03-13 at 08 47 49

It would be good to propagate that HTTP code and the message to the plugin and show it.

gdubicki commented 2 years ago

Similar to #242?