openstack plugin: Change METADATA_URL #157

Closed
wants to merge 1 commit into
from

Projects

None yet

4 participants

@smaftoul

This makes things work on the openstack install I'm using.
I didn't had a deep look at ohai/mixin/ec2_metadata which has a best_api_version method, I can provide you with some debugging. I can also add a set_debug_outputon Net::HTTP stuff somewhere ...
I'm also wondering if we shouldn't use "1.0" rather than "latest" which my be subject to schema changes.

@smaftoul smaftoul openstack plugin: Change METADATA_URL
This makes things work on the openstack install I'm using.
I didn't had a deep look at `ohai/mixin/ec2_metadata` which has a `best_api_version` method, I can provide you with some debugging. I can also add a `set_debug_output`on Net::HTTP stuff somewhere ...
I'm also wondering if we shouldn't use "1.0" rather than "latest" which my be subject to schema changes.
7c6d8a5
@srenatus

👍 Please pull this. Experiencing the same problem, with OpenStack Grizzly the metadata service services these EC2-compatible schemas:

1.0
2007-01-19
2007-03-01
2007-08-29
2007-10-10
2007-12-15
2008-02-01
2008-09-01
2009-04-04
latest

There's also the native OpenStack meta-data, available as JSON (more info here):

$  curl -q http://169.254.169.254/openstack/2013-04-04/meta_data.json | json_pp
{
   "name" : "riemann2",
   "public_keys" : {
      "srenatus" : "ssh-rsa AAAAB....Z srenatus\r\n"
   },
   "launch_index" : 0,
   "hostname" : "riemann2.novalocal",
   "availability_zone" : "nova",
   "uuid" : "c7d0d17e-a48b-4f97-aca5-e9f771856aa6",
   "random_seed" : "....."
}

This one might be preferable since can be slurped in one request? (However, I don't know what HP's cloud services provide.)

(PS first commented the commit, not the PR, sorry for the noise.)

@btm
Chef Software, Inc. member

I seem to recall having issues with latest in the past with a schema change in EC2. Could you open a ticket for this? Have you signed a CLA?

http://wiki.opscode.com/display/chef/How+to+Contribute

@sersut
Chef Software, Inc. member

Looks like we're now using an ip-addr to connect to the metadata endpoint.

https://github.com/opscode/ohai/blob/master/lib/ohai/mixin/ec2_metadata.rb#L43

Let us know if this is still an issue with Ohai 7.

@sersut sersut closed this May 21, 2014
@srenatus

The IP address wasn't the problem, but the path (i.e. using http://169.254.169.254/latest) That said, I cannot reproduce the issue with a Havana cloud, it's using 2009-04-04 and seems happy. Given a proper hint (an empty /etc/chef/ohai/hints/openstack.json), it outputs

[2014-05-22T08:55:53+00:00] DEBUG: ohai openstack
[2014-05-22T08:55:53+00:00] DEBUG: can_metadata_connect? == true
[2014-05-22T08:55:53+00:00] DEBUG: connecting to the OpenStack metadata service
[2014-05-22T08:55:53+00:00] DEBUG: EC2 metadata version: 2009-04-04

and produces

  "openstack": {
    "ami_id": "ami-00000011",
    "ami_launch_index": "0",
    "ami_manifest_path": "FIXME",
    "block_device_mapping_ami": "vda",
    "block_device_mapping_root": "/dev/vda",
    "hostname": "vmname.novalocal",
    "instance_action": "none",
    "instance_id": "i-0000010a",
    "instance_type": "m1.small",
    "kernel_id": "aki-00000002",
    "local_hostname": "vmname.novalocal",
    "local_ipv4": "10.0.0.2",
    "placement_availability_zone": "nova",
    "public_hostname": "vmname.novalocal",
    "public_ipv4": "184.26.180.24",
    "public_keys_0_openssh_key": "ssh-rsa ...",
    "ramdisk_id": "ari-00000002",
    "reservation_id": "r-ubkoedtm",
    "security_groups": [

    ],
    "provider": "openstack"
  },
  "cloud": {
    "public_ips": [
      "184.26.180.24"
    ],
    "private_ips": [
      "10.0.0.2"
    ],
    "public_ipv4": "184.26.180.24",
    "public_hostname": "vmname.novalocal",
    "local_ipv4": "10.0.0.2",
    "local_hostname": "vmname.novalocal",
    "provider": "openstack"
  },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment