You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@libcloud.apache.org by Jay Doane <ja...@almery.com> on 2012/02/16 06:06:35 UTC

Anyone using OpenStack driver to access devstack deployment?

Greetings,

I followed the directions at http://devstack.org/guides/single-vm.html to
deploy OpenStack on a single host, and everything works as expected from
the web interface.

I would like to access my OpenStack dev environment with (a recent dev
version oflibcloud, but seem to only be able to do so using the Eucalyptus
driver; the OpenStack driver gives me the following error (running the
attached code):

jay@alu:~/proj/genforma/libcloud.git$ python stack_test.py
[<NodeImage: id=aki-00000001, name=None
(oneiric-server-cloudimg-amd64-kernel), driver=Eucalyptus  ...>,
<NodeImage: id=ami-00000002, name=None (oneiric-server-cloudimg-amd64),
driver=Eucalyptus  ...>]
Traceback (most recent call last):
  File "stack_test.py", line 23, in <module>
    print openstack_connect().list_images()
  File "stack_test.py", line 13, in openstack_connect
    ex_force_base_url='http://%s:8774' % STACK_HOST)
  File
"/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
line 795, in __init__
    super(OpenStack_1_1_NodeDriver, self).__init__(*args, **kwargs)
  File "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/base.py",
line 397, in __init__
    api_version=api_version)
  File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
line 802, in __init__
    self.connection.connect()
  File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
line 427, in connect
    if getattr(self, 'base_url', None) and base_url == None:
  File
"/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py", line
249, in base_url
    return self._get_base_url(url_key=self._url_key)
  File
"/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py", line
254, in _get_base_url
    self._populate_hosts_and_request_paths()
  File
"/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py", line
300, in _populate_hosts_and_request_paths
    self.tenant_ids[service_type] = service['endpoints'][0]['tenantId']
KeyError: 'tenantId'

Has anyone else successfully used the libcloud OpenStack driver to access a
recent devstack deployment?  Or is there something obviously wrong with how
I'm instantiating my OpenStack driver?

Thanks,
Jay

Re: Anyone using OpenStack driver to access devstack deployment?

Posted by Jay Doane <ja...@almery.com>.
2012/3/28 Tomaž Muraus <to...@apache.org>

>
> Like you have noticed, version 0.9.0 which should be
> released in the upcoming days makes the default OpenStack driver work with
> trystack.org without needing to change the service_name attribute.
>

Hi Tomaž,

In that case, there's a comment on line 130 of
libcloud/compute/drivers/openstack.py that says

    # default config for http://devstack.org/

which is somewhat misleading.

Which version of devstack are you using?


It's a very recent version, maybe a couple days old now.

stack@devstack-2:~/devstack/tools$ ./info.sh
git|devstack|master[17ff976]
...

It would be great if you could
> provide a reference to the docs which says that the new compute endpoint is
> now called "Compute Service".


I can't really speak to the documentation of devstack, but file you want to
look at is devstack/files/default_catalog.templates, line 12


> I think that the default endpoint in the
> current release is still named "nova" and that is why I will wait with
> merging your patch.
>

I may have been "nova" until commit [a96a418] on February 2, where
the above mentioned file was first added to devstack.

In any case, I will add your example to the documentation -
> http://libcloud.apache.org/docs/compute-examples.html.
>

Thanks!
Jay


> On Wed, Mar 28, 2012 at 2:09 PM, Jay Doane <ja...@almery.com> wrote:
>
> > I wanted to follow up this thread with a solution.
> >
> > Thanks to the recently implemented updates in the openstack driver, I'm
> now
> > able to access a vanilla devstack deployment from libcloud.  With
> debugging
> > on, it was useful to compare the requests and responses from the
> (working)
> > python-novaclient library to the (not working, for me at the time)
> libcloud
> > library.
> >
> > One key issue I was having is that the default compute service names were
> > mismatched, with libcloud using the older "nova" instead of the more
> recent
> > "Compute Service".  I've submitted a pull request which addresses that
> > issue.
> >
> > Below is a short script showing how I am able to access host
> "devstack-2",
> > defined in my /etc/hosts file.
> >
> > Cheers,
> > Jay
> >
> > # List the nodes on a devstack installation
> > from libcloud.compute.types import Provider
> > from libcloud.compute.providers import get_driver
> >
> > STACKHOST = 'devstack-2'
> > TENANTNAME = 'demo'
> > USERNAME = 'demo'
> > PASSWORD = 'password'
> >
> > def devstack_driver():
> >    Driver = get_driver(Provider.OPENSTACK)
> >    driver = Driver(USERNAME, PASSWORD, host=STACKHOST, port=8774,
> > secure=False,
> >                    ex_tenant_name=TENANTNAME,
> >                    ex_force_auth_version='2.0_password',
> >                    ex_force_service_name='Compute Service',
> >                    ex_force_auth_url='http://%s:5000/v2.0/' % STACKHOST)
> >    return driver
> >
> > print devstack_driver().list_nodes()
> >
> >
> > 2012/2/20 Tomaž Muraus <to...@apache.org>
> >
> > > You need to re-run stack.sh after putting those lines in your localrc.
> > >
> > > On Mon, Feb 20, 2012 at 4:28 PM, Jay Doane <ja...@almery.com> wrote:
> > >
> > > > 2012/2/20 Tomaž Muraus <to...@apache.org>
> > > >
> > > > >
> > > > > One thing I would still try is using a stable release instead of
> the
> > > > latest
> > > > > master - e.g. essex:
> > > > >
> > > > > : How do I run a specific OpenStack milestone?
> > > > > > A: OpenStack milestones have tags set in the git repo. Set the
> > > > > appropriate
> > > > > > tag in the *_BRANCH variables in localrc. Swift is on its own
> > release
> > > > > > schedule so pick a tag in the Swift repo that is just before the
> > > > > milestone
> > > > > > release. For example:
> > > > > > GLANCE_BRANCH=essex-3
> > > > > > HORIZON_BRANCH=essex-3
> > > > > > KEYSTONE_BRANCH=essex-3
> > > > > > KEYSTONECLIENT_BRANCH=essex-3
> > > > > > NOVA_BRANCH=essex-3
> > > > > > NOVACLIENT_BRANCH=essex-3
> > > > > > QUANTUM_BRANCH=essex-3
> > > > > > QUANTUM_CLIENT_BRANCH=essex-3
> > > > > > SWIFT_BRANCH=1.4.5
> > > >
> > > >
> > > > Good idea.  I added those lines to my localrc, but still got the same
> > 500
> > > > error as before.
> > > >
> > > > Also, I'm seeing the following stack trace from the stack's n-api
> > > process:
> > > >
> > > > 2012-02-20 15:53:44 WARNING nova.api.ec2 [-] Configuration setting
> for
> > > > keystone_ec2_url needs to be updated to /tokens only. The /ec2 prefix
> > is
> > > > being deprecated
> > > > 2012-02-20 15:53:44 ERROR nova.api.ec2 [-] FaultWrapper: Extra data:
> > > line 1
> > > > column 4 - line 5 column 4 (char 4 - 43)
> > > > (nova.api.ec2): TRACE: Traceback (most recent call last):
> > > > (nova.api.ec2): TRACE:   File
> > "/opt/stack/nova/nova/api/ec2/__init__.py",
> > > > line 89, in __call__
> > > > (nova.api.ec2): TRACE:     return req.get_response(self.application)
> > > > (nova.api.ec2): TRACE:   File
> > > > "/usr/lib/python2.7/dist-packages/webob/request.py", line 1053, in
> > > > get_response
> > > > (nova.api.ec2): TRACE:     application, catch_exc_info=False)
> > > > (nova.api.ec2): TRACE:   File
> > > > "/usr/lib/python2.7/dist-packages/webob/request.py", line 1022, in
> > > > call_application
> > > > (nova.api.ec2): TRACE:     app_iter = application(self.environ,
> > > > start_response)
> > > > (nova.api.ec2): TRACE:   File
> > > > "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in
> __call__
> > > > (nova.api.ec2): TRACE:     resp = self.call_func(req, *args,
> > > **self.kwargs)
> > > > (nova.api.ec2): TRACE:   File
> > > > "/usr/lib/python2.7/dist-packages/webob/dec.py", line 208, in
> call_func
> > > > (nova.api.ec2): TRACE:     return self.func(req, *args, **kwargs)
> > > > (nova.api.ec2): TRACE:   File
> > "/opt/stack/nova/nova/api/ec2/__init__.py",
> > > > line 101, in __call__
> > > > (nova.api.ec2): TRACE:     rv = req.get_response(self.application)
> > > > (nova.api.ec2): TRACE:   File
> > > > "/usr/lib/python2.7/dist-packages/webob/request.py", line 1053, in
> > > > get_response
> > > > (nova.api.ec2): TRACE:     application, catch_exc_info=False)
> > > > (nova.api.ec2): TRACE:   File
> > > > "/usr/lib/python2.7/dist-packages/webob/request.py", line 1022, in
> > > > call_application
> > > > (nova.api.ec2): TRACE:     app_iter = application(self.environ,
> > > > start_response)
> > > > (nova.api.ec2): TRACE:   File
> > > > "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in
> __call__
> > > > (nova.api.ec2): TRACE:     resp = self.call_func(req, *args,
> > > **self.kwargs)
> > > > (nova.api.ec2): TRACE:   File
> > > > "/usr/lib/python2.7/dist-packages/webob/dec.py", line 208, in
> call_func
> > > > (nova.api.ec2): TRACE:     return self.func(req, *args, **kwargs)
> > > > (nova.api.ec2): TRACE:   File
> > "/opt/stack/nova/nova/api/ec2/__init__.py",
> > > > line 243, in __call__
> > > > (nova.api.ec2): TRACE:     result = utils.loads(response)
> > > > (nova.api.ec2): TRACE:   File "/opt/stack/nova/nova/utils.py", line
> > 757,
> > > in
> > > > loads
> > > > (nova.api.ec2): TRACE:     return json.loads(s)
> > > > (nova.api.ec2): TRACE:   File "/usr/lib/python2.7/json/__init__.py",
> > line
> > > > 326, in loads
> > > > (nova.api.ec2): TRACE:     return _default_decoder.decode(s)
> > > > (nova.api.ec2): TRACE:   File "/usr/lib/python2.7/json/decoder.py",
> > line
> > > > 369, in decode
> > > > (nova.api.ec2): TRACE:     raise ValueError(errmsg("Extra data", s,
> > end,
> > > > len(s)))
> > > > (nova.api.ec2): TRACE: ValueError: Extra data: line 1 column 4 -
> line 5
> > > > column 4 (char 4 - 43)
> > > > (nova.api.ec2): TRACE:
> > > >
> > >
> >
>

Re: Anyone using OpenStack driver to access devstack deployment?

Posted by Tomaž Muraus <to...@apache.org>.
Hi Jay,

Thanks for the update. Like you have noticed, version 0.9.0 which should be
released in the upcoming days makes the default OpenStack driver work with
trystack.org without needing to change the service_name attribute.

Which version of devstack are you using? It would be great if you could
provide a reference to the docs which says that the new compute endpoint is
now called "Compute Service". I think that the default endpoint in the
current release is still named "nova" and that is why I will wait with
merging your patch.

In any case, I will add your example to the documentation -
http://libcloud.apache.org/docs/compute-examples.html.

On Wed, Mar 28, 2012 at 2:09 PM, Jay Doane <ja...@almery.com> wrote:

> I wanted to follow up this thread with a solution.
>
> Thanks to the recently implemented updates in the openstack driver, I'm now
> able to access a vanilla devstack deployment from libcloud.  With debugging
> on, it was useful to compare the requests and responses from the (working)
> python-novaclient library to the (not working, for me at the time) libcloud
> library.
>
> One key issue I was having is that the default compute service names were
> mismatched, with libcloud using the older "nova" instead of the more recent
> "Compute Service".  I've submitted a pull request which addresses that
> issue.
>
> Below is a short script showing how I am able to access host "devstack-2",
> defined in my /etc/hosts file.
>
> Cheers,
> Jay
>
> # List the nodes on a devstack installation
> from libcloud.compute.types import Provider
> from libcloud.compute.providers import get_driver
>
> STACKHOST = 'devstack-2'
> TENANTNAME = 'demo'
> USERNAME = 'demo'
> PASSWORD = 'password'
>
> def devstack_driver():
>    Driver = get_driver(Provider.OPENSTACK)
>    driver = Driver(USERNAME, PASSWORD, host=STACKHOST, port=8774,
> secure=False,
>                    ex_tenant_name=TENANTNAME,
>                    ex_force_auth_version='2.0_password',
>                    ex_force_service_name='Compute Service',
>                    ex_force_auth_url='http://%s:5000/v2.0/' % STACKHOST)
>    return driver
>
> print devstack_driver().list_nodes()
>
>
> 2012/2/20 Tomaž Muraus <to...@apache.org>
>
> > You need to re-run stack.sh after putting those lines in your localrc.
> >
> > On Mon, Feb 20, 2012 at 4:28 PM, Jay Doane <ja...@almery.com> wrote:
> >
> > > 2012/2/20 Tomaž Muraus <to...@apache.org>
> > >
> > > >
> > > > One thing I would still try is using a stable release instead of the
> > > latest
> > > > master - e.g. essex:
> > > >
> > > > : How do I run a specific OpenStack milestone?
> > > > > A: OpenStack milestones have tags set in the git repo. Set the
> > > > appropriate
> > > > > tag in the *_BRANCH variables in localrc. Swift is on its own
> release
> > > > > schedule so pick a tag in the Swift repo that is just before the
> > > > milestone
> > > > > release. For example:
> > > > > GLANCE_BRANCH=essex-3
> > > > > HORIZON_BRANCH=essex-3
> > > > > KEYSTONE_BRANCH=essex-3
> > > > > KEYSTONECLIENT_BRANCH=essex-3
> > > > > NOVA_BRANCH=essex-3
> > > > > NOVACLIENT_BRANCH=essex-3
> > > > > QUANTUM_BRANCH=essex-3
> > > > > QUANTUM_CLIENT_BRANCH=essex-3
> > > > > SWIFT_BRANCH=1.4.5
> > >
> > >
> > > Good idea.  I added those lines to my localrc, but still got the same
> 500
> > > error as before.
> > >
> > > Also, I'm seeing the following stack trace from the stack's n-api
> > process:
> > >
> > > 2012-02-20 15:53:44 WARNING nova.api.ec2 [-] Configuration setting for
> > > keystone_ec2_url needs to be updated to /tokens only. The /ec2 prefix
> is
> > > being deprecated
> > > 2012-02-20 15:53:44 ERROR nova.api.ec2 [-] FaultWrapper: Extra data:
> > line 1
> > > column 4 - line 5 column 4 (char 4 - 43)
> > > (nova.api.ec2): TRACE: Traceback (most recent call last):
> > > (nova.api.ec2): TRACE:   File
> "/opt/stack/nova/nova/api/ec2/__init__.py",
> > > line 89, in __call__
> > > (nova.api.ec2): TRACE:     return req.get_response(self.application)
> > > (nova.api.ec2): TRACE:   File
> > > "/usr/lib/python2.7/dist-packages/webob/request.py", line 1053, in
> > > get_response
> > > (nova.api.ec2): TRACE:     application, catch_exc_info=False)
> > > (nova.api.ec2): TRACE:   File
> > > "/usr/lib/python2.7/dist-packages/webob/request.py", line 1022, in
> > > call_application
> > > (nova.api.ec2): TRACE:     app_iter = application(self.environ,
> > > start_response)
> > > (nova.api.ec2): TRACE:   File
> > > "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
> > > (nova.api.ec2): TRACE:     resp = self.call_func(req, *args,
> > **self.kwargs)
> > > (nova.api.ec2): TRACE:   File
> > > "/usr/lib/python2.7/dist-packages/webob/dec.py", line 208, in call_func
> > > (nova.api.ec2): TRACE:     return self.func(req, *args, **kwargs)
> > > (nova.api.ec2): TRACE:   File
> "/opt/stack/nova/nova/api/ec2/__init__.py",
> > > line 101, in __call__
> > > (nova.api.ec2): TRACE:     rv = req.get_response(self.application)
> > > (nova.api.ec2): TRACE:   File
> > > "/usr/lib/python2.7/dist-packages/webob/request.py", line 1053, in
> > > get_response
> > > (nova.api.ec2): TRACE:     application, catch_exc_info=False)
> > > (nova.api.ec2): TRACE:   File
> > > "/usr/lib/python2.7/dist-packages/webob/request.py", line 1022, in
> > > call_application
> > > (nova.api.ec2): TRACE:     app_iter = application(self.environ,
> > > start_response)
> > > (nova.api.ec2): TRACE:   File
> > > "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
> > > (nova.api.ec2): TRACE:     resp = self.call_func(req, *args,
> > **self.kwargs)
> > > (nova.api.ec2): TRACE:   File
> > > "/usr/lib/python2.7/dist-packages/webob/dec.py", line 208, in call_func
> > > (nova.api.ec2): TRACE:     return self.func(req, *args, **kwargs)
> > > (nova.api.ec2): TRACE:   File
> "/opt/stack/nova/nova/api/ec2/__init__.py",
> > > line 243, in __call__
> > > (nova.api.ec2): TRACE:     result = utils.loads(response)
> > > (nova.api.ec2): TRACE:   File "/opt/stack/nova/nova/utils.py", line
> 757,
> > in
> > > loads
> > > (nova.api.ec2): TRACE:     return json.loads(s)
> > > (nova.api.ec2): TRACE:   File "/usr/lib/python2.7/json/__init__.py",
> line
> > > 326, in loads
> > > (nova.api.ec2): TRACE:     return _default_decoder.decode(s)
> > > (nova.api.ec2): TRACE:   File "/usr/lib/python2.7/json/decoder.py",
> line
> > > 369, in decode
> > > (nova.api.ec2): TRACE:     raise ValueError(errmsg("Extra data", s,
> end,
> > > len(s)))
> > > (nova.api.ec2): TRACE: ValueError: Extra data: line 1 column 4 - line 5
> > > column 4 (char 4 - 43)
> > > (nova.api.ec2): TRACE:
> > >
> >
>

