Huh! I ve solved my problem with Missing imageRef attribute (HTTP 400). It was my blot.
Variable NOVA_VERSION were 2.0. I change it to 1.1 and all was good. 2011/9/14 Roman Sokolkov <[email protected]> > Carlo Impagliazzo, in my case this working good: > > >>> from novaclient.v1_1 import client > >>> nt = client.Client('admin', 'xxx', 'project', ' > http://127.0.0.1:5000/v2.0/') > >>> nt.images.list() > [<Image: ub2>, <Image: ub>, <Image: f14-64>] > > # nova --debug boot test --flavor 1 --image 1 > connect: (127.0.0.1, 5000) > send: 'POST /v2.0/tokens HTTP/1.1\r\nHost: 127.0.0.1:5000\r\nContent-Length: > 88\r\ncontent-type: application/json\r\naccept-encoding: gzip, > deflate\r\nuser-agent: python-novaclient\r\n\r\n{"passwordCredentials": > {"username": "admin", "password": "xxx", "tenantId": "project"}}' > reply: 'HTTP/1.1 200 OK\r\n' > header: Content-Type: application/json; charset=UTF-8 > header: Content-Length: 1236 > header: Date: Wed, 14 Sep 2011 15:20:42 GMT > connect: (127.0.0.1, 8774) > send: u'POST /v1.1/sgu/servers HTTP/1.1\r\nHost: > 127.0.0.1:8774\r\nContent-Length: > 91\r\nx-auth-project-id: sgu\r\nx-auth-token: 999888777666\r\ncontent-type: > application/json\r\naccept-encoding: gzip, deflate\r\nuser-agent: > python-novaclient\r\n\r\n{"server": {"min_count": 1, "flavorId": "1", > "max_count": 1, "name": "test", "imageId": 1}}' > reply: 'HTTP/1.1 400 Bad Request\r\n' > header: Content-Length: 70 > header: Content-Type: application/json; charset=UTF-8 > header: Date: Wed, 14 Sep 2011 15:20:42 GMT > Traceback (most recent call last): > File "/usr/bin/nova", line 9, in <module> > load_entry_point('python-novaclient==2.6.4', 'console_scripts', > 'nova')() > File "/usr/lib/python2.7/site-packages/novaclient/shell.py", line 219, in > main > OpenStackComputeShell().main(sys.argv[1:]) > File "/usr/lib/python2.7/site-packages/novaclient/shell.py", line 182, in > main > args.func(self.cs, args) > File "/usr/lib/python2.7/site-packages/novaclient/v1_0/shell.py", line > 194, in do_boot > max_count=max_count) > File "/usr/lib/python2.7/site-packages/novaclient/v1_0/servers.py", line > 284, in create > min_count=min_count, max_count=max_count) > File "/usr/lib/python2.7/site-packages/novaclient/v1_0/base.py", line > 100, in _boot > return_raw=return_raw) > File "/usr/lib/python2.7/site-packages/novaclient/base.py", line 83, in > _create > resp, body = self.api.client.post(url, body=body) > File "/usr/lib/python2.7/site-packages/novaclient/client.py", line 124, > in post > return self._cs_request(url, 'POST', **kwargs) > File "/usr/lib/python2.7/site-packages/novaclient/client.py", line 108, > in _cs_request > **kwargs) > File "/usr/lib/python2.7/site-packages/novaclient/client.py", line 91, in > request > raise exceptions.from_response(resp, body) > novaclient.exceptions.BadRequest: Missing imageRef attribute (HTTP 400) > > > 2011/9/14 Carlo Impagliazzo <[email protected]> > >> Alle mercoledì 14 settembre 2011, Carlo Impagliazzo ha scritto: >> > Alle mercoledì 14 settembre 2011, Roman Sokolkov ha scritto: >> > > Hi! I have problem. I use keystone from trunk, python-novaclient 2.6.4 >> > > >> > > # nova --debug list >> > > connect: (127.0.0.1, 5000) >> > > send: 'POST /v2.0/tokens HTTP/1.1\r\nHost: >> > > 127.0.0.1:5000\r\nContent-Length: 88\r\ncontent-type: >> > > application/json\r\naccept-encoding: gzip, >> > > deflate\r\nuser-agent: >> python-novaclient\r\n\r\n{"passwordCredentials": >> > > {"username": "admin", "password": "xxx", "tenantId": "1234"}}' >> > > reply: 'HTTP/1.1 200 OK\r\n' >> > > header: Content-Type: application/json; charset=UTF-8 >> > > header: Content-Length: 1236 >> > > header: Date: Wed, 14 Sep 2011 13:18:45 GMT >> > > Traceback (most recent call last): >> > > File "/usr/bin/nova", line 9, in <module> >> > > load_entry_point('python-novaclient==2.6.4', 'console_scripts', >> > > 'nova')() >> > > File "/usr/lib/python2.7/site-packages/novaclient/shell.py", line >> 219, >> > > in main >> > > OpenStackComputeShell().main(sys.argv[1:]) >> > > File "/usr/lib/python2.7/site-packages/novaclient/shell.py", line >> 176, >> > > in main >> > > self.cs.authenticate() >> > > File "/usr/lib/python2.7/site-packages/novaclient/v1_0/client.py", >> line >> > > 57, in authenticate >> > > self.client.authenticate() >> > > File "/usr/lib/python2.7/site-packages/novaclient/client.py", line >> 144, >> > > in authenticate >> > > auth_url = self._v2_auth(auth_url) >> > > File "/usr/lib/python2.7/site-packages/novaclient/client.py", line >> 189, >> > > in _v2_auth >> > > service_catalog.ServiceCatalog(body) >> > > File >> "/usr/lib/python2.7/site-packages/novaclient/service_catalog.py", >> > > line 90, in __init__ >> > > super(ServiceCatalog, self).__init__(resource) >> > > File >> "/usr/lib/python2.7/site-packages/novaclient/service_catalog.py", >> > > line 45, in __init__ >> > > attribute = [res(x) for x in val] >> > > File >> "/usr/lib/python2.7/site-packages/novaclient/service_catalog.py", >> > > line 41, in __init__ >> > > for res_key, res_value in value.items(): >> > > AttributeError: 'unicode' object has no attribute 'items' >> > >> > I have the same problem, I've tried to fix it but it's a little >> difficult >> > understand the logic behind the management of the data structure. >> > >> > having a structure like the linked one it happens a kinky comparison: >> > >> > 'nova' in { 'publicURL': u'http://nova.publicinternets.com/v1.1/1234' >> } >> > >> > and then...it dumps because >> > value is 'http://nova.publicinternets.com/v1.1/1234' ( and so...like >> a >> > string obj it hasn't an items method ) >> > >> > >> > Is the comparison logically right? isn't it too weak ? >> > >> > >> > This is the link with datastructure : >> > http://paste.openstack.org/show/2442/ >> > >> > Carlo >> > >> > >> > >> > >> > _______________________________________________ >> > Mailing list: https://launchpad.net/~openstack >> > Post to : [email protected] >> > Unsubscribe : https://launchpad.net/~openstack >> > More help : https://help.launchpad.net/ListHelp >> >> the patch suggested by Sandy works like a charm, it remains the question >> about >> the strange comparison :-/ >> >> >> Now I have another problem, >> >> using a python script like this: >> NOVA_PROJECT_ID=1234 >> NOVA_USERNAME="joeuser" >> NOVA_URL='http://192.168.0.100:5000/v2.0/' >> NOVA_API_KEY='fdf50e55-8f02-4aac-ac02-0adcb088325d' >> from novaclient.v1_1 import client >> nt = client.Client(NOVA_USERNAME, 'secrete', NOVA_PROJECT_ID, NOVA_URL) >> >> >> with this statement I obtain: >> >> nt.images.list() >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> >> File >> "/usr/lib/python2.6/site-packages/python_novaclient-2.6.4-py2.6.egg/novaclient/v1_1/images.py", >> line 45, in list >> return self._list("/images/detail", "images") >> >> File >> "/usr/lib/python2.6/site-packages/python_novaclient-2.6.4-py2.6.egg/novaclient/base.py", >> line 66, in _list >> resp, body = self.api.client.get(url) >> >> File >> "/usr/lib/python2.6/site-packages/python_novaclient-2.6.4-py2.6.egg/novaclient/client.py", >> line 126, in get >> return self._cs_request(url, 'GET', **kwargs) >> >> File >> "/usr/lib/python2.6/site-packages/python_novaclient-2.6.4-py2.6.egg/novaclient/client.py", >> line 113, in _cs_request >> **kwargs) >> >> File >> "/usr/lib/python2.6/site-packages/python_novaclient-2.6.4-py2.6.egg/novaclient/client.py", >> line 96, in request >> raise exceptions.from_response(resp, body) >> novaclient.exceptions.BadRequest: n/a (HTTP 400 >> >> Any suggestions? >> Carlo >> >> >> >> >> >> _______________________________________________ >> Mailing list: https://launchpad.net/~openstack >> Post to : [email protected] >> Unsubscribe : https://launchpad.net/~openstack >> More help : https://help.launchpad.net/ListHelp >> > >
_______________________________________________ Mailing list: https://launchpad.net/~openstack Post to : [email protected] Unsubscribe : https://launchpad.net/~openstack More help : https://help.launchpad.net/ListHelp

