cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carlos Reátegui <create...@gmail.com>
Subject Re: cloud-init issue
Date Mon, 25 Aug 2014 16:02:41 GMT
Not sure about this ‘fix’.  If the goal is to match AWS here is the way it works compared
to 4.3.

1) /latest/user-data

On AWS one can query /latest/user-data with or without the trailing slash and BOTH return
the user-data

On ACS 4.3 /latest/user-data works but with trailing / returns a 404.

2) /latest/meta-data

On AWS /latest/meta-data returns a 301 pointing to trailing / version.  With a trailing slash
it return the meta-data objects available.

On ACS 4.3 /latest/meta-data returns 404. With a trailing slash it returns the meta-data objects
available.

3) /latest/meta-data/<object>

On AWS with and without / returns the object value(s)

On ACS 4.3 without a / it returns the value.  With the / it returns a 404.

——

Here are examples of the above (I am also including the headers and in the case of user-data
only the headers):

ACS 4.3

$ curl -I http://172.30.45.101/latest/user-data/
HTTP/1.1 404 Not Found
Date: Mon, 25 Aug 2014 15:53:18 GMT
Server: Apache
Vary: Accept-Encoding
Content-Type: text/html; charset=iso-8859-1

$ curl -I http://172.30.45.101/latest/user-data
HTTP/1.1 200 OK
Date: Mon, 25 Aug 2014 15:53:23 GMT
Server: Apache
Last-Modified: Mon, 11 Aug 2014 22:34:05 GMT
ETag: "10240-0-5006227053140;500622334a140”
Accept-Ranges: bytes

$ curl -i http://172.30.45.101/latest/meta-data
HTTP/1.1 404 Not Found
Date: Mon, 25 Aug 2014 15:54:25 GMT
Server: Apache
Vary: Accept-Encoding
Content-Length: 214
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /latest/meta-data was not found on this server.</p>
</body></html>

$ curl -i http://172.30.45.101/latest/meta-data/
HTTP/1.1 200 OK
Date: Mon, 25 Aug 2014 15:54:32 GMT
Server: Apache
Last-Modified: Mon, 11 Aug 2014 22:34:05 GMT
ETag: "1024a-88-5006227053140;500622334a140"
Accept-Ranges: bytes
Content-Length: 136

service-offering
availability-zone
local-ipv4
local-hostname
public-ipv4
public-hostname
instance-id
vm-id
public-keys
cloud-identifier

$ curl -i http://172.30.45.101/latest/meta-data/local-ipv4; echo
HTTP/1.1 200 OK
Date: Mon, 25 Aug 2014 15:55:39 GMT
Server: Apache
Last-Modified: Mon, 11 Aug 2014 22:34:05 GMT
ETag: "10250-d-5006227053140;500622334a140"
Accept-Ranges: bytes
Content-Length: 13

172.30.45.123

$ curl -i http://172.30.45.101/latest/meta-data/local-ipv4/; echo
HTTP/1.1 404 Not Found
Date: Mon, 25 Aug 2014 15:55:45 GMT
Server: Apache
Vary: Accept-Encoding
Content-Length: 232
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /metadata/172.30.45.123/local-ipv4/ was not found on this server.</p>
</body></html>


On AWS EC2

$ curl -I  http://169.254.169.254/latest/user-data
HTTP/1.0 200 OK
Content-Type: application/octet-stream
Accept-Ranges: bytes
ETag: "590463714"
Last-Modified: Thu, 03 Apr 2014 23:10:13 GMT
Content-Length: 4790
Connection: close
Date: Mon, 25 Aug 2014 15:57:15 GMT
Server: EC2ws

$ curl -I  http://169.254.169.254/latest/user-data/
HTTP/1.0 200 OK
Content-Type: application/octet-stream
Accept-Ranges: bytes
ETag: "590463714"
Last-Modified: Thu, 03 Apr 2014 23:10:13 GMT
Content-Length: 4790
Connection: close
Date: Mon, 25 Aug 2014 15:57:20 GMT
Server: EC2ws

$ curl -i http://169.254.169.254/latest/meta-data
HTTP/1.0 301 Moved Permanently
Location: http://169.254.169.254/latest/meta-data/
Content-Length: 0
Connection: close
Date: Mon, 25 Aug 2014 15:58:00 GMT
Server: EC2ws

$ curl -i http://169.254.169.254/latest/meta-data/; echo
HTTP/1.0 200 OK
Content-Type: text/plain
Accept-Ranges: bytes
ETag: "1606042795"
Last-Modified: Thu, 03 Apr 2014 23:10:13 GMT
Content-Length: 268
Connection: close
Date: Mon, 25 Aug 2014 15:58:50 GMT
Server: EC2ws

ami-id
ami-launch-index
ami-manifest-path
block-device-mapping/
hostname
iam/
instance-action
instance-id
instance-type
kernel-id
local-hostname
local-ipv4
mac
metrics/
network/
placement/
profile
public-hostname
public-ipv4
public-keys/
reservation-id
security-groups

$ curl -i http://169.254.169.254/latest/meta-data/local-ipv4; echo
HTTP/1.0 200 OK
Content-Type: text/plain
Accept-Ranges: bytes
ETag: "916027669"
Last-Modified: Thu, 03 Apr 2014 23:10:13 GMT
Content-Length: 12
Connection: close
Date: Mon, 25 Aug 2014 16:00:32 GMT
Server: EC2ws

10.250.5.124
$ curl -i http://169.254.169.254/latest/meta-data/local-ipv4/; echo
HTTP/1.0 200 OK
Content-Type: text/plain
Accept-Ranges: bytes
ETag: "916027669"
Last-Modified: Thu, 03 Apr 2014 23:10:13 GMT
Content-Length: 12
Connection: close
Date: Mon, 25 Aug 2014 16:00:36 GMT
Server: EC2ws

10.250.5.124




On Aug 25, 2014, at 5:32 AM, Sebastien Goasguen <runseb@gmail.com> wrote:

