Hi Derrick,

Not sure which version of openstack you are using, but for a stable/essex
devstack, I've had success with this code:

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

STACKHOST = 'devstack'
TENANTNAME = 'demo'
USERNAME = 'demo'
PASSWORD = 'pass'

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

Cheers,
Jay

On Sat, Apr 28, 2012 at 7:37 AM, Derrick Karimi <[email protected]>wrote:

> I believe I got latest sources from git (0.9.1) with:
>
> git clone git://github.com/apache/libcloud.git
>
> I tweaked the example you provided for my environment:
>
> driver = OpenStack('admin', 'secrete',
>                   ex_force_auth_url='http://10.99.0.1:5000/v2.0',
>                   ex_force_auth_version='2.0_password',
>                   ex_tenant_name ='mytenant')
>
> When I run it I get:
>
> [root@blue libcloud]# python mytest.py
> /usr/lib/python2.6/site-packages/libcloud/httplib_ssl.py:57: UserWarning:
> SSL certificate verification is disabled, this can pose a security risk.
> For more information how to enable the SSL certificate verification, please
> visit the libcloud documentation.
>  warnings.warn(libcloud.security.VERIFY_SSL_DISABLED_MSG)
> Traceback (most recent call last):
>  File "mytest.py", line 21, in <module>
>    nodes = driver.list_nodes()
>  File
> "/usr/lib/python2.6/site-packages/libcloud/compute/drivers/openstack.py",
> line 210, in list_nodes
>    return self._to_nodes(self.connection.request('/servers/detail')
>  File
> "/usr/lib/python2.6/site-packages/libcloud/compute/drivers/openstack.py",
> line 152, in request
>    method=method, headers=headers)
>  File "/usr/lib/python2.6/site-packages/libcloud/common/openstack.py",
> line 433, in request
>    self._populate_hosts_and_request_paths()
>  File "/usr/lib/python2.6/site-packages/libcloud/common/openstack.py",
> line 465, in _populate_hosts_and_request_paths
>    (self.host, self.port, self.secure, self.request_path) =
> self._tuple_from_url(self._ex_force_base_url or self.get_endpoint())
>  File "/usr/lib/python2.6/site-packages/libcloud/common/openstack.py",
> line 421, in get_endpoint
>    raise LibcloudError('Could not find specified endpoint')
> libcloud.common.types.LibcloudError: <LibcloudError in None 'Could not find
> specified endpoint'>
>
> I am not sure what "could not find specified endpoint" means, but I can do
> this:
>
> [root@blue libcloud]# curl 10.99.0.1:5000/v2.0
> {
>    "version" : {
>        "id" : "v2.0",
>        "status" : "ALPHA",
>        "updated" : "2011-11-19T00:00:00Z",
>        "links": [
>            {
>                "rel" : "self",
>                "href" : "http://10.99.0.1:5000/v2.0/";
>            },
>            {
>                "rel" : "describedby",
>                "type" : "text/html",
>                "href" : "
> http://docs.openstack.org/api/openstack-identity-service/2.0/content/";
>            },
>            {
>                "rel" : "describedby",
>                "type" : "application/pdf",
>                "href" : "
>
> http://docs.openstack.org/api/openstack-identity-service/2.0/identity-dev-guide-2.0.pdf
> "
>            },
>            {
>                "rel" : "describedby",
>                "type" : "application/vnd.sun.wadl+xml",
>                "href" : "http://10.99.0.1:5000/v2.0/identity.wadl";
>            }
>        ],
>        "media-types": [
>            {
>                "base" : "application/xml",
>                "type" : "application/vnd.openstack.identity-v2.0+xml"
>            },
>            {
>                "base" : "application/json",
>                "type" : "application/vnd.openstack.identity-v2.0+json"
>            }
>        ]
>    }
> }
>
> Thank you for pointing me to the example.  In the mean time I have
> specified a eucalyptus driver, and that is working when I supply my EC2
> credentials.  However for my current goals, I need to get the OpenStack
> driver working as well.
>
> --Derrick
>
>
>
> On Fri, Apr 27, 2012 at 11:28 PM, Tomaž Muraus <[email protected]> wrote:
>
> > I'm not exactly sure how to do this with lc-tools, but here is an example
> > which shows how to boot an OpenStack node using traystack.org -
> > http://libcloud.apache.org/docs/compute-examples.html
> >
> > Similar code should work with a local OpenStack installation.
> >
> > Also, are you using the latest version of Libcloud (0.9.1)?
> >
> > On Fri, Apr 27, 2012 at 3:56 PM, Derrick Karimi <
> [email protected]
> > >wrote:
> >
> > > Hi, I am new to the list, and to libCloud.  I attempted to install from
> > > source and interface it through lc-tools.
> > >
> > > I am running an OpenStack right now, with keystone authentication.
> > >
> > > In my environment I have:
> > > OS_AUTH_URL=http://$Keystone_server_IP_address:5000/v2.0/
> > >
> > > But when I run lc-image-list:
> > >
> > > # lc-image-list
> > > /usr/lib/python2.6/site-packages/libcloud/httplib_ssl.py:57:
> UserWarning:
> > > SSL certificate verification is disabled, this can pose a security
> risk.
> > > For more information how to enable the SSL certificate verification,
> > please
> > > visit the libcloud documentation.
> > >  warnings.warn(libcloud.security.VERIFY_SSL_DISABLED_MSG)
> > > Error: <LibcloudError in None 'OpenStack instance must have auth_url
> > set'>
> > >
> > > I have tried entering auth_url several different ways into my ~/.lcrc,
> > how
> > > does one set this so libCloud knows it?
> > >
> > > Where can I find the documentation for which variables need to be set
> for
> > > the OpenStack driver?  Or do you just look at the code?
> > >
> > >
> > > --
> > > --Derrick
> > >
> >
>
>
>
> --
> --Derrick
>

Reply via email to