vchs / ruby_vcloud_sdk

Apache License 2.0
15 stars 16 forks source link

PUT 405 Method Not Allowed (RestClient::MethodNotAllowed) #5

Closed karlkfi closed 9 years ago

karlkfi commented 9 years ago

We seem to be having some trouble deploying microbosh to vcloud using the bosh_vcloud_cpi. It seems to be related to some sort of version negotiation issue.

At the top of the bosh_micro_deploy.log:

W, [2014-11-19T10:06:34.980812 #82186] [create_stemcell(/var/folders/4n/qs1rjbmd1c5gfb78m3_06j6r0000gn/T/d20141119-82186-1fxkf3n/sc-20141119-82186-15e256n/image, _)]  WARN -- : 
          Caught exception when retrieving login url:
          uninitialized constant VCloudSdk::Xml::SupportedVersions::VCloudClient"

          Default to /api/sessions

Then later, when trying to create the VM (specifically setting the metadata), the ruby_vcloud_sdk explodes with the following:

/mnt/ci-tmp/ruby/1.9.1/gems/rest-client-1.6.7/lib/restclient/abstract_response.rb:48:in `return!': 405 Method Not Allowed (RestClient::MethodNotAllowed)
    from /mnt/ci-tmp/ruby/1.9.1/gems/bosh_vcloud_cpi-0.7.1/lib/cloud/vcloud/vcd_client.rb:235:in `block (2 levels) in send_request'
    from /mnt/ci-tmp/ruby/1.9.1/gems/rest-client-1.6.7/lib/restclient/request.rb:228:in `call'
    from /mnt/ci-tmp/ruby/1.9.1/gems/rest-client-1.6.7/lib/restclient/request.rb:228:in `process_result'
    from /mnt/ci-tmp/ruby/1.9.1/gems/rest-client-1.6.7/lib/restclient/request.rb:178:in `block in transmit'
    from /Users/pivotal/.rubies/ruby-1.9.3-p547/lib/ruby/1.9.1/net/http.rb:746:in `start'
    from /mnt/ci-tmp/ruby/1.9.1/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit'
    from /mnt/ci-tmp/ruby/1.9.1/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute'
    from /mnt/ci-tmp/ruby/1.9.1/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'
    from /mnt/ci-tmp/ruby/1.9.1/gems/bosh_vcloud_cpi-0.7.1/lib/cloud/vcloud/vcd_client.rb:233:in `block in send_request'
    from /mnt/ci-tmp/ruby/1.9.1/gems/bosh_vcloud_cpi-0.7.1/lib/cloud/vcloud/vcd_client.rb:271:in `block in retry_for_network_issue'
    from /mnt/ci-tmp/ruby/1.9.1/gems/bosh_vcloud_cpi-0.7.1/lib/cloud/vcloud/vcd_client.rb:269:in `loop'
    from /mnt/ci-tmp/ruby/1.9.1/gems/bosh_vcloud_cpi-0.7.1/lib/cloud/vcloud/vcd_client.rb:269:in `retry_for_network_issue'
    from /mnt/ci-tmp/ruby/1.9.1/gems/bosh_vcloud_cpi-0.7.1/lib/cloud/vcloud/vcd_client.rb:231:in `send_request'
    from /mnt/ci-tmp/ruby/1.9.1/gems/bosh_vcloud_cpi-0.7.1/lib/cloud/vcloud/vcd_client.rb:116:in `invoke'
    from /mnt/ci-tmp/ruby/1.9.1/gems/bosh_vcloud_cpi-0.7.1/lib/cloud/vcloud/vcd_client.rb:126:in `invoke_and_wait'
    from /mnt/ci-tmp/ruby/1.9.1/gems/bosh_vcloud_cpi-0.7.1/lib/cloud/vcloud/steps/save_agent_env.rb:25:in `perform'
    from /mnt/ci-tmp/ruby/1.9.1/gems/bosh_vcloud_cpi-0.7.1/lib/cloud/vcloud/steps.rb:37:in `next'
    from /mnt/ci-tmp/ruby/1.9.1/gems/bosh_vcloud_cpi-0.7.1/lib/cloud/vcloud/cloud.rb:314:in `save_agent_env'
    from /mnt/ci-tmp/ruby/1.9.1/gems/bosh_vcloud_cpi-0.7.1/lib/cloud/vcloud/cloud.rb:130:in `block in create_vm'
    from /mnt/ci-tmp/ruby/1.9.1/gems/bosh_vcloud_cpi-0.7.1/lib/cloud/vcloud/steps.rb:44:in `call'
    from /mnt/ci-tmp/ruby/1.9.1/gems/bosh_vcloud_cpi-0.7.1/lib/cloud/vcloud/steps.rb:44:in `block in perform'
    from /Users/pivotal/workspace/bosh/bosh_common/lib/common/thread_formatter.rb:49:in `with_thread_name'
    from /mnt/ci-tmp/ruby/1.9.1/gems/bosh_vcloud_cpi-0.7.1/lib/cloud/vcloud/steps.rb:41:in `perform'
    from /mnt/ci-tmp/ruby/1.9.1/gems/bosh_vcloud_cpi-0.7.1/lib/cloud/vcloud/steps.rb:58:in `perform'
    from /mnt/ci-tmp/ruby/1.9.1/gems/bosh_vcloud_cpi-0.7.1/lib/cloud/vcloud/cloud.rb:287:in `steps'
    from /mnt/ci-tmp/ruby/1.9.1/gems/bosh_vcloud_cpi-0.7.1/lib/cloud/vcloud/cloud.rb:50:in `create_vm'
    from /Users/pivotal/workspace/bosh/bosh_cli_plugin_micro/lib/bosh/deployer/instance_manager.rb:243:in `create_vm'
    from /Users/pivotal/workspace/bosh/bosh_cli_plugin_micro/lib/bosh/deployer/instance_manager.rb:123:in `block in create'
    from /Users/pivotal/workspace/bosh/bosh_cli_plugin_micro/lib/bosh/deployer/instance_manager.rb:85:in `step'
    from /Users/pivotal/workspace/bosh/bosh_cli_plugin_micro/lib/bosh/deployer/instance_manager.rb:122:in `create'
    from /Users/pivotal/workspace/bosh/bosh_cli_plugin_micro/lib/bosh/deployer/instance_manager.rb:98:in `block in create_deployment'
    from /Users/pivotal/workspace/bosh/bosh_cli_plugin_micro/lib/bosh/deployer/instance_manager.rb:92:in `with_lifecycle'
    from /Users/pivotal/workspace/bosh/bosh_cli_plugin_micro/lib/bosh/deployer/instance_manager.rb:98:in `create_deployment'
    from /Users/pivotal/workspace/bosh/bosh_cli_plugin_micro/lib/bosh/cli/commands/micro.rb:179:in `perform'
    from /Users/pivotal/workspace/bosh/bosh_cli/lib/cli/command_handler.rb:57:in `run'
    from /Users/pivotal/workspace/bosh/bosh_cli/lib/cli/runner.rb:56:in `run'
    from /Users/pivotal/workspace/bosh/bosh_cli/lib/cli/runner.rb:16:in `run'
    from /Users/pivotal/workspace/bosh/bosh_cli/bin/bosh:7:in `<top (required)>'
    from /mnt/ci-tmp/ruby/1.9.1/bin/bosh:23:in `load'
    from /mnt/ci-tmp/ruby/1.9.1/bin/bosh:23:in `<main>'

Here's the related log snipit (we had to enable DEBUG... the default log level INFO doesn't provide enough details):