Re: Anyone using OpenStack driver to access devstack deployment?

Posted by Jay Doane <ja...@almery.com>.
I wanted to follow up this thread with a solution.

Thanks to the recently implemented updates in the openstack driver, I'm now
able to access a vanilla devstack deployment from libcloud.  With debugging
on, it was useful to compare the requests and responses from the (working)
python-novaclient library to the (not working, for me at the time) libcloud
library.

One key issue I was having is that the default compute service names were
mismatched, with libcloud using the older "nova" instead of the more recent
"Compute Service".  I've submitted a pull request which addresses that
issue.

Below is a short script showing how I am able to access host "devstack-2",
defined in my /etc/hosts file.

Cheers,
Jay

# List the nodes on a devstack installation
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver

STACKHOST = 'devstack-2'
TENANTNAME = 'demo'
USERNAME = 'demo'
PASSWORD = 'password'

def devstack_driver():
    Driver = get_driver(Provider.OPENSTACK)
    driver = Driver(USERNAME, PASSWORD, host=STACKHOST, port=8774,
secure=False,
                    ex_tenant_name=TENANTNAME,
                    ex_force_auth_version='2.0_password',
                    ex_force_service_name='Compute Service',
                    ex_force_auth_url='http://%s:5000/v2.0/' % STACKHOST)
    return driver

print devstack_driver().list_nodes()


2012/2/20 Tomaž Muraus <to...@apache.org>

> You need to re-run stack.sh after putting those lines in your localrc.
>
> On Mon, Feb 20, 2012 at 4:28 PM, Jay Doane <ja...@almery.com> wrote:
>
> > 2012/2/20 Tomaž Muraus <to...@apache.org>
> >
> > >
> > > One thing I would still try is using a stable release instead of the
> > latest
> > > master - e.g. essex:
> > >
> > > : How do I run a specific OpenStack milestone?
> > > > A: OpenStack milestones have tags set in the git repo. Set the
> > > appropriate
> > > > tag in the *_BRANCH variables in localrc. Swift is on its own release
> > > > schedule so pick a tag in the Swift repo that is just before the
> > > milestone
> > > > release. For example:
> > > > GLANCE_BRANCH=essex-3
> > > > HORIZON_BRANCH=essex-3
> > > > KEYSTONE_BRANCH=essex-3
> > > > KEYSTONECLIENT_BRANCH=essex-3
> > > > NOVA_BRANCH=essex-3
> > > > NOVACLIENT_BRANCH=essex-3
> > > > QUANTUM_BRANCH=essex-3
> > > > QUANTUM_CLIENT_BRANCH=essex-3
> > > > SWIFT_BRANCH=1.4.5
> >
> >
> > Good idea.  I added those lines to my localrc, but still got the same 500
> > error as before.
> >
> > Also, I'm seeing the following stack trace from the stack's n-api
> process:
> >
> > 2012-02-20 15:53:44 WARNING nova.api.ec2 [-] Configuration setting for
> > keystone_ec2_url needs to be updated to /tokens only. The /ec2 prefix is
> > being deprecated
> > 2012-02-20 15:53:44 ERROR nova.api.ec2 [-] FaultWrapper: Extra data:
> line 1
> > column 4 - line 5 column 4 (char 4 - 43)
> > (nova.api.ec2): TRACE: Traceback (most recent call last):
> > (nova.api.ec2): TRACE:   File "/opt/stack/nova/nova/api/ec2/__init__.py",
> > line 89, in __call__
> > (nova.api.ec2): TRACE:     return req.get_response(self.application)
> > (nova.api.ec2): TRACE:   File
> > "/usr/lib/python2.7/dist-packages/webob/request.py", line 1053, in
> > get_response
> > (nova.api.ec2): TRACE:     application, catch_exc_info=False)
> > (nova.api.ec2): TRACE:   File
> > "/usr/lib/python2.7/dist-packages/webob/request.py", line 1022, in
> > call_application
> > (nova.api.ec2): TRACE:     app_iter = application(self.environ,
> > start_response)
> > (nova.api.ec2): TRACE:   File
> > "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
> > (nova.api.ec2): TRACE:     resp = self.call_func(req, *args,
> **self.kwargs)
> > (nova.api.ec2): TRACE:   File
> > "/usr/lib/python2.7/dist-packages/webob/dec.py", line 208, in call_func
> > (nova.api.ec2): TRACE:     return self.func(req, *args, **kwargs)
> > (nova.api.ec2): TRACE:   File "/opt/stack/nova/nova/api/ec2/__init__.py",
> > line 101, in __call__
> > (nova.api.ec2): TRACE:     rv = req.get_response(self.application)
> > (nova.api.ec2): TRACE:   File
> > "/usr/lib/python2.7/dist-packages/webob/request.py", line 1053, in
> > get_response
> > (nova.api.ec2): TRACE:     application, catch_exc_info=False)
> > (nova.api.ec2): TRACE:   File
> > "/usr/lib/python2.7/dist-packages/webob/request.py", line 1022, in
> > call_application
> > (nova.api.ec2): TRACE:     app_iter = application(self.environ,
> > start_response)
> > (nova.api.ec2): TRACE:   File
> > "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
> > (nova.api.ec2): TRACE:     resp = self.call_func(req, *args,
> **self.kwargs)
> > (nova.api.ec2): TRACE:   File
> > "/usr/lib/python2.7/dist-packages/webob/dec.py", line 208, in call_func
> > (nova.api.ec2): TRACE:     return self.func(req, *args, **kwargs)
> > (nova.api.ec2): TRACE:   File "/opt/stack/nova/nova/api/ec2/__init__.py",
> > line 243, in __call__
> > (nova.api.ec2): TRACE:     result = utils.loads(response)
> > (nova.api.ec2): TRACE:   File "/opt/stack/nova/nova/utils.py", line 757,
> in
> > loads
> > (nova.api.ec2): TRACE:     return json.loads(s)
> > (nova.api.ec2): TRACE:   File "/usr/lib/python2.7/json/__init__.py", line
> > 326, in loads
> > (nova.api.ec2): TRACE:     return _default_decoder.decode(s)
> > (nova.api.ec2): TRACE:   File "/usr/lib/python2.7/json/decoder.py", line
> > 369, in decode
> > (nova.api.ec2): TRACE:     raise ValueError(errmsg("Extra data", s, end,
> > len(s)))
> > (nova.api.ec2): TRACE: ValueError: Extra data: line 1 column 4 - line 5
> > column 4 (char 4 - 43)
> > (nova.api.ec2): TRACE:
> >
>

Re: Anyone using OpenStack driver to access devstack deployment?

Posted by Jay Doane <ja...@almery.com>.
2012/2/20 Tomaž Muraus <to...@apache.org>

> You need to re-run stack.sh after putting those lines in your localrc.
>

Of course.  This is the script I'm using to restart devstack when I reboot
the host:

#!/bin/bash

set +ex
cd ~/devstack
git pull
RECLONE=yes ./stack.sh


>
> On Mon, Feb 20, 2012 at 4:28 PM, Jay Doane <ja...@almery.com> wrote:
>
> > 2012/2/20 Tomaž Muraus <to...@apache.org>
> >
> > >
> > > One thing I would still try is using a stable release instead of the
> > latest
> > > master - e.g. essex:
> > >
> > > : How do I run a specific OpenStack milestone?
> > > > A: OpenStack milestones have tags set in the git repo. Set the
> > > appropriate
> > > > tag in the *_BRANCH variables in localrc. Swift is on its own release
> > > > schedule so pick a tag in the Swift repo that is just before the
> > > milestone
> > > > release. For example:
> > > > GLANCE_BRANCH=essex-3
> > > > HORIZON_BRANCH=essex-3
> > > > KEYSTONE_BRANCH=essex-3
> > > > KEYSTONECLIENT_BRANCH=essex-3
> > > > NOVA_BRANCH=essex-3
> > > > NOVACLIENT_BRANCH=essex-3
> > > > QUANTUM_BRANCH=essex-3
> > > > QUANTUM_CLIENT_BRANCH=essex-3
> > > > SWIFT_BRANCH=1.4.5
> >
> >
> > Good idea.  I added those lines to my localrc, but still got the same 500
> > error as before.
> >
> > Also, I'm seeing the following stack trace from the stack's n-api
> process:
> >
> > 2012-02-20 15:53:44 WARNING nova.api.ec2 [-] Configuration setting for
> > keystone_ec2_url needs to be updated to /tokens only. The /ec2 prefix is
> > being deprecated
> > 2012-02-20 15:53:44 ERROR nova.api.ec2 [-] FaultWrapper: Extra data:
> line 1
> > column 4 - line 5 column 4 (char 4 - 43)
> > (nova.api.ec2): TRACE: Traceback (most recent call last):
> > (nova.api.ec2): TRACE:   File "/opt/stack/nova/nova/api/ec2/__init__.py",
> > line 89, in __call__
> > (nova.api.ec2): TRACE:     return req.get_response(self.application)
> > (nova.api.ec2): TRACE:   File
> > "/usr/lib/python2.7/dist-packages/webob/request.py", line 1053, in
> > get_response
> > (nova.api.ec2): TRACE:     application, catch_exc_info=False)
> > (nova.api.ec2): TRACE:   File
> > "/usr/lib/python2.7/dist-packages/webob/request.py", line 1022, in
> > call_application
> > (nova.api.ec2): TRACE:     app_iter = application(self.environ,
> > start_response)
> > (nova.api.ec2): TRACE:   File
> > "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
> > (nova.api.ec2): TRACE:     resp = self.call_func(req, *args,
> **self.kwargs)
> > (nova.api.ec2): TRACE:   File
> > "/usr/lib/python2.7/dist-packages/webob/dec.py", line 208, in call_func
> > (nova.api.ec2): TRACE:     return self.func(req, *args, **kwargs)
> > (nova.api.ec2): TRACE:   File "/opt/stack/nova/nova/api/ec2/__init__.py",
> > line 101, in __call__
> > (nova.api.ec2): TRACE:     rv = req.get_response(self.application)
> > (nova.api.ec2): TRACE:   File
> > "/usr/lib/python2.7/dist-packages/webob/request.py", line 1053, in
> > get_response
> > (nova.api.ec2): TRACE:     application, catch_exc_info=False)
> > (nova.api.ec2): TRACE:   File
> > "/usr/lib/python2.7/dist-packages/webob/request.py", line 1022, in
> > call_application
> > (nova.api.ec2): TRACE:     app_iter = application(self.environ,
> > start_response)
> > (nova.api.ec2): TRACE:   File
> > "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
> > (nova.api.ec2): TRACE:     resp = self.call_func(req, *args,
> **self.kwargs)
> > (nova.api.ec2): TRACE:   File
> > "/usr/lib/python2.7/dist-packages/webob/dec.py", line 208, in call_func
> > (nova.api.ec2): TRACE:     return self.func(req, *args, **kwargs)
> > (nova.api.ec2): TRACE:   File "/opt/stack/nova/nova/api/ec2/__init__.py",
> > line 243, in __call__
> > (nova.api.ec2): TRACE:     result = utils.loads(response)
> > (nova.api.ec2): TRACE:   File "/opt/stack/nova/nova/utils.py", line 757,
> in
> > loads
> > (nova.api.ec2): TRACE:     return json.loads(s)
> > (nova.api.ec2): TRACE:   File "/usr/lib/python2.7/json/__init__.py", line
> > 326, in loads
> > (nova.api.ec2): TRACE:     return _default_decoder.decode(s)
> > (nova.api.ec2): TRACE:   File "/usr/lib/python2.7/json/decoder.py", line
> > 369, in decode
> > (nova.api.ec2): TRACE:     raise ValueError(errmsg("Extra data", s, end,
> > len(s)))
> > (nova.api.ec2): TRACE: ValueError: Extra data: line 1 column 4 - line 5
> > column 4 (char 4 - 43)
> > (nova.api.ec2): TRACE:
> >
>

Re: Anyone using OpenStack driver to access devstack deployment?

Posted by Tomaž Muraus <to...@apache.org>.
You need to re-run stack.sh after putting those lines in your localrc.

On Mon, Feb 20, 2012 at 4:28 PM, Jay Doane <ja...@almery.com> wrote:

> 2012/2/20 Tomaž Muraus <to...@apache.org>
>
> >
> > One thing I would still try is using a stable release instead of the
> latest
> > master - e.g. essex:
> >
> > : How do I run a specific OpenStack milestone?
> > > A: OpenStack milestones have tags set in the git repo. Set the
> > appropriate
> > > tag in the *_BRANCH variables in localrc. Swift is on its own release
> > > schedule so pick a tag in the Swift repo that is just before the
> > milestone
> > > release. For example:
> > > GLANCE_BRANCH=essex-3
> > > HORIZON_BRANCH=essex-3
> > > KEYSTONE_BRANCH=essex-3
> > > KEYSTONECLIENT_BRANCH=essex-3
> > > NOVA_BRANCH=essex-3
> > > NOVACLIENT_BRANCH=essex-3
> > > QUANTUM_BRANCH=essex-3
> > > QUANTUM_CLIENT_BRANCH=essex-3
> > > SWIFT_BRANCH=1.4.5
>
>
> Good idea.  I added those lines to my localrc, but still got the same 500
> error as before.
>
> Also, I'm seeing the following stack trace from the stack's n-api process:
>
> 2012-02-20 15:53:44 WARNING nova.api.ec2 [-] Configuration setting for
> keystone_ec2_url needs to be updated to /tokens only. The /ec2 prefix is
> being deprecated
> 2012-02-20 15:53:44 ERROR nova.api.ec2 [-] FaultWrapper: Extra data: line 1
> column 4 - line 5 column 4 (char 4 - 43)
> (nova.api.ec2): TRACE: Traceback (most recent call last):
> (nova.api.ec2): TRACE:   File "/opt/stack/nova/nova/api/ec2/__init__.py",
> line 89, in __call__
> (nova.api.ec2): TRACE:     return req.get_response(self.application)
> (nova.api.ec2): TRACE:   File
> "/usr/lib/python2.7/dist-packages/webob/request.py", line 1053, in
> get_response
> (nova.api.ec2): TRACE:     application, catch_exc_info=False)
> (nova.api.ec2): TRACE:   File
> "/usr/lib/python2.7/dist-packages/webob/request.py", line 1022, in
> call_application
> (nova.api.ec2): TRACE:     app_iter = application(self.environ,
> start_response)
> (nova.api.ec2): TRACE:   File
> "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
> (nova.api.ec2): TRACE:     resp = self.call_func(req, *args, **self.kwargs)
> (nova.api.ec2): TRACE:   File
> "/usr/lib/python2.7/dist-packages/webob/dec.py", line 208, in call_func
> (nova.api.ec2): TRACE:     return self.func(req, *args, **kwargs)
> (nova.api.ec2): TRACE:   File "/opt/stack/nova/nova/api/ec2/__init__.py",
> line 101, in __call__
> (nova.api.ec2): TRACE:     rv = req.get_response(self.application)
> (nova.api.ec2): TRACE:   File
> "/usr/lib/python2.7/dist-packages/webob/request.py", line 1053, in
> get_response
> (nova.api.ec2): TRACE:     application, catch_exc_info=False)
> (nova.api.ec2): TRACE:   File
> "/usr/lib/python2.7/dist-packages/webob/request.py", line 1022, in
> call_application
> (nova.api.ec2): TRACE:     app_iter = application(self.environ,
> start_response)
> (nova.api.ec2): TRACE:   File
> "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
> (nova.api.ec2): TRACE:     resp = self.call_func(req, *args, **self.kwargs)
> (nova.api.ec2): TRACE:   File
> "/usr/lib/python2.7/dist-packages/webob/dec.py", line 208, in call_func
> (nova.api.ec2): TRACE:     return self.func(req, *args, **kwargs)
> (nova.api.ec2): TRACE:   File "/opt/stack/nova/nova/api/ec2/__init__.py",
> line 243, in __call__
> (nova.api.ec2): TRACE:     result = utils.loads(response)
> (nova.api.ec2): TRACE:   File "/opt/stack/nova/nova/utils.py", line 757, in
> loads
> (nova.api.ec2): TRACE:     return json.loads(s)
> (nova.api.ec2): TRACE:   File "/usr/lib/python2.7/json/__init__.py", line
> 326, in loads
> (nova.api.ec2): TRACE:     return _default_decoder.decode(s)
> (nova.api.ec2): TRACE:   File "/usr/lib/python2.7/json/decoder.py", line
> 369, in decode
> (nova.api.ec2): TRACE:     raise ValueError(errmsg("Extra data", s, end,
> len(s)))
> (nova.api.ec2): TRACE: ValueError: Extra data: line 1 column 4 - line 5
> column 4 (char 4 - 43)
> (nova.api.ec2): TRACE:
>

Re: Anyone using OpenStack driver to access devstack deployment?

Posted by Jay Doane <ja...@almery.com>.
2012/2/20 Tomaž Muraus <to...@apache.org>

>
> One thing I would still try is using a stable release instead of the latest
> master - e.g. essex:
>
> : How do I run a specific OpenStack milestone?
> > A: OpenStack milestones have tags set in the git repo. Set the
> appropriate
> > tag in the *_BRANCH variables in localrc. Swift is on its own release
> > schedule so pick a tag in the Swift repo that is just before the
> milestone
> > release. For example:
> > GLANCE_BRANCH=essex-3
> > HORIZON_BRANCH=essex-3
> > KEYSTONE_BRANCH=essex-3
> > KEYSTONECLIENT_BRANCH=essex-3
> > NOVA_BRANCH=essex-3
> > NOVACLIENT_BRANCH=essex-3
> > QUANTUM_BRANCH=essex-3
> > QUANTUM_CLIENT_BRANCH=essex-3
> > SWIFT_BRANCH=1.4.5


Good idea.  I added those lines to my localrc, but still got the same 500
error as before.

Also, I'm seeing the following stack trace from the stack's n-api process:

2012-02-20 15:53:44 WARNING nova.api.ec2 [-] Configuration setting for
keystone_ec2_url needs to be updated to /tokens only. The /ec2 prefix is
being deprecated
2012-02-20 15:53:44 ERROR nova.api.ec2 [-] FaultWrapper: Extra data: line 1
column 4 - line 5 column 4 (char 4 - 43)
(nova.api.ec2): TRACE: Traceback (most recent call last):
(nova.api.ec2): TRACE:   File "/opt/stack/nova/nova/api/ec2/__init__.py",
line 89, in __call__
(nova.api.ec2): TRACE:     return req.get_response(self.application)
(nova.api.ec2): TRACE:   File
"/usr/lib/python2.7/dist-packages/webob/request.py", line 1053, in
get_response
(nova.api.ec2): TRACE:     application, catch_exc_info=False)
(nova.api.ec2): TRACE:   File
"/usr/lib/python2.7/dist-packages/webob/request.py", line 1022, in
call_application
(nova.api.ec2): TRACE:     app_iter = application(self.environ,
start_response)
(nova.api.ec2): TRACE:   File
"/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
(nova.api.ec2): TRACE:     resp = self.call_func(req, *args, **self.kwargs)
(nova.api.ec2): TRACE:   File
"/usr/lib/python2.7/dist-packages/webob/dec.py", line 208, in call_func
(nova.api.ec2): TRACE:     return self.func(req, *args, **kwargs)
(nova.api.ec2): TRACE:   File "/opt/stack/nova/nova/api/ec2/__init__.py",
line 101, in __call__
(nova.api.ec2): TRACE:     rv = req.get_response(self.application)
(nova.api.ec2): TRACE:   File
"/usr/lib/python2.7/dist-packages/webob/request.py", line 1053, in
get_response
(nova.api.ec2): TRACE:     application, catch_exc_info=False)
(nova.api.ec2): TRACE:   File
"/usr/lib/python2.7/dist-packages/webob/request.py", line 1022, in
call_application
(nova.api.ec2): TRACE:     app_iter = application(self.environ,
start_response)
(nova.api.ec2): TRACE:   File
"/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
(nova.api.ec2): TRACE:     resp = self.call_func(req, *args, **self.kwargs)
(nova.api.ec2): TRACE:   File
"/usr/lib/python2.7/dist-packages/webob/dec.py", line 208, in call_func
(nova.api.ec2): TRACE:     return self.func(req, *args, **kwargs)
(nova.api.ec2): TRACE:   File "/opt/stack/nova/nova/api/ec2/__init__.py",
line 243, in __call__
(nova.api.ec2): TRACE:     result = utils.loads(response)
(nova.api.ec2): TRACE:   File "/opt/stack/nova/nova/utils.py", line 757, in
loads
(nova.api.ec2): TRACE:     return json.loads(s)
(nova.api.ec2): TRACE:   File "/usr/lib/python2.7/json/__init__.py", line
326, in loads
(nova.api.ec2): TRACE:     return _default_decoder.decode(s)
(nova.api.ec2): TRACE:   File "/usr/lib/python2.7/json/decoder.py", line
369, in decode
(nova.api.ec2): TRACE:     raise ValueError(errmsg("Extra data", s, end,
len(s)))
(nova.api.ec2): TRACE: ValueError: Extra data: line 1 column 4 - line 5
column 4 (char 4 - 43)
(nova.api.ec2): TRACE:

Re: Anyone using OpenStack driver to access devstack deployment?

Posted by Tomaž Muraus <to...@apache.org>.
It looks like there is a bug in the revision you are using. I also had some
problems with the identity service (keystone) when trying to replicate your
problem so I will try to come in touch with some OpenStack guys and ask
them for help.

One thing I would still try is using a stable release instead of the latest
master - e.g. essex:

: How do I run a specific OpenStack milestone?
> A: OpenStack milestones have tags set in the git repo. Set the appropriate
> tag in the *_BRANCH variables in localrc. Swift is on its own release
> schedule so pick a tag in the Swift repo that is just before the milestone
> release. For example:
> GLANCE_BRANCH=essex-3
> HORIZON_BRANCH=essex-3
> KEYSTONE_BRANCH=essex-3
> KEYSTONECLIENT_BRANCH=essex-3
> NOVA_BRANCH=essex-3
> NOVACLIENT_BRANCH=essex-3
> QUANTUM_BRANCH=essex-3
> QUANTUM_CLIENT_BRANCH=essex-3
> SWIFT_BRANCH=1.4.5


On Mon, Feb 20, 2012 at 3:21 PM, Jay Doane <ja...@almery.com> wrote:

> 2012/2/18 Tomaž Muraus <to...@apache.org>
> >
> >
> > Here is a link to the keystone docs -
> >
> >
> http://docs.openstack.org/incubation/identity-dev-guide/content/Versions-d1e472.html
> > and it looks like the same concept is also used with nova.
> >
>
> Thanks.
>
> > In any case, I will try to get devstack working locally and reproduce
> this
> > > > problem myself.
> > > >
> > >
> > > Thanks.  I should also update my stack and see if the problem has since
> > > been resolved.
> >
>
> Alas, upon updating to the latest devstack, I now find that the Eucalyptus
> driver no longer works either, giving the following output:
>
> # -------- begin 19324640 request ----------
> curl -i -X GET -H 'Host: 50.56.213.226:8773' -H 'X-LC-Request-ID:
> 19324640'
> -H 'Content-Length: 0' -H 'Accept-Encoding: gzip,deflate' -H 'User-Agent:
> libcloud/0.8.0 (Eucalyptus)' --compress '
>
> https://50.56.213.226:8773/services/Cloud?SignatureVersion=2&AWSAccessKeyId=demo&Timestamp=2012-02-20T20%3A31%3A25Z&SignatureMethod=HmacSHA256&Version=2010-08-31&Signature=4ikC%2F%2BT4IOilH9AWGbgMVbOx5fPuntZ948WIUhiMW44%3D&Action=DescribeImages
> '
> # -------- begin 19324640:19296624 response ----------
> HTTP/1.1 500 Internal Server Error
> Date: Mon, 20 Feb 2012 20:31:27 GMT
> Content-Length: 255
> Content-Type: text/xml
>
> <?xml version="1.0"?>
> <Response><Errors><Error><Code>500</Code><Message>The server has either
> erred or is incapable of performing the requested
>
> operation.</Message></Error></Errors><RequestID>req-c4e55c57-298b-4018-b086-40cee23872e9</RequestID></Response>
> # -------- end 19324640:19296624 response ----------
>
> Traceback (most recent call last):
>   File "stack_demo.py", line 24, in <module>
>    print eucalyptus_driver().list_images()
>  File
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/ec2.py",
> line 504, in list_images
>    self.connection.request(self.path, params=params).object
>   File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
> line 564, in request
>    connection=self)
>   File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
> line 77, in __init__
>    raise Exception(self.parse_error())
> Exception: 500: The server has either erred or is incapable of performing
> the requested operation.
>
> Jay
>

Re: Anyone using OpenStack driver to access devstack deployment?

Posted by Jay Doane <ja...@almery.com>.
2012/2/18 Tomaž Muraus <to...@apache.org>
>
>
> Here is a link to the keystone docs -
>
> http://docs.openstack.org/incubation/identity-dev-guide/content/Versions-d1e472.html
> and it looks like the same concept is also used with nova.
>

Thanks.

> In any case, I will try to get devstack working locally and reproduce this
> > > problem myself.
> > >
> >
> > Thanks.  I should also update my stack and see if the problem has since
> > been resolved.
>

Alas, upon updating to the latest devstack, I now find that the Eucalyptus
driver no longer works either, giving the following output:

# -------- begin 19324640 request ----------
curl -i -X GET -H 'Host: 50.56.213.226:8773' -H 'X-LC-Request-ID: 19324640'
-H 'Content-Length: 0' -H 'Accept-Encoding: gzip,deflate' -H 'User-Agent:
libcloud/0.8.0 (Eucalyptus)' --compress '
https://50.56.213.226:8773/services/Cloud?SignatureVersion=2&AWSAccessKeyId=demo&Timestamp=2012-02-20T20%3A31%3A25Z&SignatureMethod=HmacSHA256&Version=2010-08-31&Signature=4ikC%2F%2BT4IOilH9AWGbgMVbOx5fPuntZ948WIUhiMW44%3D&Action=DescribeImages
'
# -------- begin 19324640:19296624 response ----------
HTTP/1.1 500 Internal Server Error
Date: Mon, 20 Feb 2012 20:31:27 GMT
Content-Length: 255
Content-Type: text/xml

<?xml version="1.0"?>
<Response><Errors><Error><Code>500</Code><Message>The server has either
erred or is incapable of performing the requested
operation.</Message></Error></Errors><RequestID>req-c4e55c57-298b-4018-b086-40cee23872e9</RequestID></Response>
# -------- end 19324640:19296624 response ----------

Traceback (most recent call last):
  File "stack_demo.py", line 24, in <module>
    print eucalyptus_driver().list_images()
  File
"/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/ec2.py",
line 504, in list_images
    self.connection.request(self.path, params=params).object
  File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
line 564, in request
    connection=self)
  File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
line 77, in __init__
    raise Exception(self.parse_error())
Exception: 500: The server has either erred or is incapable of performing
the requested operation.

Jay

Re: Anyone using OpenStack driver to access devstack deployment?

Posted by Tomaž Muraus <to...@apache.org>.
On Thu, Feb 16, 2012 at 11:21 PM, Jay Doane <ja...@almery.com> wrote:

> 2012/2/16 Tomaž Muraus <to...@apache.org>
>
> > Do you get the same "300, Multiple choices" response back if you change
> > ex_force_base_url to http://%s:8774/v2.0?
>
>
> Correct.  Here is the response.  The "/v2/v2.0" part of the path looks
> strange to me.
>

Yeah, you are right - it looks like the correct version is "v2" and not
"v2.0".


> # -------- begin 19425200:19295648 response ----------
> HTTP/1.1 300 Multiple Choices
> Date: Fri, 17 Feb 2012 07:18:54 GMT
> Content-Length: 332
> Content-Type: application/json
>
> {"choices": [{"status": "CURRENT", "media-types": [{"base":
> "application/xml", "type":
> "application/vnd.openstack.compute+xml;version=2"}, {"base":
> "application/json", "type":
> "application/vnd.openstack.compute+json;version=2"}], "id": "v2.0",
> "links": [{"href": "http://50.56.213.226:8774/v2/v2.0/images/detail",
> "rel": "self"}]}]}
> # -------- end 19425200:19295648 response ----------
>
>
> > If so, then it seems like an
> > OpenStack bug because the documentation states that the version can be
> > provided in the URL.
> >
>
> Can you point to the docs to which you are referring?
>

Here is a link to the keystone docs -
http://docs.openstack.org/incubation/identity-dev-guide/content/Versions-d1e472.html
and
it looks like the same concept is also used with nova.

>
>
> > Giving more information on which OpenStack version you are using would
> also
> > be helpful.
> >
>
> I'm not sure what the best way to do that is.  Devstack by default pulls
> from the master branch of all repositories, and the version I have running
> is about 5 days old.  The top of the nova repo's git log is
>
> commit d8f8bad0f26b4438986ab1a469d89d03b22551db
>
> Merge: d03692c b196f4b
>
> Author: Jenkins <je...@review.openstack.org>
>
> Date:   Sat Feb 11 18:42:50 2012 +0000
>
>
>
>    Merge "Converting db tables to utf8."
>
> And that of keystone is
>
> commit 9452cf04bc8b0a4dc66dc640615d5ace1ca715f2
>
> Author: Alvaro Lopez Garcia <al...@ifca.unican.es>
>
> Date:   Tue Jan 31 18:14:17 2012 +0100
>
>
>
>    Fixes bug 924391
>
>
>
>    Change-Id: Iccb232a56df6072580cbcb0bc07ef7c0f81ca8fe
>
> In any case, I will try to get devstack working locally and reproduce this
> > problem myself.
> >
>
> Thanks.  I should also update my stack and see if the problem has since
> been resolved.
>
> Jay
>
>
> > On Thu, Feb 16, 2012 at 8:20 PM, Jay Doane <ja...@almery.com> wrote:
> >
> > > If I change ex_force_base_url='http://%s:8774/v2.0' % STACK_HOST then
> I
> > > get
> > > the same TypeError as before.
> > >
> > > However, if I change ex_force_base_url='http://%s:8774/v2' %
> STACK_HOST
> > > (note the lack of ".0"), I get the following 404:
> > >
> > > $ LIBCLOUD_DEBUG=/dev/stderr python stack_demo.py
> > > /Users/jay/Library/Python/2.6/site-packages/Crypto/Util/randpool.py:40:
> > > RandomPool_DeprecationWarning: This application uses RandomPool, which
> is
> > > BROKEN in older releases.  See http://www.pycrypto.org/randpool-broken
> > >  RandomPool_DeprecationWarning)
> > > # -------- begin 19425200 request ----------
> > > curl -i -X POST -H 'Host: 50.56.213.226:5000' -H 'Accept-Encoding:
> > > gzip,deflate' -H 'X-LC-Request-ID: 19425200' -H 'Content-Type:
> > > application/json; charset=UTF-8' -H 'Content-Length: 79' -H 'Accept:
> > > application/json' -H 'User-Agent: libcloud/0.8.0 (OpenStack)'
> > --data-binary
> > > '{"auth": {"passwordCredentials": {"username": "demo", "password":
> > > "password"}}}' --compress https://50.56.213.226:5000/v2.0/tokens/
> > > # -------- begin 19425200:19425360 response ----------
> > > HTTP/1.1 200 OK
> > > Date: Fri, 17 Feb 2012 04:17:13 GMT
> > > Content-Type: application/json; charset=UTF-8
> > > Content-Length: 772
> > > Vary: X-Auth-Token
> > >
> > > {"access": {"token": {"expires": "2012-02-17T18:11:39", "id":
> > > "2977320b-56d9-47a9-9c38-4a5b2b0ac8c9"}, "serviceCatalog":
> [{"endpoints":
> > > [{"id": "2", "region": "RegionOne", "internalURL": "
> > > http://50.56.213.226:8773/services/Cloud", "publicURL": "
> > > http://50.56.213.226:8773/services/Cloud"}], "type": "ec2", "name":
> > > "ec2"},
> > > {"endpoints": [{"id": "3", "region": "RegionOne", "internalURL": "
> > > http://50.56.213.226:9292/v1", "publicURL": "
> > http://50.56.213.226:9292/v1
> > > "}],
> > > "type": "image", "name": "glance"}, {"endpoints": [{"id": "4",
> "region":
> > > "RegionOne", "internalURL": "http://50.56.213.226:5000/v2.0",
> > > "publicURL": "
> > > http://50.56.213.226:5000/v2.0"}], "type": "identity", "name":
> > > "keystone"}], "user": {"id": "a438ea90e1da43e4b895874fdaf83a2d",
> "roles":
> > > [], "name": "demo"}}}
> > > # -------- end 19425200:19425360 response ----------
> > >
> > > # -------- begin 19425200 request ----------
> > > curl -i -X GET -H 'Host: 50.56.213.226:8774' -H 'X-LC-Request-ID:
> > > 19425200'
> > > -H 'Accept-Encoding: gzip,deflate' -H 'X-Auth-Token:
> > > 2977320b-56d9-47a9-9c38-4a5b2b0ac8c9' -H 'Content-Length: 0' -H
> 'Accept:
> > > application/json' -H 'User-Agent: libcloud/0.8.0 (OpenStack)'
> --compress
> > '
> > >
> >
> https://50.56.213.226:8774/v2/images/detail?cache-busting=786c8c85d9f54028
> > > '
> > > # -------- begin 19425200:19295648 response ----------
> > > HTTP/1.1 404 Not Found
> > > Date: Fri, 17 Feb 2012 04:17:13 GMT
> > > Content-Length: 52
> > > Content-Type: text/plain; charset=UTF-8
> > >
> > > 404 Not Found
> > >
> > > The resource could not be found.
> > >
> > >
> > > # -------- end 19425200:19295648 response ----------
> > >
> > > Traceback (most recent call last):
> > >  File "stack_demo.py", line 17, in <module>
> > >    print driver.list_images()
> > >  File
> > >
> > >
> >
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> > > line 209, in list_images
> > >    return self._to_images(self.connection.request('/images/detail')
> > >  File
> > >
> > >
> >
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> > > line 151, in request
> > >    method=method, headers=headers)
> > >  File
> > > "/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py",
> > line
> > > 328, in request
> > >    return super(OpenStackBaseConnection, self).request(**kwargs)
> > >  File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
> > > line 564, in request
> > >    connection=self)
> > >  File
> > >
> > >
> >
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> > > line 774, in __init__
> > >    super(OpenStack_1_1_Response, self).__init__(*args, **kwargs)
> > >  File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
> > > line 77, in __init__
> > >    raise Exception(self.parse_error())
> > > Exception: 404 Not Found 404 Not Found
> > >
> > > The resource could not be found.
> > >
> > > 2012/2/16 Tomaž Muraus <to...@apache.org>
> > >
> > > > It looks like you are missing an API version in the URL.
> > > >
> > > > Please change the ex_force_base_url='http://%s:8774' % STACK_HOST
> > > > to ex_force_base_url='http://%s:8774/v2.0' % STACK_HOST
> > > >
> > > > Let us know if this solves your problem.
> > > >
> > > > On Thu, Feb 16, 2012 at 7:17 PM, Jay Doane <ja...@almery.com> wrote:
> > > >
> > > > > 2012/2/16 Tomaž Muraus <to...@apache.org>
> > > > >
> > > > > >
> > > > > > In any case, it does look like an auth API issue. I have merged
> > > Brad's
> > > > > Auth
> > > > > > API changes yesterday so please update your trunk and try again
> - I
> > > > think
> > > > > > his changes should fix your problem.
> > > > > >
> > > > >
> > > > > I pulled the latest code, and you were right: it fixed the tenantId
> > > > > KeyError.
> > > > >
> > > > > Unfortunately, I'm now getting a different error.  My
> interpretation
> > is
> > > > > that openstack is giving a 300 response because there is a choice
> of
> > > > > response formats, but the libcloud driver is treating that as an
> > error,
> > > > > since OpenStackResponse.success is implemented to do so.  Details
> > > below.
> > > > >
> > > > > I've simplified my demo code by removing the (working) Eucalyptus
> > > driver
> > > > > example, and changed the name to stack_demo.py.  Here's the
> listing:
> > > > >
> > > > > from libcloud.compute.types import Provider
> > > > > from libcloud.compute.providers import get_driver
> > > > >
> > > > > STACK_HOST = '50.56.213.226'
> > > > > USERNAME = 'demo'
> > > > > PASSWORD = 'password'
> > > > >
> > > > > def openstack_connect():
> > > > >    Driver = get_driver(Provider.OPENSTACK)
> > > > >    driver = Driver(USERNAME, PASSWORD, host=STACK_HOST, port=8774,
> > > > > secure=False,
> > > > >                  ex_force_auth_url='http://%s:5000' % STACK_HOST,
> > > > >                  ex_force_auth_version='2.0_password',
> > > > >                  ex_force_base_url='http://%s:8774' % STACK_HOST)
> > > > >    return driver
> > > > >
> > > > > driver = openstack_connect()
> > > > > print driver.list_images()
> > > > >
> > > > > Here's the output:
> > > > >
> > > > > $ LIBCLOUD_DEBUG=/dev/stderr python stack_demo.py
> > > > >
> > /Users/jay/Library/Python/2.6/site-packages/Crypto/Util/randpool.py:40:
> > > > > RandomPool_DeprecationWarning: This application uses RandomPool,
> > which
> > > is
> > > > > BROKEN in older releases.  See
> > http://www.pycrypto.org/randpool-broken
> > > > >  RandomPool_DeprecationWarning)
> > > > > # -------- begin 19425240 request ----------
> > > > > curl -i -X POST -H 'Host: 50.56.213.226:5000' -H 'Accept-Encoding:
> > > > > gzip,deflate' -H 'X-LC-Request-ID: 19425240' -H 'Content-Type:
> > > > > application/json; charset=UTF-8' -H 'Content-Length: 79' -H
> 'Accept:
> > > > > application/json' -H 'User-Agent: libcloud/0.8.0 (OpenStack)'
> > > > --data-binary
> > > > > '{"auth": {"passwordCredentials": {"username": "demo", "password":
> > > > > "password"}}}' --compress https://50.56.213.226:5000/v2.0/tokens/
> > > > > # -------- begin 19425240:19425400 response ----------
> > > > > HTTP/1.1 200 OK
> > > > > Date: Fri, 17 Feb 2012 01:45:20 GMT
> > > > > Content-Type: application/json; charset=UTF-8
> > > > > Content-Length: 772
> > > > > Vary: X-Auth-Token
> > > > >
> > > > > {"access": {"token": {"expires": "2012-02-16T17:54:14", "id":
> > > > > "f436424e-6c7d-43e4-ae7c-30f5553c79f3"}, "serviceCatalog":
> > > [{"endpoints":
> > > > > [{"id": "2", "region": "RegionOne", "internalURL": "
> > > > > http://50.56.213.226:8773/services/Cloud", "publicURL": "
> > > > > http://50.56.213.226:8773/services/Cloud"}], "type": "ec2",
> "name":
> > > > > "ec2"},
> > > > > {"endpoints": [{"id": "3", "region": "RegionOne", "internalURL": "
> > > > > http://50.56.213.226:9292/v1", "publicURL": "
> > > > http://50.56.213.226:9292/v1
> > > > > "}],
> > > > > "type": "image", "name": "glance"}, {"endpoints": [{"id": "4",
> > > "region":
> > > > > "RegionOne", "internalURL": "http://50.56.213.226:5000/v2.0",
> > > > > "publicURL": "
> > > > > http://50.56.213.226:5000/v2.0"}], "type": "identity", "name":
> > > > > "keystone"}], "user": {"id": "a438ea90e1da43e4b895874fdaf83a2d",
> > > "roles":
> > > > > [], "name": "demo"}}}
> > > > > # -------- end 19425240:19425400 response ----------
> > > > >
> > > > > # -------- begin 19425240 request ----------
> > > > > curl -i -X GET -H 'Host: 50.56.213.226:8774' -H 'X-LC-Request-ID:
> > > > > 19425240'
> > > > > -H 'Accept-Encoding: gzip,deflate' -H 'X-Auth-Token:
> > > > > f436424e-6c7d-43e4-ae7c-30f5553c79f3' -H 'Content-Length: 0' -H
> > > 'Accept:
> > > > > application/json' -H 'User-Agent: libcloud/0.8.0 (OpenStack)'
> > > --compress
> > > > '
> > > > >
> > >
> https://50.56.213.226:8774/images/detail?cache-busting=faeee245cd437497'
> > > > > # -------- begin 19425240:19295688 response ----------
> > > > > HTTP/1.1 300 Multiple Choices
> > > > > Date: Fri, 17 Feb 2012 01:45:20 GMT
> > > > > Content-Length: 327
> > > > > Content-Type: application/json
> > > > >
> > > > > {"choices": [{"status": "CURRENT", "media-types": [{"base":
> > > > > "application/xml", "type":
> > > > > "application/vnd.openstack.compute+xml;version=2"}, {"base":
> > > > > "application/json", "type":
> > > > > "application/vnd.openstack.compute+json;version=2"}], "id": "v2.0",
> > > > > "links": [{"href": "http://50.56.213.226:8774/v2/images/detail",
> > > "rel":
> > > > > "self"}]}]}
> > > > > # -------- end 19425240:19295688 response ----------
> > > > >
> > > > > Traceback (most recent call last):
> > > > >   File "stack_demo.py", line 17, in <module>
> > > > >    print driver.list_images()
> > > > >  File
> > > > >
> > > > >
> > > >
> > >
> >
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> > > > > line 209, in list_images
> > > > >    return self._to_images(self.connection.request('/images/detail')
> > > > >  File
> > > > >
> > > > >
> > > >
> > >
> >
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> > > > > line 151, in request
> > > > >    method=method, headers=headers)
> > > > >  File
> > > > >
> "/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py",
> > > > line
> > > > > 328, in request
> > > > >    return super(OpenStackBaseConnection, self).request(**kwargs)
> > > > >  File
> > "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
> > > > > line 564, in request
> > > > >    connection=self)
> > > > >  File
> > > > >
> > > > >
> > > >
> > >
> >
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> > > > > line 774, in __init__
> > > > >    super(OpenStack_1_1_Response, self).__init__(*args, **kwargs)
> > > > >  File
> > "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
> > > > > line 77, in __init__
> > > > >    raise Exception(self.parse_error())
> > > > >  File
> > > > >
> > > > >
> > > >
> > >
> >
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> > > > > line 111, in parse_error
> > > > >    in body.values()])
> > > > > TypeError: list indices must be integers, not str
> > > > >
> > > >
> > >
> >
>

Re: Anyone using OpenStack driver to access devstack deployment?

Posted by Jay Doane <ja...@almery.com>.
2012/2/16 Tomaž Muraus <to...@apache.org>

> Do you get the same "300, Multiple choices" response back if you change
> ex_force_base_url to http://%s:8774/v2.0?


Correct.  Here is the response.  The "/v2/v2.0" part of the path looks
strange to me.

# -------- begin 19425200:19295648 response ----------
HTTP/1.1 300 Multiple Choices
Date: Fri, 17 Feb 2012 07:18:54 GMT
Content-Length: 332
Content-Type: application/json

{"choices": [{"status": "CURRENT", "media-types": [{"base":
"application/xml", "type":
"application/vnd.openstack.compute+xml;version=2"}, {"base":
"application/json", "type":
"application/vnd.openstack.compute+json;version=2"}], "id": "v2.0",
"links": [{"href": "http://50.56.213.226:8774/v2/v2.0/images/detail",
"rel": "self"}]}]}
# -------- end 19425200:19295648 response ----------


> If so, then it seems like an
> OpenStack bug because the documentation states that the version can be
> provided in the URL.
>

Can you point to the docs to which you are referring?


> Giving more information on which OpenStack version you are using would also
> be helpful.
>

I'm not sure what the best way to do that is.  Devstack by default pulls
from the master branch of all repositories, and the version I have running
is about 5 days old.  The top of the nova repo's git log is

commit d8f8bad0f26b4438986ab1a469d89d03b22551db

Merge: d03692c b196f4b

Author: Jenkins <je...@review.openstack.org>

Date:   Sat Feb 11 18:42:50 2012 +0000



    Merge "Converting db tables to utf8."

And that of keystone is

commit 9452cf04bc8b0a4dc66dc640615d5ace1ca715f2

Author: Alvaro Lopez Garcia <al...@ifca.unican.es>

Date:   Tue Jan 31 18:14:17 2012 +0100



    Fixes bug 924391



    Change-Id: Iccb232a56df6072580cbcb0bc07ef7c0f81ca8fe

In any case, I will try to get devstack working locally and reproduce this
> problem myself.
>

Thanks.  I should also update my stack and see if the problem has since
been resolved.

Jay


> On Thu, Feb 16, 2012 at 8:20 PM, Jay Doane <ja...@almery.com> wrote:
>
> > If I change ex_force_base_url='http://%s:8774/v2.0' % STACK_HOST then I
> > get
> > the same TypeError as before.
> >
> > However, if I change ex_force_base_url='http://%s:8774/v2' % STACK_HOST
> > (note the lack of ".0"), I get the following 404:
> >
> > $ LIBCLOUD_DEBUG=/dev/stderr python stack_demo.py
> > /Users/jay/Library/Python/2.6/site-packages/Crypto/Util/randpool.py:40:
> > RandomPool_DeprecationWarning: This application uses RandomPool, which is
> > BROKEN in older releases.  See http://www.pycrypto.org/randpool-broken
> >  RandomPool_DeprecationWarning)
> > # -------- begin 19425200 request ----------
> > curl -i -X POST -H 'Host: 50.56.213.226:5000' -H 'Accept-Encoding:
> > gzip,deflate' -H 'X-LC-Request-ID: 19425200' -H 'Content-Type:
> > application/json; charset=UTF-8' -H 'Content-Length: 79' -H 'Accept:
> > application/json' -H 'User-Agent: libcloud/0.8.0 (OpenStack)'
> --data-binary
> > '{"auth": {"passwordCredentials": {"username": "demo", "password":
> > "password"}}}' --compress https://50.56.213.226:5000/v2.0/tokens/
> > # -------- begin 19425200:19425360 response ----------
> > HTTP/1.1 200 OK
> > Date: Fri, 17 Feb 2012 04:17:13 GMT
> > Content-Type: application/json; charset=UTF-8
> > Content-Length: 772
> > Vary: X-Auth-Token
> >
> > {"access": {"token": {"expires": "2012-02-17T18:11:39", "id":
> > "2977320b-56d9-47a9-9c38-4a5b2b0ac8c9"}, "serviceCatalog": [{"endpoints":
> > [{"id": "2", "region": "RegionOne", "internalURL": "
> > http://50.56.213.226:8773/services/Cloud", "publicURL": "
> > http://50.56.213.226:8773/services/Cloud"}], "type": "ec2", "name":
> > "ec2"},
> > {"endpoints": [{"id": "3", "region": "RegionOne", "internalURL": "
> > http://50.56.213.226:9292/v1", "publicURL": "
> http://50.56.213.226:9292/v1
> > "}],
> > "type": "image", "name": "glance"}, {"endpoints": [{"id": "4", "region":
> > "RegionOne", "internalURL": "http://50.56.213.226:5000/v2.0",
> > "publicURL": "
> > http://50.56.213.226:5000/v2.0"}], "type": "identity", "name":
> > "keystone"}], "user": {"id": "a438ea90e1da43e4b895874fdaf83a2d", "roles":
> > [], "name": "demo"}}}
> > # -------- end 19425200:19425360 response ----------
> >
> > # -------- begin 19425200 request ----------
> > curl -i -X GET -H 'Host: 50.56.213.226:8774' -H 'X-LC-Request-ID:
> > 19425200'
> > -H 'Accept-Encoding: gzip,deflate' -H 'X-Auth-Token:
> > 2977320b-56d9-47a9-9c38-4a5b2b0ac8c9' -H 'Content-Length: 0' -H 'Accept:
> > application/json' -H 'User-Agent: libcloud/0.8.0 (OpenStack)' --compress
> '
> >
> https://50.56.213.226:8774/v2/images/detail?cache-busting=786c8c85d9f54028
> > '
> > # -------- begin 19425200:19295648 response ----------
> > HTTP/1.1 404 Not Found
> > Date: Fri, 17 Feb 2012 04:17:13 GMT
> > Content-Length: 52
> > Content-Type: text/plain; charset=UTF-8
> >
> > 404 Not Found
> >
> > The resource could not be found.
> >
> >
> > # -------- end 19425200:19295648 response ----------
> >
> > Traceback (most recent call last):
> >  File "stack_demo.py", line 17, in <module>
> >    print driver.list_images()
> >  File
> >
> >
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> > line 209, in list_images
> >    return self._to_images(self.connection.request('/images/detail')
> >  File
> >
> >
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> > line 151, in request
> >    method=method, headers=headers)
> >  File
> > "/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py",
> line
> > 328, in request
> >    return super(OpenStackBaseConnection, self).request(**kwargs)
> >  File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
> > line 564, in request
> >    connection=self)
> >  File
> >
> >
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> > line 774, in __init__
> >    super(OpenStack_1_1_Response, self).__init__(*args, **kwargs)
> >  File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
> > line 77, in __init__
> >    raise Exception(self.parse_error())
> > Exception: 404 Not Found 404 Not Found
> >
> > The resource could not be found.
> >
> > 2012/2/16 Tomaž Muraus <to...@apache.org>
> >
> > > It looks like you are missing an API version in the URL.
> > >
> > > Please change the ex_force_base_url='http://%s:8774' % STACK_HOST
> > > to ex_force_base_url='http://%s:8774/v2.0' % STACK_HOST
> > >
> > > Let us know if this solves your problem.
> > >
> > > On Thu, Feb 16, 2012 at 7:17 PM, Jay Doane <ja...@almery.com> wrote:
> > >
> > > > 2012/2/16 Tomaž Muraus <to...@apache.org>
> > > >
> > > > >
> > > > > In any case, it does look like an auth API issue. I have merged
> > Brad's
> > > > Auth
> > > > > API changes yesterday so please update your trunk and try again - I
> > > think
> > > > > his changes should fix your problem.
> > > > >
> > > >
> > > > I pulled the latest code, and you were right: it fixed the tenantId
> > > > KeyError.
> > > >
> > > > Unfortunately, I'm now getting a different error.  My interpretation
> is
> > > > that openstack is giving a 300 response because there is a choice of
> > > > response formats, but the libcloud driver is treating that as an
> error,
> > > > since OpenStackResponse.success is implemented to do so.  Details
> > below.
> > > >
> > > > I've simplified my demo code by removing the (working) Eucalyptus
> > driver
> > > > example, and changed the name to stack_demo.py.  Here's the listing:
> > > >
> > > > from libcloud.compute.types import Provider
> > > > from libcloud.compute.providers import get_driver
> > > >
> > > > STACK_HOST = '50.56.213.226'
> > > > USERNAME = 'demo'
> > > > PASSWORD = 'password'
> > > >
> > > > def openstack_connect():
> > > >    Driver = get_driver(Provider.OPENSTACK)
> > > >    driver = Driver(USERNAME, PASSWORD, host=STACK_HOST, port=8774,
> > > > secure=False,
> > > >                  ex_force_auth_url='http://%s:5000' % STACK_HOST,
> > > >                  ex_force_auth_version='2.0_password',
> > > >                  ex_force_base_url='http://%s:8774' % STACK_HOST)
> > > >    return driver
> > > >
> > > > driver = openstack_connect()
> > > > print driver.list_images()
> > > >
> > > > Here's the output:
> > > >
> > > > $ LIBCLOUD_DEBUG=/dev/stderr python stack_demo.py
> > > >
> /Users/jay/Library/Python/2.6/site-packages/Crypto/Util/randpool.py:40:
> > > > RandomPool_DeprecationWarning: This application uses RandomPool,
> which
> > is
> > > > BROKEN in older releases.  See
> http://www.pycrypto.org/randpool-broken
> > > >  RandomPool_DeprecationWarning)
> > > > # -------- begin 19425240 request ----------
> > > > curl -i -X POST -H 'Host: 50.56.213.226:5000' -H 'Accept-Encoding:
> > > > gzip,deflate' -H 'X-LC-Request-ID: 19425240' -H 'Content-Type:
> > > > application/json; charset=UTF-8' -H 'Content-Length: 79' -H 'Accept:
> > > > application/json' -H 'User-Agent: libcloud/0.8.0 (OpenStack)'
> > > --data-binary
> > > > '{"auth": {"passwordCredentials": {"username": "demo", "password":
> > > > "password"}}}' --compress https://50.56.213.226:5000/v2.0/tokens/
> > > > # -------- begin 19425240:19425400 response ----------
> > > > HTTP/1.1 200 OK
> > > > Date: Fri, 17 Feb 2012 01:45:20 GMT
> > > > Content-Type: application/json; charset=UTF-8
> > > > Content-Length: 772
> > > > Vary: X-Auth-Token
> > > >
> > > > {"access": {"token": {"expires": "2012-02-16T17:54:14", "id":
> > > > "f436424e-6c7d-43e4-ae7c-30f5553c79f3"}, "serviceCatalog":
> > [{"endpoints":
> > > > [{"id": "2", "region": "RegionOne", "internalURL": "
> > > > http://50.56.213.226:8773/services/Cloud", "publicURL": "
> > > > http://50.56.213.226:8773/services/Cloud"}], "type": "ec2", "name":
> > > > "ec2"},
> > > > {"endpoints": [{"id": "3", "region": "RegionOne", "internalURL": "
> > > > http://50.56.213.226:9292/v1", "publicURL": "
> > > http://50.56.213.226:9292/v1
> > > > "}],
> > > > "type": "image", "name": "glance"}, {"endpoints": [{"id": "4",
> > "region":
> > > > "RegionOne", "internalURL": "http://50.56.213.226:5000/v2.0",
> > > > "publicURL": "
> > > > http://50.56.213.226:5000/v2.0"}], "type": "identity", "name":
> > > > "keystone"}], "user": {"id": "a438ea90e1da43e4b895874fdaf83a2d",
> > "roles":
> > > > [], "name": "demo"}}}
> > > > # -------- end 19425240:19425400 response ----------
> > > >
> > > > # -------- begin 19425240 request ----------
> > > > curl -i -X GET -H 'Host: 50.56.213.226:8774' -H 'X-LC-Request-ID:
> > > > 19425240'
> > > > -H 'Accept-Encoding: gzip,deflate' -H 'X-Auth-Token:
> > > > f436424e-6c7d-43e4-ae7c-30f5553c79f3' -H 'Content-Length: 0' -H
> > 'Accept:
> > > > application/json' -H 'User-Agent: libcloud/0.8.0 (OpenStack)'
> > --compress
> > > '
> > > >
> > https://50.56.213.226:8774/images/detail?cache-busting=faeee245cd437497'
> > > > # -------- begin 19425240:19295688 response ----------
> > > > HTTP/1.1 300 Multiple Choices
> > > > Date: Fri, 17 Feb 2012 01:45:20 GMT
> > > > Content-Length: 327
> > > > Content-Type: application/json
> > > >
> > > > {"choices": [{"status": "CURRENT", "media-types": [{"base":
> > > > "application/xml", "type":
> > > > "application/vnd.openstack.compute+xml;version=2"}, {"base":
> > > > "application/json", "type":
> > > > "application/vnd.openstack.compute+json;version=2"}], "id": "v2.0",
> > > > "links": [{"href": "http://50.56.213.226:8774/v2/images/detail",
> > "rel":
> > > > "self"}]}]}
> > > > # -------- end 19425240:19295688 response ----------
> > > >
> > > > Traceback (most recent call last):
> > > >   File "stack_demo.py", line 17, in <module>
> > > >    print driver.list_images()
> > > >  File
> > > >
> > > >
> > >
> >
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> > > > line 209, in list_images
> > > >    return self._to_images(self.connection.request('/images/detail')
> > > >  File
> > > >
> > > >
> > >
> >
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> > > > line 151, in request
> > > >    method=method, headers=headers)
> > > >  File
> > > > "/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py",
> > > line
> > > > 328, in request
> > > >    return super(OpenStackBaseConnection, self).request(**kwargs)
> > > >  File
> "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
> > > > line 564, in request
> > > >    connection=self)
> > > >  File
> > > >
> > > >
> > >
> >
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> > > > line 774, in __init__
> > > >    super(OpenStack_1_1_Response, self).__init__(*args, **kwargs)
> > > >  File
> "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
> > > > line 77, in __init__
> > > >    raise Exception(self.parse_error())
> > > >  File
> > > >
> > > >
> > >
> >
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> > > > line 111, in parse_error
> > > >    in body.values()])
> > > > TypeError: list indices must be integers, not str
> > > >
> > >
> >
>

Re: Anyone using OpenStack driver to access devstack deployment?

Posted by Tomaž Muraus <to...@apache.org>.
Do you get the same "300, Multiple choices" response back if you change
ex_force_base_url to http://%s:8774/v2.0? If so, then it seems like an
OpenStack bug because the documentation states that the version can be
provided in the URL.

Giving more information on which OpenStack version you are using would also
be helpful.

In any case, I will try to get devstack working locally and reproduce this
problem myself.

On Thu, Feb 16, 2012 at 8:20 PM, Jay Doane <ja...@almery.com> wrote:

> If I change ex_force_base_url='http://%s:8774/v2.0' % STACK_HOST then I
> get
> the same TypeError as before.
>
> However, if I change ex_force_base_url='http://%s:8774/v2' % STACK_HOST
> (note the lack of ".0"), I get the following 404:
>
> $ LIBCLOUD_DEBUG=/dev/stderr python stack_demo.py
> /Users/jay/Library/Python/2.6/site-packages/Crypto/Util/randpool.py:40:
> RandomPool_DeprecationWarning: This application uses RandomPool, which is
> BROKEN in older releases.  See http://www.pycrypto.org/randpool-broken
>  RandomPool_DeprecationWarning)
> # -------- begin 19425200 request ----------
> curl -i -X POST -H 'Host: 50.56.213.226:5000' -H 'Accept-Encoding:
> gzip,deflate' -H 'X-LC-Request-ID: 19425200' -H 'Content-Type:
> application/json; charset=UTF-8' -H 'Content-Length: 79' -H 'Accept:
> application/json' -H 'User-Agent: libcloud/0.8.0 (OpenStack)' --data-binary
> '{"auth": {"passwordCredentials": {"username": "demo", "password":
> "password"}}}' --compress https://50.56.213.226:5000/v2.0/tokens/
> # -------- begin 19425200:19425360 response ----------
> HTTP/1.1 200 OK
> Date: Fri, 17 Feb 2012 04:17:13 GMT
> Content-Type: application/json; charset=UTF-8
> Content-Length: 772
> Vary: X-Auth-Token
>
> {"access": {"token": {"expires": "2012-02-17T18:11:39", "id":
> "2977320b-56d9-47a9-9c38-4a5b2b0ac8c9"}, "serviceCatalog": [{"endpoints":
> [{"id": "2", "region": "RegionOne", "internalURL": "
> http://50.56.213.226:8773/services/Cloud", "publicURL": "
> http://50.56.213.226:8773/services/Cloud"}], "type": "ec2", "name":
> "ec2"},
> {"endpoints": [{"id": "3", "region": "RegionOne", "internalURL": "
> http://50.56.213.226:9292/v1", "publicURL": "http://50.56.213.226:9292/v1
> "}],
> "type": "image", "name": "glance"}, {"endpoints": [{"id": "4", "region":
> "RegionOne", "internalURL": "http://50.56.213.226:5000/v2.0",
> "publicURL": "
> http://50.56.213.226:5000/v2.0"}], "type": "identity", "name":
> "keystone"}], "user": {"id": "a438ea90e1da43e4b895874fdaf83a2d", "roles":
> [], "name": "demo"}}}
> # -------- end 19425200:19425360 response ----------
>
> # -------- begin 19425200 request ----------
> curl -i -X GET -H 'Host: 50.56.213.226:8774' -H 'X-LC-Request-ID:
> 19425200'
> -H 'Accept-Encoding: gzip,deflate' -H 'X-Auth-Token:
> 2977320b-56d9-47a9-9c38-4a5b2b0ac8c9' -H 'Content-Length: 0' -H 'Accept:
> application/json' -H 'User-Agent: libcloud/0.8.0 (OpenStack)' --compress '
> https://50.56.213.226:8774/v2/images/detail?cache-busting=786c8c85d9f54028
> '
> # -------- begin 19425200:19295648 response ----------
> HTTP/1.1 404 Not Found
> Date: Fri, 17 Feb 2012 04:17:13 GMT
> Content-Length: 52
> Content-Type: text/plain; charset=UTF-8
>
> 404 Not Found
>
> The resource could not be found.
>
>
> # -------- end 19425200:19295648 response ----------
>
> Traceback (most recent call last):
>  File "stack_demo.py", line 17, in <module>
>    print driver.list_images()
>  File
>
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> line 209, in list_images
>    return self._to_images(self.connection.request('/images/detail')
>  File
>
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> line 151, in request
>    method=method, headers=headers)
>  File
> "/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py", line
> 328, in request
>    return super(OpenStackBaseConnection, self).request(**kwargs)
>  File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
> line 564, in request
>    connection=self)
>  File
>
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> line 774, in __init__
>    super(OpenStack_1_1_Response, self).__init__(*args, **kwargs)
>  File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
> line 77, in __init__
>    raise Exception(self.parse_error())
> Exception: 404 Not Found 404 Not Found
>
> The resource could not be found.
>
> 2012/2/16 Tomaž Muraus <to...@apache.org>
>
> > It looks like you are missing an API version in the URL.
> >
> > Please change the ex_force_base_url='http://%s:8774' % STACK_HOST
> > to ex_force_base_url='http://%s:8774/v2.0' % STACK_HOST
> >
> > Let us know if this solves your problem.
> >
> > On Thu, Feb 16, 2012 at 7:17 PM, Jay Doane <ja...@almery.com> wrote:
> >
> > > 2012/2/16 Tomaž Muraus <to...@apache.org>
> > >
> > > >
> > > > In any case, it does look like an auth API issue. I have merged
> Brad's
> > > Auth
> > > > API changes yesterday so please update your trunk and try again - I
> > think
> > > > his changes should fix your problem.
> > > >
> > >
> > > I pulled the latest code, and you were right: it fixed the tenantId
> > > KeyError.
> > >
> > > Unfortunately, I'm now getting a different error.  My interpretation is
> > > that openstack is giving a 300 response because there is a choice of
> > > response formats, but the libcloud driver is treating that as an error,
> > > since OpenStackResponse.success is implemented to do so.  Details
> below.
> > >
> > > I've simplified my demo code by removing the (working) Eucalyptus
> driver
> > > example, and changed the name to stack_demo.py.  Here's the listing:
> > >
> > > from libcloud.compute.types import Provider
> > > from libcloud.compute.providers import get_driver
> > >
> > > STACK_HOST = '50.56.213.226'
> > > USERNAME = 'demo'
> > > PASSWORD = 'password'
> > >
> > > def openstack_connect():
> > >    Driver = get_driver(Provider.OPENSTACK)
> > >    driver = Driver(USERNAME, PASSWORD, host=STACK_HOST, port=8774,
> > > secure=False,
> > >                  ex_force_auth_url='http://%s:5000' % STACK_HOST,
> > >                  ex_force_auth_version='2.0_password',
> > >                  ex_force_base_url='http://%s:8774' % STACK_HOST)
> > >    return driver
> > >
> > > driver = openstack_connect()
> > > print driver.list_images()
> > >
> > > Here's the output:
> > >
> > > $ LIBCLOUD_DEBUG=/dev/stderr python stack_demo.py
> > > /Users/jay/Library/Python/2.6/site-packages/Crypto/Util/randpool.py:40:
> > > RandomPool_DeprecationWarning: This application uses RandomPool, which
> is
> > > BROKEN in older releases.  See http://www.pycrypto.org/randpool-broken
> > >  RandomPool_DeprecationWarning)
> > > # -------- begin 19425240 request ----------
> > > curl -i -X POST -H 'Host: 50.56.213.226:5000' -H 'Accept-Encoding:
> > > gzip,deflate' -H 'X-LC-Request-ID: 19425240' -H 'Content-Type:
> > > application/json; charset=UTF-8' -H 'Content-Length: 79' -H 'Accept:
> > > application/json' -H 'User-Agent: libcloud/0.8.0 (OpenStack)'
> > --data-binary
> > > '{"auth": {"passwordCredentials": {"username": "demo", "password":
> > > "password"}}}' --compress https://50.56.213.226:5000/v2.0/tokens/
> > > # -------- begin 19425240:19425400 response ----------
> > > HTTP/1.1 200 OK
> > > Date: Fri, 17 Feb 2012 01:45:20 GMT
> > > Content-Type: application/json; charset=UTF-8
> > > Content-Length: 772
> > > Vary: X-Auth-Token
> > >
> > > {"access": {"token": {"expires": "2012-02-16T17:54:14", "id":
> > > "f436424e-6c7d-43e4-ae7c-30f5553c79f3"}, "serviceCatalog":
> [{"endpoints":
> > > [{"id": "2", "region": "RegionOne", "internalURL": "
> > > http://50.56.213.226:8773/services/Cloud", "publicURL": "
> > > http://50.56.213.226:8773/services/Cloud"}], "type": "ec2", "name":
> > > "ec2"},
> > > {"endpoints": [{"id": "3", "region": "RegionOne", "internalURL": "
> > > http://50.56.213.226:9292/v1", "publicURL": "
> > http://50.56.213.226:9292/v1
> > > "}],
> > > "type": "image", "name": "glance"}, {"endpoints": [{"id": "4",
> "region":
> > > "RegionOne", "internalURL": "http://50.56.213.226:5000/v2.0",
> > > "publicURL": "
> > > http://50.56.213.226:5000/v2.0"}], "type": "identity", "name":
> > > "keystone"}], "user": {"id": "a438ea90e1da43e4b895874fdaf83a2d",
> "roles":
> > > [], "name": "demo"}}}
> > > # -------- end 19425240:19425400 response ----------
> > >
> > > # -------- begin 19425240 request ----------
> > > curl -i -X GET -H 'Host: 50.56.213.226:8774' -H 'X-LC-Request-ID:
> > > 19425240'
> > > -H 'Accept-Encoding: gzip,deflate' -H 'X-Auth-Token:
> > > f436424e-6c7d-43e4-ae7c-30f5553c79f3' -H 'Content-Length: 0' -H
> 'Accept:
> > > application/json' -H 'User-Agent: libcloud/0.8.0 (OpenStack)'
> --compress
> > '
> > >
> https://50.56.213.226:8774/images/detail?cache-busting=faeee245cd437497'
> > > # -------- begin 19425240:19295688 response ----------
> > > HTTP/1.1 300 Multiple Choices
> > > Date: Fri, 17 Feb 2012 01:45:20 GMT
> > > Content-Length: 327
> > > Content-Type: application/json
> > >
> > > {"choices": [{"status": "CURRENT", "media-types": [{"base":
> > > "application/xml", "type":
> > > "application/vnd.openstack.compute+xml;version=2"}, {"base":
> > > "application/json", "type":
> > > "application/vnd.openstack.compute+json;version=2"}], "id": "v2.0",
> > > "links": [{"href": "http://50.56.213.226:8774/v2/images/detail",
> "rel":
> > > "self"}]}]}
> > > # -------- end 19425240:19295688 response ----------
> > >
> > > Traceback (most recent call last):
> > >   File "stack_demo.py", line 17, in <module>
> > >    print driver.list_images()
> > >  File
> > >
> > >
> >
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> > > line 209, in list_images
> > >    return self._to_images(self.connection.request('/images/detail')
> > >  File
> > >
> > >
> >
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> > > line 151, in request
> > >    method=method, headers=headers)
> > >  File
> > > "/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py",
> > line
> > > 328, in request
> > >    return super(OpenStackBaseConnection, self).request(**kwargs)
> > >  File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
> > > line 564, in request
> > >    connection=self)
> > >  File
> > >
> > >
> >
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> > > line 774, in __init__
> > >    super(OpenStack_1_1_Response, self).__init__(*args, **kwargs)
> > >  File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
> > > line 77, in __init__
> > >    raise Exception(self.parse_error())
> > >  File
> > >
> > >
> >
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> > > line 111, in parse_error
> > >    in body.values()])
> > > TypeError: list indices must be integers, not str
> > >
> >
>

Re: Anyone using OpenStack driver to access devstack deployment?

Posted by Jay Doane <ja...@almery.com>.
If I change ex_force_base_url='http://%s:8774/v2.0' % STACK_HOST then I get
the same TypeError as before.

However, if I change ex_force_base_url='http://%s:8774/v2' % STACK_HOST
(note the lack of ".0"), I get the following 404:

$ LIBCLOUD_DEBUG=/dev/stderr python stack_demo.py
/Users/jay/Library/Python/2.6/site-packages/Crypto/Util/randpool.py:40:
RandomPool_DeprecationWarning: This application uses RandomPool, which is
BROKEN in older releases.  See http://www.pycrypto.org/randpool-broken
  RandomPool_DeprecationWarning)
# -------- begin 19425200 request ----------
curl -i -X POST -H 'Host: 50.56.213.226:5000' -H 'Accept-Encoding:
gzip,deflate' -H 'X-LC-Request-ID: 19425200' -H 'Content-Type:
application/json; charset=UTF-8' -H 'Content-Length: 79' -H 'Accept:
application/json' -H 'User-Agent: libcloud/0.8.0 (OpenStack)' --data-binary
'{"auth": {"passwordCredentials": {"username": "demo", "password":
"password"}}}' --compress https://50.56.213.226:5000/v2.0/tokens/
# -------- begin 19425200:19425360 response ----------
HTTP/1.1 200 OK
Date: Fri, 17 Feb 2012 04:17:13 GMT
Content-Type: application/json; charset=UTF-8
Content-Length: 772
Vary: X-Auth-Token

{"access": {"token": {"expires": "2012-02-17T18:11:39", "id":
"2977320b-56d9-47a9-9c38-4a5b2b0ac8c9"}, "serviceCatalog": [{"endpoints":
[{"id": "2", "region": "RegionOne", "internalURL": "
http://50.56.213.226:8773/services/Cloud", "publicURL": "
http://50.56.213.226:8773/services/Cloud"}], "type": "ec2", "name": "ec2"},
{"endpoints": [{"id": "3", "region": "RegionOne", "internalURL": "
http://50.56.213.226:9292/v1", "publicURL": "http://50.56.213.226:9292/v1"}],
"type": "image", "name": "glance"}, {"endpoints": [{"id": "4", "region":
"RegionOne", "internalURL": "http://50.56.213.226:5000/v2.0", "publicURL": "
http://50.56.213.226:5000/v2.0"}], "type": "identity", "name":
"keystone"}], "user": {"id": "a438ea90e1da43e4b895874fdaf83a2d", "roles":
[], "name": "demo"}}}
# -------- end 19425200:19425360 response ----------

# -------- begin 19425200 request ----------
curl -i -X GET -H 'Host: 50.56.213.226:8774' -H 'X-LC-Request-ID: 19425200'
-H 'Accept-Encoding: gzip,deflate' -H 'X-Auth-Token:
2977320b-56d9-47a9-9c38-4a5b2b0ac8c9' -H 'Content-Length: 0' -H 'Accept:
application/json' -H 'User-Agent: libcloud/0.8.0 (OpenStack)' --compress '
https://50.56.213.226:8774/v2/images/detail?cache-busting=786c8c85d9f54028'
# -------- begin 19425200:19295648 response ----------
HTTP/1.1 404 Not Found
Date: Fri, 17 Feb 2012 04:17:13 GMT
Content-Length: 52
Content-Type: text/plain; charset=UTF-8

404 Not Found

The resource could not be found.


# -------- end 19425200:19295648 response ----------

Traceback (most recent call last):
  File "stack_demo.py", line 17, in <module>
    print driver.list_images()
  File
"/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
line 209, in list_images
    return self._to_images(self.connection.request('/images/detail')
  File
"/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
line 151, in request
    method=method, headers=headers)
  File
"/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py", line
328, in request
    return super(OpenStackBaseConnection, self).request(**kwargs)
  File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
line 564, in request
    connection=self)
  File
"/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
line 774, in __init__
    super(OpenStack_1_1_Response, self).__init__(*args, **kwargs)
  File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
line 77, in __init__
    raise Exception(self.parse_error())
Exception: 404 Not Found 404 Not Found

The resource could not be found.

2012/2/16 Tomaž Muraus <to...@apache.org>

> It looks like you are missing an API version in the URL.
>
> Please change the ex_force_base_url='http://%s:8774' % STACK_HOST
> to ex_force_base_url='http://%s:8774/v2.0' % STACK_HOST
>
> Let us know if this solves your problem.
>
> On Thu, Feb 16, 2012 at 7:17 PM, Jay Doane <ja...@almery.com> wrote:
>
> > 2012/2/16 Tomaž Muraus <to...@apache.org>
> >
> > >
> > > In any case, it does look like an auth API issue. I have merged Brad's
> > Auth
> > > API changes yesterday so please update your trunk and try again - I
> think
> > > his changes should fix your problem.
> > >
> >
> > I pulled the latest code, and you were right: it fixed the tenantId
> > KeyError.
> >
> > Unfortunately, I'm now getting a different error.  My interpretation is
> > that openstack is giving a 300 response because there is a choice of
> > response formats, but the libcloud driver is treating that as an error,
> > since OpenStackResponse.success is implemented to do so.  Details below.
> >
> > I've simplified my demo code by removing the (working) Eucalyptus driver
> > example, and changed the name to stack_demo.py.  Here's the listing:
> >
> > from libcloud.compute.types import Provider
> > from libcloud.compute.providers import get_driver
> >
> > STACK_HOST = '50.56.213.226'
> > USERNAME = 'demo'
> > PASSWORD = 'password'
> >
> > def openstack_connect():
> >    Driver = get_driver(Provider.OPENSTACK)
> >    driver = Driver(USERNAME, PASSWORD, host=STACK_HOST, port=8774,
> > secure=False,
> >                  ex_force_auth_url='http://%s:5000' % STACK_HOST,
> >                  ex_force_auth_version='2.0_password',
> >                  ex_force_base_url='http://%s:8774' % STACK_HOST)
> >    return driver
> >
> > driver = openstack_connect()
> > print driver.list_images()
> >
> > Here's the output:
> >
> > $ LIBCLOUD_DEBUG=/dev/stderr python stack_demo.py
> > /Users/jay/Library/Python/2.6/site-packages/Crypto/Util/randpool.py:40:
> > RandomPool_DeprecationWarning: This application uses RandomPool, which is
> > BROKEN in older releases.  See http://www.pycrypto.org/randpool-broken
> >  RandomPool_DeprecationWarning)
> > # -------- begin 19425240 request ----------
> > curl -i -X POST -H 'Host: 50.56.213.226:5000' -H 'Accept-Encoding:
> > gzip,deflate' -H 'X-LC-Request-ID: 19425240' -H 'Content-Type:
> > application/json; charset=UTF-8' -H 'Content-Length: 79' -H 'Accept:
> > application/json' -H 'User-Agent: libcloud/0.8.0 (OpenStack)'
> --data-binary
> > '{"auth": {"passwordCredentials": {"username": "demo", "password":
> > "password"}}}' --compress https://50.56.213.226:5000/v2.0/tokens/
> > # -------- begin 19425240:19425400 response ----------
> > HTTP/1.1 200 OK
> > Date: Fri, 17 Feb 2012 01:45:20 GMT
> > Content-Type: application/json; charset=UTF-8
> > Content-Length: 772
> > Vary: X-Auth-Token
> >
> > {"access": {"token": {"expires": "2012-02-16T17:54:14", "id":
> > "f436424e-6c7d-43e4-ae7c-30f5553c79f3"}, "serviceCatalog": [{"endpoints":
> > [{"id": "2", "region": "RegionOne", "internalURL": "
> > http://50.56.213.226:8773/services/Cloud", "publicURL": "
> > http://50.56.213.226:8773/services/Cloud"}], "type": "ec2", "name":
> > "ec2"},
> > {"endpoints": [{"id": "3", "region": "RegionOne", "internalURL": "
> > http://50.56.213.226:9292/v1", "publicURL": "
> http://50.56.213.226:9292/v1
> > "}],
> > "type": "image", "name": "glance"}, {"endpoints": [{"id": "4", "region":
> > "RegionOne", "internalURL": "http://50.56.213.226:5000/v2.0",
> > "publicURL": "
> > http://50.56.213.226:5000/v2.0"}], "type": "identity", "name":
> > "keystone"}], "user": {"id": "a438ea90e1da43e4b895874fdaf83a2d", "roles":
> > [], "name": "demo"}}}
> > # -------- end 19425240:19425400 response ----------
> >
> > # -------- begin 19425240 request ----------
> > curl -i -X GET -H 'Host: 50.56.213.226:8774' -H 'X-LC-Request-ID:
> > 19425240'
> > -H 'Accept-Encoding: gzip,deflate' -H 'X-Auth-Token:
> > f436424e-6c7d-43e4-ae7c-30f5553c79f3' -H 'Content-Length: 0' -H 'Accept:
> > application/json' -H 'User-Agent: libcloud/0.8.0 (OpenStack)' --compress
> '
> > https://50.56.213.226:8774/images/detail?cache-busting=faeee245cd437497'
> > # -------- begin 19425240:19295688 response ----------
> > HTTP/1.1 300 Multiple Choices
> > Date: Fri, 17 Feb 2012 01:45:20 GMT
> > Content-Length: 327
> > Content-Type: application/json
> >
> > {"choices": [{"status": "CURRENT", "media-types": [{"base":
> > "application/xml", "type":
> > "application/vnd.openstack.compute+xml;version=2"}, {"base":
> > "application/json", "type":
> > "application/vnd.openstack.compute+json;version=2"}], "id": "v2.0",
> > "links": [{"href": "http://50.56.213.226:8774/v2/images/detail", "rel":
> > "self"}]}]}
> > # -------- end 19425240:19295688 response ----------
> >
> > Traceback (most recent call last):
> >   File "stack_demo.py", line 17, in <module>
> >    print driver.list_images()
> >  File
> >
> >
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> > line 209, in list_images
> >    return self._to_images(self.connection.request('/images/detail')
> >  File
> >
> >
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> > line 151, in request
> >    method=method, headers=headers)
> >  File
> > "/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py",
> line
> > 328, in request
> >    return super(OpenStackBaseConnection, self).request(**kwargs)
> >  File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
> > line 564, in request
> >    connection=self)
> >  File
> >
> >
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> > line 774, in __init__
> >    super(OpenStack_1_1_Response, self).__init__(*args, **kwargs)
> >  File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
> > line 77, in __init__
> >    raise Exception(self.parse_error())
> >  File
> >
> >
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> > line 111, in parse_error
> >    in body.values()])
> > TypeError: list indices must be integers, not str
> >
>

Re: Anyone using OpenStack driver to access devstack deployment?

Posted by Tomaž Muraus <to...@apache.org>.
It looks like you are missing an API version in the URL.

Please change the ex_force_base_url='http://%s:8774' % STACK_HOST
to ex_force_base_url='http://%s:8774/v2.0' % STACK_HOST

Let us know if this solves your problem.

On Thu, Feb 16, 2012 at 7:17 PM, Jay Doane <ja...@almery.com> wrote:

> 2012/2/16 Tomaž Muraus <to...@apache.org>
>
> >
> > In any case, it does look like an auth API issue. I have merged Brad's
> Auth
> > API changes yesterday so please update your trunk and try again - I think
> > his changes should fix your problem.
> >
>
> I pulled the latest code, and you were right: it fixed the tenantId
> KeyError.
>
> Unfortunately, I'm now getting a different error.  My interpretation is
> that openstack is giving a 300 response because there is a choice of
> response formats, but the libcloud driver is treating that as an error,
> since OpenStackResponse.success is implemented to do so.  Details below.
>
> I've simplified my demo code by removing the (working) Eucalyptus driver
> example, and changed the name to stack_demo.py.  Here's the listing:
>
> from libcloud.compute.types import Provider
> from libcloud.compute.providers import get_driver
>
> STACK_HOST = '50.56.213.226'
> USERNAME = 'demo'
> PASSWORD = 'password'
>
> def openstack_connect():
>    Driver = get_driver(Provider.OPENSTACK)
>    driver = Driver(USERNAME, PASSWORD, host=STACK_HOST, port=8774,
> secure=False,
>                  ex_force_auth_url='http://%s:5000' % STACK_HOST,
>                  ex_force_auth_version='2.0_password',
>                  ex_force_base_url='http://%s:8774' % STACK_HOST)
>    return driver
>
> driver = openstack_connect()
> print driver.list_images()
>
> Here's the output:
>
> $ LIBCLOUD_DEBUG=/dev/stderr python stack_demo.py
> /Users/jay/Library/Python/2.6/site-packages/Crypto/Util/randpool.py:40:
> RandomPool_DeprecationWarning: This application uses RandomPool, which is
> BROKEN in older releases.  See http://www.pycrypto.org/randpool-broken
>  RandomPool_DeprecationWarning)
> # -------- begin 19425240 request ----------
> curl -i -X POST -H 'Host: 50.56.213.226:5000' -H 'Accept-Encoding:
> gzip,deflate' -H 'X-LC-Request-ID: 19425240' -H 'Content-Type:
> application/json; charset=UTF-8' -H 'Content-Length: 79' -H 'Accept:
> application/json' -H 'User-Agent: libcloud/0.8.0 (OpenStack)' --data-binary
> '{"auth": {"passwordCredentials": {"username": "demo", "password":
> "password"}}}' --compress https://50.56.213.226:5000/v2.0/tokens/
> # -------- begin 19425240:19425400 response ----------
> HTTP/1.1 200 OK
> Date: Fri, 17 Feb 2012 01:45:20 GMT
> Content-Type: application/json; charset=UTF-8
> Content-Length: 772
> Vary: X-Auth-Token
>
> {"access": {"token": {"expires": "2012-02-16T17:54:14", "id":
> "f436424e-6c7d-43e4-ae7c-30f5553c79f3"}, "serviceCatalog": [{"endpoints":
> [{"id": "2", "region": "RegionOne", "internalURL": "
> http://50.56.213.226:8773/services/Cloud", "publicURL": "
> http://50.56.213.226:8773/services/Cloud"}], "type": "ec2", "name":
> "ec2"},
> {"endpoints": [{"id": "3", "region": "RegionOne", "internalURL": "
> http://50.56.213.226:9292/v1", "publicURL": "http://50.56.213.226:9292/v1
> "}],
> "type": "image", "name": "glance"}, {"endpoints": [{"id": "4", "region":
> "RegionOne", "internalURL": "http://50.56.213.226:5000/v2.0",
> "publicURL": "
> http://50.56.213.226:5000/v2.0"}], "type": "identity", "name":
> "keystone"}], "user": {"id": "a438ea90e1da43e4b895874fdaf83a2d", "roles":
> [], "name": "demo"}}}
> # -------- end 19425240:19425400 response ----------
>
> # -------- begin 19425240 request ----------
> curl -i -X GET -H 'Host: 50.56.213.226:8774' -H 'X-LC-Request-ID:
> 19425240'
> -H 'Accept-Encoding: gzip,deflate' -H 'X-Auth-Token:
> f436424e-6c7d-43e4-ae7c-30f5553c79f3' -H 'Content-Length: 0' -H 'Accept:
> application/json' -H 'User-Agent: libcloud/0.8.0 (OpenStack)' --compress '
> https://50.56.213.226:8774/images/detail?cache-busting=faeee245cd437497'
> # -------- begin 19425240:19295688 response ----------
> HTTP/1.1 300 Multiple Choices
> Date: Fri, 17 Feb 2012 01:45:20 GMT
> Content-Length: 327
> Content-Type: application/json
>
> {"choices": [{"status": "CURRENT", "media-types": [{"base":
> "application/xml", "type":
> "application/vnd.openstack.compute+xml;version=2"}, {"base":
> "application/json", "type":
> "application/vnd.openstack.compute+json;version=2"}], "id": "v2.0",
> "links": [{"href": "http://50.56.213.226:8774/v2/images/detail", "rel":
> "self"}]}]}
> # -------- end 19425240:19295688 response ----------
>
> Traceback (most recent call last):
>   File "stack_demo.py", line 17, in <module>
>    print driver.list_images()
>  File
>
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> line 209, in list_images
>    return self._to_images(self.connection.request('/images/detail')
>  File
>
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> line 151, in request
>    method=method, headers=headers)
>  File
> "/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py", line
> 328, in request
>    return super(OpenStackBaseConnection, self).request(**kwargs)
>  File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
> line 564, in request
>    connection=self)
>  File
>
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> line 774, in __init__
>    super(OpenStack_1_1_Response, self).__init__(*args, **kwargs)
>  File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
> line 77, in __init__
>    raise Exception(self.parse_error())
>  File
>
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> line 111, in parse_error
>    in body.values()])
> TypeError: list indices must be integers, not str
>

Re: Anyone using OpenStack driver to access devstack deployment?

Posted by Jay Doane <ja...@almery.com>.
2012/2/16 Tomaž Muraus <to...@apache.org>

>
> In any case, it does look like an auth API issue. I have merged Brad's Auth
> API changes yesterday so please update your trunk and try again - I think
> his changes should fix your problem.
>

I pulled the latest code, and you were right: it fixed the tenantId
KeyError.

Unfortunately, I'm now getting a different error.  My interpretation is
that openstack is giving a 300 response because there is a choice of
response formats, but the libcloud driver is treating that as an error,
since OpenStackResponse.success is implemented to do so.  Details below.

I've simplified my demo code by removing the (working) Eucalyptus driver
example, and changed the name to stack_demo.py.  Here's the listing:

from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver

STACK_HOST = '50.56.213.226'
USERNAME = 'demo'
PASSWORD = 'password'

def openstack_connect():
    Driver = get_driver(Provider.OPENSTACK)
    driver = Driver(USERNAME, PASSWORD, host=STACK_HOST, port=8774,
secure=False,
                  ex_force_auth_url='http://%s:5000' % STACK_HOST,
                  ex_force_auth_version='2.0_password',
                  ex_force_base_url='http://%s:8774' % STACK_HOST)
    return driver

driver = openstack_connect()
print driver.list_images()

Here's the output:

$ LIBCLOUD_DEBUG=/dev/stderr python stack_demo.py
/Users/jay/Library/Python/2.6/site-packages/Crypto/Util/randpool.py:40:
RandomPool_DeprecationWarning: This application uses RandomPool, which is
BROKEN in older releases.  See http://www.pycrypto.org/randpool-broken
  RandomPool_DeprecationWarning)
# -------- begin 19425240 request ----------
curl -i -X POST -H 'Host: 50.56.213.226:5000' -H 'Accept-Encoding:
gzip,deflate' -H 'X-LC-Request-ID: 19425240' -H 'Content-Type:
application/json; charset=UTF-8' -H 'Content-Length: 79' -H 'Accept:
application/json' -H 'User-Agent: libcloud/0.8.0 (OpenStack)' --data-binary
'{"auth": {"passwordCredentials": {"username": "demo", "password":
"password"}}}' --compress https://50.56.213.226:5000/v2.0/tokens/
# -------- begin 19425240:19425400 response ----------
HTTP/1.1 200 OK
Date: Fri, 17 Feb 2012 01:45:20 GMT
Content-Type: application/json; charset=UTF-8
Content-Length: 772
Vary: X-Auth-Token

{"access": {"token": {"expires": "2012-02-16T17:54:14", "id":
"f436424e-6c7d-43e4-ae7c-30f5553c79f3"}, "serviceCatalog": [{"endpoints":
[{"id": "2", "region": "RegionOne", "internalURL": "
http://50.56.213.226:8773/services/Cloud", "publicURL": "
http://50.56.213.226:8773/services/Cloud"}], "type": "ec2", "name": "ec2"},
{"endpoints": [{"id": "3", "region": "RegionOne", "internalURL": "
http://50.56.213.226:9292/v1", "publicURL": "http://50.56.213.226:9292/v1"}],
"type": "image", "name": "glance"}, {"endpoints": [{"id": "4", "region":
"RegionOne", "internalURL": "http://50.56.213.226:5000/v2.0", "publicURL": "
http://50.56.213.226:5000/v2.0"}], "type": "identity", "name":
"keystone"}], "user": {"id": "a438ea90e1da43e4b895874fdaf83a2d", "roles":
[], "name": "demo"}}}
# -------- end 19425240:19425400 response ----------

# -------- begin 19425240 request ----------
curl -i -X GET -H 'Host: 50.56.213.226:8774' -H 'X-LC-Request-ID: 19425240'
-H 'Accept-Encoding: gzip,deflate' -H 'X-Auth-Token:
f436424e-6c7d-43e4-ae7c-30f5553c79f3' -H 'Content-Length: 0' -H 'Accept:
application/json' -H 'User-Agent: libcloud/0.8.0 (OpenStack)' --compress '
https://50.56.213.226:8774/images/detail?cache-busting=faeee245cd437497'
# -------- begin 19425240:19295688 response ----------
HTTP/1.1 300 Multiple Choices
Date: Fri, 17 Feb 2012 01:45:20 GMT
Content-Length: 327
Content-Type: application/json

{"choices": [{"status": "CURRENT", "media-types": [{"base":
"application/xml", "type":
"application/vnd.openstack.compute+xml;version=2"}, {"base":
"application/json", "type":
"application/vnd.openstack.compute+json;version=2"}], "id": "v2.0",
"links": [{"href": "http://50.56.213.226:8774/v2/images/detail", "rel":
"self"}]}]}
# -------- end 19425240:19295688 response ----------

Traceback (most recent call last):
  File "stack_demo.py", line 17, in <module>
    print driver.list_images()
  File
"/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
line 209, in list_images
    return self._to_images(self.connection.request('/images/detail')
  File
"/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
line 151, in request
    method=method, headers=headers)
  File
"/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py", line
328, in request
    return super(OpenStackBaseConnection, self).request(**kwargs)
  File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
line 564, in request
    connection=self)
  File
"/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
line 774, in __init__
    super(OpenStack_1_1_Response, self).__init__(*args, **kwargs)
  File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
line 77, in __init__
    raise Exception(self.parse_error())
  File
"/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
line 111, in parse_error
    in body.values()])
TypeError: list indices must be integers, not str

Re: Anyone using OpenStack driver to access devstack deployment?

Posted by Tomaž Muraus <to...@apache.org>.
Previous email didn't contain an attachment (probably mailing list spam
filter removed it or something).

In any case, it does look like an auth API issue. I have merged Brad's Auth
API changes yesterday so please update your trunk and try again - I think
his changes should fix your problem.

On Thu, Feb 16, 2012 at 10:04 AM, Jay Doane <ja...@almery.com> wrote:

> 2012/2/15 Tomaž Muraus <to...@apache.org>
>
> >
> > Can you please attach the code which shows how you are instantiating the
> > OpenStack driver (don't forget to mask / remove the credentials)?
> >
>
> The code was attached to my last message, but I'll put it here in the body
> as well:
>
> from libcloud.compute.types import Provider
> from libcloud.compute.providers import get_driver
>
> STACK_HOST = '50.56.213.226'
> USERNAME = 'demo'
> PASSWORD = 'password'
>
> def openstack_connect():
>    Driver = get_driver(Provider.OPENSTACK)
>    driver = Driver(USERNAME, PASSWORD, host=STACK_HOST, port=8774,
> secure=False,
>                  ex_force_auth_url='http://%s:5000' % STACK_HOST,
>                  ex_force_auth_version='2.0_password',
>                   ex_force_base_url='http://%s:8774' % STACK_HOST)
>     return driver
>
> def eucalyptus_connect():
>    Driver = get_driver(Provider.EUCALYPTUS)
>    driver = Driver(USERNAME, PASSWORD, host=STACK_HOST, port=8773,
> secure=False,
>                  path="/services/Cloud")
>    return driver
>
> print eucalyptus_connect().list_images()
> print openstack_connect().list_images()
>
> It would be also be useful to paste the output of
> > LIBCLOUD_DEBUG=/dev/stderr python stack_test.py.
> >
>
> jay@alu:~/proj/genforma/libcloud.git$ LIBCLOUD_DEBUG=/dev/stderr python
>
> stack_test.py/Users/jay/Library/Python/2.6/site-packages/Crypto/Util/randpool.py:40
> :
> RandomPool_DeprecationWarning: This application uses RandomPool, which is
> BROKEN in older releases.  See http://www.pycrypto.org/randpool-broken
>  RandomPool_DeprecationWarning)
> # -------- begin 19324600 request ----------
> curl -i -X GET -H 'Host: 50.56.213.226:8773' -H 'X-LC-Request-ID:
> 19324600'
> -H 'Content-Length: 0' -H 'Accept-Encoding: gzip,deflate' -H 'User-Agent:
> libcloud/0.8.0 (Eucalyptus)' --compress '
>
> https://50.56.213.226:8773/services/Cloud?SignatureVersion=2&AWSAccessKeyId=demo&Timestamp=2012-02-16T18%3A01%3A45Z&SignatureMethod=HmacSHA256&Version=2010-08-31&Signature=%2Fpmh1RDZacElc0hVwojf8rQvMCntjPAkTlg0bGv2woo%3D&Action=DescribeImages
> '
> # -------- begin 19324600:19296584 response ----------
> HTTP/1.1 200 OK
> Date: Thu, 16 Feb 2012 18:01:53 GMT
> Content-Length: 911
> Content-Type: text/xml
>
> <?xml version="1.0" ?><DescribeImagesResponse xmlns="
> http://ec2.amazonaws.com/doc/2010-08-31/
> "><requestId>req-f2405b03-2463-48a6-80fd-9af99e8de768</requestId><imagesSet><item><description/><imageOwnerId/><isPublic>true</isPublic><imageId>aki-00000001</imageId><imageState>available</imageState><architecture/><imageLocation>None
>
> (oneiric-server-cloudimg-amd64-kernel)</imageLocation><rootDeviceType>instance-store</rootDeviceType><rootDeviceName>/dev/sda1</rootDeviceName><imageType>kernel</imageType></item><item><description/><imageOwnerId/><isPublic>true</isPublic><imageId>ami-00000002</imageId><imageState>available</imageState><rootDeviceType>instance-store</rootDeviceType><architecture/><imageLocation>None
>
> (oneiric-server-cloudimg-amd64)</imageLocation><kernelId>aki-00000001</kernelId><rootDeviceName>/dev/sda1</rootDeviceName><imageType>machine</imageType></item></imagesSet></DescribeImagesResponse>
> # -------- end 19324600:19296584 response ----------
>
> [<NodeImage: id=aki-00000001, name=None
> (oneiric-server-cloudimg-amd64-kernel), driver=Eucalyptus  ...>,
> <NodeImage: id=ami-00000002, name=None (oneiric-server-cloudimg-amd64),
> driver=Eucalyptus  ...>]
> # -------- begin 19457048 request ----------
> curl -i -X POST -H 'Host: 50.56.213.226:5000' -H 'Accept-Encoding:
> gzip,deflate' -H 'X-LC-Request-ID: 19457048' -H 'Content-Type:
> application/json; charset=UTF-8' -H 'Content-Length: 79' -H 'Accept:
> application/json' -H 'User-Agent: libcloud/0.8.0 (OpenStack)' --data-binary
> '{"auth": {"passwordCredentials": {"username": "demo", "password":
> "password"}}}' --compress https://50.56.213.226:5000/v2.0/tokens/
> # -------- begin 19457048:19481464 response ----------
> HTTP/1.1 200 OK
> Date: Thu, 16 Feb 2012 18:01:53 GMT
> Content-Type: application/json; charset=UTF-8
> Content-Length: 772
> Vary: X-Auth-Token
>
> {"access": {"token": {"expires": "2012-02-16T17:54:14", "id":
> "f436424e-6c7d-43e4-ae7c-30f5553c79f3"}, "serviceCatalog": [{"endpoints":
> [{"id": "2", "region": "RegionOne", "internalURL": "
> http://50.56.213.226:8773/services/Cloud", "publicURL": "
> http://50.56.213.226:8773/services/Cloud"}], "type": "ec2", "name":
> "ec2"},
> {"endpoints": [{"id": "3", "region": "RegionOne", "internalURL": "
> http://50.56.213.226:9292/v1", "publicURL": "http://50.56.213.226:9292/v1
> "}],
> "type": "image", "name": "glance"}, {"endpoints": [{"id": "4", "region":
> "RegionOne", "internalURL": "http://50.56.213.226:5000/v2.0",
> "publicURL": "
> http://50.56.213.226:5000/v2.0"}], "type": "identity", "name":
> "keystone"}], "user": {"id": "a438ea90e1da43e4b895874fdaf83a2d", "roles":
> [], "name": "demo"}}}
> # -------- end 19457048:19481464 response ----------
>
> Traceback (most recent call last):
>   File "stack_test.py", line 25, in <module>
>    print openstack_connect().list_images()
>  File "stack_test.py", line 15, in openstack_connect
>     ex_force_base_url='http://%s:8774' % STACK_HOST)
>  File
>
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> line 795, in __init__
>    super(OpenStack_1_1_NodeDriver, self).__init__(*args, **kwargs)
>  File "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/base.py",
> line 397, in __init__
>    api_version=api_version)
>  File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
> line 802, in __init__
>    self.connection.connect()
>  File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
> line 427, in connect
>    if getattr(self, 'base_url', None) and base_url == None:
>  File
> "/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py", line
> 249, in base_url
>    return self._get_base_url(url_key=self._url_key)
>  File
> "/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py", line
> 254, in _get_base_url
>    self._populate_hosts_and_request_paths()
>  File
> "/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py", line
> 300, in _populate_hosts_and_request_paths
>    self.tenant_ids[service_type] = service['endpoints'][0]['tenantId']
> KeyError: 'tenantId'
>
> >
> > In any case, Brad Morgan has recently made some changes and improvements
> to
> > the OpenStack authentication classes -
> > https://github.com/apache/libcloud/pull/58. Now the tenantId is not
> > automatically parsed from the auth API response anymore and this might
> fix
> > your problem. His changes should be merged to trunk soon - probably today
> > or tomorrow.
> >
>
> Great!  Thanks for the help.
>
> Jay
>
> >
> > On Wed, Feb 15, 2012 at 9:06 PM, Jay Doane <ja...@almery.com> wrote:
> >
> > > Greetings,
> > >
> > > I followed the directions at
> http://devstack.org/guides/single-vm.htmlto
> > > deploy OpenStack on a single host, and everything works as expected
> from
> > > the web interface.
> > >
> > > I would like to access my OpenStack dev environment with (a recent dev
> > > version oflibcloud, but seem to only be able to do so using the
> > Eucalyptus
> > > driver; the OpenStack driver gives me the following error (running the
> > > attached code):
> > >
> > > jay@alu:~/proj/genforma/libcloud.git$ python stack_test.py
> > > [<NodeImage: id=aki-00000001, name=None
> > > (oneiric-server-cloudimg-amd64-kernel), driver=Eucalyptus  ...>,
> > > <NodeImage: id=ami-00000002, name=None (oneiric-server-cloudimg-amd64),
> > > driver=Eucalyptus  ...>]
> > > Traceback (most recent call last):
> > >   File "stack_test.py", line 23, in <module>
> > >     print openstack_connect().list_images()
> > >   File "stack_test.py", line 13, in openstack_connect
> > >     ex_force_base_url='http://%s:8774' % STACK_HOST)
> > >   File
> > >
> >
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> > > line 795, in __init__
> > >     super(OpenStack_1_1_NodeDriver, self).__init__(*args, **kwargs)
> > >   File
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/base.py",
> > > line 397, in __init__
> > >     api_version=api_version)
> > >   File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
> > > line 802, in __init__
> > >     self.connection.connect()
> > >   File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
> > > line 427, in connect
> > >     if getattr(self, 'base_url', None) and base_url == None:
> > >   File
> > > "/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py",
> > line
> > > 249, in base_url
> > >     return self._get_base_url(url_key=self._url_key)
> > >   File
> > > "/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py",
> > line
> > > 254, in _get_base_url
> > >     self._populate_hosts_and_request_paths()
> > >   File
> > > "/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py",
> > line
> > > 300, in _populate_hosts_and_request_paths
> > >     self.tenant_ids[service_type] = service['endpoints'][0]['tenantId']
> > > KeyError: 'tenantId'
> > >
> > > Has anyone else successfully used the libcloud OpenStack driver to
> access
> > > a recent devstack deployment?  Or is there something obviously wrong
> with
> > > how I'm instantiating my OpenStack driver?
> > >
> > > Thanks,
> > > Jay
> > >
> > >
> > >
> > >
> >
>

Re: Anyone using OpenStack driver to access devstack deployment?

Posted by Jay Doane <ja...@almery.com>.
2012/2/15 Tomaž Muraus <to...@apache.org>

>
> Can you please attach the code which shows how you are instantiating the
> OpenStack driver (don't forget to mask / remove the credentials)?
>

The code was attached to my last message, but I'll put it here in the body
as well:

from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver

STACK_HOST = '50.56.213.226'
USERNAME = 'demo'
PASSWORD = 'password'

def openstack_connect():
    Driver = get_driver(Provider.OPENSTACK)
    driver = Driver(USERNAME, PASSWORD, host=STACK_HOST, port=8774,
secure=False,
                  ex_force_auth_url='http://%s:5000' % STACK_HOST,
                  ex_force_auth_version='2.0_password',
                  ex_force_base_url='http://%s:8774' % STACK_HOST)
    return driver

def eucalyptus_connect():
    Driver = get_driver(Provider.EUCALYPTUS)
    driver = Driver(USERNAME, PASSWORD, host=STACK_HOST, port=8773,
secure=False,
                  path="/services/Cloud")
    return driver

print eucalyptus_connect().list_images()
print openstack_connect().list_images()

It would be also be useful to paste the output of
> LIBCLOUD_DEBUG=/dev/stderr python stack_test.py.
>

jay@alu:~/proj/genforma/libcloud.git$ LIBCLOUD_DEBUG=/dev/stderr python
stack_test.py/Users/jay/Library/Python/2.6/site-packages/Crypto/Util/randpool.py:40:
RandomPool_DeprecationWarning: This application uses RandomPool, which is
BROKEN in older releases.  See http://www.pycrypto.org/randpool-broken
  RandomPool_DeprecationWarning)
# -------- begin 19324600 request ----------
curl -i -X GET -H 'Host: 50.56.213.226:8773' -H 'X-LC-Request-ID: 19324600'
-H 'Content-Length: 0' -H 'Accept-Encoding: gzip,deflate' -H 'User-Agent:
libcloud/0.8.0 (Eucalyptus)' --compress '
https://50.56.213.226:8773/services/Cloud?SignatureVersion=2&AWSAccessKeyId=demo&Timestamp=2012-02-16T18%3A01%3A45Z&SignatureMethod=HmacSHA256&Version=2010-08-31&Signature=%2Fpmh1RDZacElc0hVwojf8rQvMCntjPAkTlg0bGv2woo%3D&Action=DescribeImages
'
# -------- begin 19324600:19296584 response ----------
HTTP/1.1 200 OK
Date: Thu, 16 Feb 2012 18:01:53 GMT
Content-Length: 911
Content-Type: text/xml

<?xml version="1.0" ?><DescribeImagesResponse xmlns="
http://ec2.amazonaws.com/doc/2010-08-31/"><requestId>req-f2405b03-2463-48a6-80fd-9af99e8de768</requestId><imagesSet><item><description/><imageOwnerId/><isPublic>true</isPublic><imageId>aki-00000001</imageId><imageState>available</imageState><architecture/><imageLocation>None
(oneiric-server-cloudimg-amd64-kernel)</imageLocation><rootDeviceType>instance-store</rootDeviceType><rootDeviceName>/dev/sda1</rootDeviceName><imageType>kernel</imageType></item><item><description/><imageOwnerId/><isPublic>true</isPublic><imageId>ami-00000002</imageId><imageState>available</imageState><rootDeviceType>instance-store</rootDeviceType><architecture/><imageLocation>None
(oneiric-server-cloudimg-amd64)</imageLocation><kernelId>aki-00000001</kernelId><rootDeviceName>/dev/sda1</rootDeviceName><imageType>machine</imageType></item></imagesSet></DescribeImagesResponse>
# -------- end 19324600:19296584 response ----------

[<NodeImage: id=aki-00000001, name=None
(oneiric-server-cloudimg-amd64-kernel), driver=Eucalyptus  ...>,
<NodeImage: id=ami-00000002, name=None (oneiric-server-cloudimg-amd64),
driver=Eucalyptus  ...>]
# -------- begin 19457048 request ----------
curl -i -X POST -H 'Host: 50.56.213.226:5000' -H 'Accept-Encoding:
gzip,deflate' -H 'X-LC-Request-ID: 19457048' -H 'Content-Type:
application/json; charset=UTF-8' -H 'Content-Length: 79' -H 'Accept:
application/json' -H 'User-Agent: libcloud/0.8.0 (OpenStack)' --data-binary
'{"auth": {"passwordCredentials": {"username": "demo", "password":
"password"}}}' --compress https://50.56.213.226:5000/v2.0/tokens/
# -------- begin 19457048:19481464 response ----------
HTTP/1.1 200 OK
Date: Thu, 16 Feb 2012 18:01:53 GMT
Content-Type: application/json; charset=UTF-8
Content-Length: 772
Vary: X-Auth-Token

{"access": {"token": {"expires": "2012-02-16T17:54:14", "id":
"f436424e-6c7d-43e4-ae7c-30f5553c79f3"}, "serviceCatalog": [{"endpoints":
[{"id": "2", "region": "RegionOne", "internalURL": "
http://50.56.213.226:8773/services/Cloud", "publicURL": "
http://50.56.213.226:8773/services/Cloud"}], "type": "ec2", "name": "ec2"},
{"endpoints": [{"id": "3", "region": "RegionOne", "internalURL": "
http://50.56.213.226:9292/v1", "publicURL": "http://50.56.213.226:9292/v1"}],
"type": "image", "name": "glance"}, {"endpoints": [{"id": "4", "region":
"RegionOne", "internalURL": "http://50.56.213.226:5000/v2.0", "publicURL": "
http://50.56.213.226:5000/v2.0"}], "type": "identity", "name":
"keystone"}], "user": {"id": "a438ea90e1da43e4b895874fdaf83a2d", "roles":
[], "name": "demo"}}}
# -------- end 19457048:19481464 response ----------

Traceback (most recent call last):
  File "stack_test.py", line 25, in <module>
    print openstack_connect().list_images()
  File "stack_test.py", line 15, in openstack_connect
    ex_force_base_url='http://%s:8774' % STACK_HOST)
  File
"/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
line 795, in __init__
    super(OpenStack_1_1_NodeDriver, self).__init__(*args, **kwargs)
  File "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/base.py",
line 397, in __init__
    api_version=api_version)
  File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
line 802, in __init__
    self.connection.connect()
  File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
line 427, in connect
    if getattr(self, 'base_url', None) and base_url == None:
  File
"/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py", line
249, in base_url
    return self._get_base_url(url_key=self._url_key)
  File
"/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py", line
254, in _get_base_url
    self._populate_hosts_and_request_paths()
  File
"/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py", line
300, in _populate_hosts_and_request_paths
    self.tenant_ids[service_type] = service['endpoints'][0]['tenantId']
KeyError: 'tenantId'

>
> In any case, Brad Morgan has recently made some changes and improvements to
> the OpenStack authentication classes -
> https://github.com/apache/libcloud/pull/58. Now the tenantId is not
> automatically parsed from the auth API response anymore and this might fix
> your problem. His changes should be merged to trunk soon - probably today
> or tomorrow.
>

Great!  Thanks for the help.

Jay

>
> On Wed, Feb 15, 2012 at 9:06 PM, Jay Doane <ja...@almery.com> wrote:
>
> > Greetings,
> >
> > I followed the directions at http://devstack.org/guides/single-vm.htmlto
> > deploy OpenStack on a single host, and everything works as expected from
> > the web interface.
> >
> > I would like to access my OpenStack dev environment with (a recent dev
> > version oflibcloud, but seem to only be able to do so using the
> Eucalyptus
> > driver; the OpenStack driver gives me the following error (running the
> > attached code):
> >
> > jay@alu:~/proj/genforma/libcloud.git$ python stack_test.py
> > [<NodeImage: id=aki-00000001, name=None
> > (oneiric-server-cloudimg-amd64-kernel), driver=Eucalyptus  ...>,
> > <NodeImage: id=ami-00000002, name=None (oneiric-server-cloudimg-amd64),
> > driver=Eucalyptus  ...>]
> > Traceback (most recent call last):
> >   File "stack_test.py", line 23, in <module>
> >     print openstack_connect().list_images()
> >   File "stack_test.py", line 13, in openstack_connect
> >     ex_force_base_url='http://%s:8774' % STACK_HOST)
> >   File
> >
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> > line 795, in __init__
> >     super(OpenStack_1_1_NodeDriver, self).__init__(*args, **kwargs)
> >   File "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/base.py",
> > line 397, in __init__
> >     api_version=api_version)
> >   File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
> > line 802, in __init__
> >     self.connection.connect()
> >   File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
> > line 427, in connect
> >     if getattr(self, 'base_url', None) and base_url == None:
> >   File
> > "/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py",
> line
> > 249, in base_url
> >     return self._get_base_url(url_key=self._url_key)
> >   File
> > "/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py",
> line
> > 254, in _get_base_url
> >     self._populate_hosts_and_request_paths()
> >   File
> > "/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py",
> line
> > 300, in _populate_hosts_and_request_paths
> >     self.tenant_ids[service_type] = service['endpoints'][0]['tenantId']
> > KeyError: 'tenantId'
> >
> > Has anyone else successfully used the libcloud OpenStack driver to access
> > a recent devstack deployment?  Or is there something obviously wrong with
> > how I'm instantiating my OpenStack driver?
> >
> > Thanks,
> > Jay
> >
> >
> >
> >
>

Re: Anyone using OpenStack driver to access devstack deployment?

Posted by Tomaž Muraus <to...@apache.org>.
Hi,

Can you please attach the code which shows how you are instantiating the
OpenStack driver (don't forget to mask / remove the credentials)?

It would be also be useful to paste the output of
LIBCLOUD_DEBUG=/dev/stderr python stack_test.py.

In any case, Brad Morgan has recently made some changes and improvements to
the OpenStack authentication classes -
https://github.com/apache/libcloud/pull/58. Now the tenantId is not
automatically parsed from the auth API response anymore and this might fix
your problem. His changes should be merged to trunk soon - probably today
or tomorrow.

On Wed, Feb 15, 2012 at 9:06 PM, Jay Doane <ja...@almery.com> wrote:

> Greetings,
>
> I followed the directions at http://devstack.org/guides/single-vm.html to
> deploy OpenStack on a single host, and everything works as expected from
> the web interface.
>
> I would like to access my OpenStack dev environment with (a recent dev
> version oflibcloud, but seem to only be able to do so using the Eucalyptus
> driver; the OpenStack driver gives me the following error (running the
> attached code):
>
> jay@alu:~/proj/genforma/libcloud.git$ python stack_test.py
> [<NodeImage: id=aki-00000001, name=None
> (oneiric-server-cloudimg-amd64-kernel), driver=Eucalyptus  ...>,
> <NodeImage: id=ami-00000002, name=None (oneiric-server-cloudimg-amd64),
> driver=Eucalyptus  ...>]
> Traceback (most recent call last):
>   File "stack_test.py", line 23, in <module>
>     print openstack_connect().list_images()
>   File "stack_test.py", line 13, in openstack_connect
>     ex_force_base_url='http://%s:8774' % STACK_HOST)
>   File
> "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/drivers/openstack.py",
> line 795, in __init__
>     super(OpenStack_1_1_NodeDriver, self).__init__(*args, **kwargs)
>   File "/Users/jay/proj/genforma/libcloud.git/libcloud/compute/base.py",
> line 397, in __init__
>     api_version=api_version)
>   File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
> line 802, in __init__
>     self.connection.connect()
>   File "/Users/jay/proj/genforma/libcloud.git/libcloud/common/base.py",
> line 427, in connect
>     if getattr(self, 'base_url', None) and base_url == None:
>   File
> "/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py", line
> 249, in base_url
>     return self._get_base_url(url_key=self._url_key)
>   File
> "/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py", line
> 254, in _get_base_url
>     self._populate_hosts_and_request_paths()
>   File
> "/Users/jay/proj/genforma/libcloud.git/libcloud/common/openstack.py", line
> 300, in _populate_hosts_and_request_paths
>     self.tenant_ids[service_type] = service['endpoints'][0]['tenantId']
> KeyError: 'tenantId'
>
> Has anyone else successfully used the libcloud OpenStack driver to access
> a recent devstack deployment?  Or is there something obviously wrong with
> how I'm instantiating my OpenStack driver?
>
> Thanks,
> Jay
>
>
>
>