yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #21222
[Bug 972102] Re: Set server metadata does not work
** No longer affects: nova/diablo
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/972102
Title:
Set server metadata does not work
Status in OpenStack Compute (Nova):
Fix Released
Bug description:
A fresh git clone of python-novaclient fails to set metadata on a live server:
$ nova meta 2966 set mykey="value"
ERROR:
$
Doing the same from within python directly, I get the following error:
>>> s = cs.servers.list()
>>> s
<Server: meta test>
>>> cs.servers.set_meta(s, {'py': 'py shell'})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "novaclient/v1_1/servers.py", line 572, in set_meta
body, "metadata")
File "novaclient/base.py", line 157, in _create
resp, body = self.api.client.post(url, body=body)
File "novaclient/client.py", line 139, in post
return self._cs_request(url, 'POST', **kwargs)
File "novaclient/client.py", line 124, in _cs_request
**kwargs)
File "novaclient/client.py", line 107, in request
raise exceptions.from_response(resp, body)
novaclient.exceptions.NotFound: Server does not exist (HTTP 404)
Twiddling with the code, if set_meta method in servers.py (v1.1) is changed to use server.id directly (vs. base.geid(server) which returns uuid), the metadata gets set.
However, if the same is attempted from within python, an
AttributeError is thrown (see below). I've spent a few hours looking
at it now and have no explanation why is this happening. My python
code is identical to what's in do_meta method in shell.py (called when
the cmd line command is used) and direct python code comes back with
the error while the do_meta method completes correctly? Running the
python code does in fact set the metadata field before raising the
error.
Here is the shell output:
$ python
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> USER = 'username'
>>> PASS = 'password'
>>> TENANT = 'tenant'
>>> AUTH_URL = 'keystone URL'
>>> from novaclient.v1_1 import client
cs = client.Client(username=USER, api_key=PASS, project_id=TENANT, auth_url=AUTH_URL, region_name="Melbourne", service_name="nova", service_type="compute")
cs.authenticate()
ss = cs.servers.list()
s = ss[0]
cs.servers.set_meta(s, {'py2': 'py2 shell'})
>>> cs = client.Client(username=USER, api_key=PASS, project_id=TENANT, auth_url=AUTH_URL, region_name="Melbourne", service_name="nova", service_type="compute")
>>> cs.authenticate()
>>> ss = cs.servers.list()
>>> s = ss[0]
>>> cs.servers.set_meta(s, {'py': 'py shell'})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "novaclient/v1_1/servers.py", line 35, in __repr__
return "<Server: %s>" % self.name
File "novaclient/base.py", line 328, in __getattr__
self.get()
File "novaclient/base.py", line 347, in get
new = self.manager.get(self.id)
File "novaclient/base.py", line 331, in __getattr__
raise AttributeError(k)
AttributeError: id
>>>
In summary, there's a bug with setting metadata to begin with. The
second python issue I noted may be a separate problem but still does
not work.
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/972102/+subscriptions