D, [2014-11-19T10:10:39.523309 #82186] [create_vm(bm-2641f508-3191-4b44-9b1c-af5a79c23254, urn:vcloud:catalogitem:a2744507-574e-461b-89e9-2a1471cf2c52, {"ram"=>2048, "disk"=>8192, "cpu"=>1}, ...)] DEBUG -- : REST REQ PUT https://*****-vcd.vchs.vmware.com:443/api/vApp/vm-4fff38ab-829d-414c-b4e6-13b4aca757d8/metadata/ {:Accept=>"application/*+xml;version=5.1", :content_type=>"application/vnd.vmware.vcloud.metadata.value+xml", :x_vcloud_authorization=>"**************"} {"vcloud-token"=>"**************", "Path"=>"%2F"} <MetadataValue xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" type="application/vnd.vmware.vcloud.metadata.value+xml">
    <TypedValue xsi:type="MetadataStringValue">
        <Value>{"vm":{"name":"bm-2641f508-3191-4b44-9b1c-af5a79c23254","id":"urn:vcloud:vm:4fff38ab-829d-414c-b4e6-13b4aca757d8"},"agent_id":"bm-2641f508-3191-4b44-9b1c-af5a79c23254","disks":{"system":"0","ephemeral":"1","persistent":{}},"networks":{"bosh":{"cloud_properties":{"name":"VDC-BOSH"},"netmask":"255.255.255.0","gateway":"192.168.112.1","ip":"192.168.112.12","dns":["192.168.112.1"],"type":null,"default":["dns","gateway"],"mac":"00:50:56:0d:4b:bd"}},"env":{"bosh":{"password":null},"vapp":null},"ntp":[null],"blobstore":{"provider":"local","options":{"blobstore_path":"/var/vcap/micro_bosh/data/cache"}},"mbus":"https://vcap:**********@0.0.0.0:6868"}</Value>
    </TypedValue>
</MetadataValue>
D, [2014-11-19T10:10:39.691651 #82186] [create_vm(bm-2641f508-3191-4b44-9b1c-af5a79c23254, urn:vcloud:catalogitem:a2744507-574e-461b-89e9-2a1471cf2c52, {"ram"=>2048, "disk"=>8192, "cpu"=>1}, ...)] DEBUG -- : REST RES 405 {:date=>"Wed, 19 Nov 2014 18:10:40 GMT", :x_vmware_vcloud_request_id=>"******************", :vary=>"Accept-Encoding", :x_vmware_vcloud_request_execution_time=>"7", :content_type=>"application/vnd.vmware.vcloud.error+xml;version=5.1", :content_length=>"341"} <?xml version="1.0" encoding="UTF-8"?>
<Error xmlns="http://www.vmware.com/vcloud/v1.5" majorErrorCode="405" message="HTTP method not allowed" minorErrorCode="METHOD_NOT_ALLOWED" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://10.6.54.3/api/v1.5/schema/master.xsd"></Error>

It appears to have defaulted to trying to use the v1.5 API, but it's using the PUT method instead of POST. I assume this means both version negotiation and v1.5 API support are broken.

I can supply the http://www.vmware.com/vcloud/versions response if necessary, but I think this is just a code issue.

karlkfi commented 9 years ago

This appears to actually be a bosh_vcloud_cpi issue, not neccessarily related to ruby_vcloud_sdk. Create new issue here: https://github.com/vchs/bosh_vcloud_cpi/issues/9