> 
> On Aug 25, 2014, at 8:28 AM, Sebastien Goasguen <runseb@gmail.com> wrote:
> 
>> 
>> On Aug 25, 2014, at 8:26 AM, Wido den Hollander <wido@widodh.nl> wrote:
>> 
>>> On 08/25/2014 02:25 PM, Sebastien Goasguen wrote:
>>>> 
>>>> On Aug 25, 2014, at 8:16 AM, Wido den Hollander <wido@widodh.nl> wrote:
>>>> 
>>>>> On 08/25/2014 01:33 PM, Nux! wrote:
>>>>>> Thanks Erik!
>>>>>> 
>>>>> 
>>>>> Indeed!
>>>>> 
>>>>>> Hopefully this change will be incorporated soon so we don't need
to patch cloud-init.
>>>>>> 
>>>>> 
>>>>> I came up with a very small patch: https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=commitdiff;h=1499972804b6de4fade5c84436e29f9904165e18
>>>>> 
>>>>> Tested it on my local env and worked fine. Both the old and new URL work
with the same output.
>>>>> 
>>>> 
>>>> thanks folks, I will pull that in 4.3
>>>> 
>>> 
>>> Hmm. I didn't make a separate branch as a hotfix for 4.4, so how do we get this
in 4.4.1 as well?
>>> 
>>> We shouldn't cherry-pick anymore, right?
>> 
>> Ideally no, if you make a hotfix/4.4-7405 branch for it you can ask Daan to merge
it in 4.4 branch
>> 
>> I will also merge it in 4.3
>> 
>> 
> 
> Erick, submit the same patch to review board, so I took it from there and patch 4.3 branch.
> 
> Only 4.4 is missing...
> 
>> 
>>> 
>>> Wido
>>> 
>>>> 
>>>> 
>>>>> Wido
>>>>> 
>>>>>> 
>>>>>> 
>>>>>> --
>>>>>> Sent from the Delta quadrant using Borg technology!
>>>>>> 
>>>>>> Nux!
>>>>>> www.nux.ro
>>>>>> 
>>>>>> 
>>>>>> ----- Original Message -----
>>>>>>> From: "Erik Weber" <terbolous@gmail.com>
>>>>>>> To: "dev" <dev@cloudstack.apache.org>
>>>>>>> Sent: Monday, 25 August, 2014 12:34:10 PM
>>>>>>> Subject: Re: cloud-init issue
>>>>>>> 
>>>>>>> On Mon, Aug 25, 2014 at 1:27 PM, Erik Weber <terbolous@gmail.com>
wrote:
>>>>>>> 
>>>>>>>> On Mon, Aug 25, 2014 at 1:16 PM, Wido den Hollander <wido@widodh.nl>
>>>>>>>> wrote:
>>>>>>>> 
>>>>>>>>> On 08/25/2014 12:12 PM, Sebastien Goasguen wrote:
>>>>>>>>> 
>>>>>>>>>> Folks,
>>>>>>>>>> 
>>>>>>>>>> There is an outstanding issue with cloud-init compatibility.
>>>>>>>>>> The VR serves the instance metadata through a web
server but there is a
>>>>>>>>>> trailing slash issue:
>>>>>>>>>> 
>>>>>>>>>> https://issues.apache.org/jira/browse/CLOUDSTACK-7405
>>>>>>>>>> 
>>>>>>>>>> Does anyone know where the settings for this web
server are located in
>>>>>>>>>> the cloudstack code ?
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>> So I think that is done in systemvm/patches/debian/
>>>>>>>>> config/opt/cloud/bin/vmdata.py
>>>>>>>>> 
>>>>>>>>> It adds a RewriteRule to the .htaccess like:
>>>>>>>>> 
>>>>>>>>> entry = "RewriteRule ^meta-data/(.+)$  ../" + folder
+
>>>>>>>>> "/%{REMOTE_ADDR}/$1 [L,NC,QSA]"
>>>>>>>>> 
>>>>>>>>> I'm not a big mod_rewrite guru however.
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>> Adding a line with "RewriteRule ^meta-data$ ../" + folder
>>>>>>>> +"/%{REMOTE_ADDR}/$1 [L,NC,QSA]"
>>>>>>>> should suffice.
>>>>>>>> 
>>>>>>>> small typo there...
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>>> 
>>>>>>>> Tested on a VR with this config:
>>>>>>>> 
>>>>>>>> RewriteRule ^meta-data/(.+)$  ../metadata/%{REMOTE_ADDR}/$1
[L,NC,QSA]
>>>>>>>> 
>>>>>>>> RewriteRule ^meta-data/$  ../metadata/%{REMOTE_ADDR}/meta-data
[L,NC,QSA]
>>>>>>>> 
>>>>>>>> RewriteRule ^meta-data$  ../metadata/%{REMOTE_ADDR}/meta-data
[L,NC,QSA]
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>> A better solution is probably to make the last slash conditional,
like this:
>>>>>>> RewriteRule ^meta-data/?$  ../metadata/%{REMOTE_ADDR}/meta-data
[L,NC,QSA]
>>>>>>> 
>>>>>>> tested:
>>>>>>> [root@jenkins ~]# curl -I -s 10.30.81.1/latest/meta-data/ | grep
HTTP
>>>>>>> 
>>>>>>> HTTP/1.1 200 OK
>>>>>>> 
>>>>>>> [root@jenkins ~]# curl -I -s 10.30.81.1/latest/meta-data | grep
HTTP
>>>>>>> 
>>>>>>> HTTP/1.1 200 OK
>>>>>>> 
>>>>>>> Erik


Mime
View raw message