[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] How to use xcp-xapi and python binding on ubuntu


  • To: <xen-api@xxxxxxxxxxxxx>
  • From: 이재호 <hyacin@xxxxxxxxxx>
  • Date: Tue, 20 Mar 2012 10:59:15 +0900
  • Delivery-date: Tue, 20 Mar 2012 16:42:26 +0000
  • List-id: Discussion of API issues surrounding Xen <xen-api.lists.xen.org>
  • Thread-index: Ac0GODn4bmll7+OBS7Ozj1bdy1rD1g==

Hello,

My name is jaeho Lee and I am from Korea.

 

I want to develop xen-web-management software as using python and xcp-xapi on ubuntu precise.

 

I have installed xcp-xapi on the ubuntu precise.

-       I refer to this site “http://wiki.xen.org/wiki/Project_Kronos#Using_XCP_-_preparing_the_toolstack”.

 

My questions is like below.

1.     xapi deamon is xml-rpc server and can I use it through python?

-       I tried to find related site or documents but I couldn’t know what is right one.

(There are too many documents.)

-       I checked it like this “netstat –anp | grep xapi” and it seem to work as a xml-rpc server.

tcp        0      0 127.0.0.1:80            0.0.0.0:*               LISTEN      1362/xapi

unix  2      [ ACC ]     STREAM     LISTENING     2006     1362/xapi           /var/lib/xcp/storage

unix  2      [ ACC ]     STREAM     LISTENING     2008     1362/xapi           /var/lib/xcp/xapi

unix  3      [ ]         STREAM     CONNECTED     9033     1362/xapi

unix  2      [ ]         DGRAM                    2005     1362/xapi

unix  3      [ ]         STREAM     CONNECTED     1959     1353/xapi

unix  2      [ ]         DGRAM                    1958     1353/xapi

 

2.     Is there any default account and password?

-       I tried to login as “pool-admin”, but failed.

-       The error message is like this “SESSION_AUTHENTICATION_FAILED”.

(Is that because of wrong password or user name? or other problem)

 

If I can get right documents or some hints related to xcp-xapi on ubuntu precise it will be very helpful for me.

 

Please refer to the below things.

I tried to test authentication.

<The simple code is like below.>

import sys, time

import XenAPI

from pprint import pprint

 

if __name__ == "__main__":

#    if len(sys.argv) <> 4:

#        print "Usage:"

#        print sys.argv[0], " <url> <username> <password>"

#        sys.exit(1)

    url = "">

    username = "admin"

    password = ""

 

def main(sx):

    print "main"

    vms = sx.VM.get_all()

    real_vms = [ x for x in vms if not sx.VM.get_is_a_template(x)]

    pprint ( [sx.VM.get_name_label(x) for x in real_vms] )

 

if __name__ == "__main__":

#    if len(sys.argv) <> 4:

#        print "Usage:"

#        print sys.argv[0], " <url> <username> <password>"

#        sys.exit(1)

    url = "">

    username = "admin"

    password = ""

    print "List of non-template VMs on %s" %url

    # First acquire a valid session by logging in:

    session = XenAPI.Session(url)

 

    session.xenapi.login_with_password(username, password)

 

    session.xenapi.VM.get_all()

 

<The result is like below>

root@vstb:~/VSTB/test_python# python2.7 test.py

List of non-template VMs on http://localhost

Traceback (most recent call last):

 File "test.py", line 40, in <module>

    session.xenapi.login_with_password(username, password)

  File "/usr/lib/python2.7/dist-packages/XenAPI.py", line 235, in __call__

    return self.__send(self.__name, args)

  File "/usr/lib/python2.7/dist-packages/XenAPI.py", line 130, in xenapi_request

    self._login(methodname, params)

  File "/usr/lib/python2.7/dist-packages/XenAPI.py", line 154, in _login

    result = _parse_result(getattr(self, 'session.%s' % method)(*params))

  File "/usr/lib/python2.7/dist-packages/XenAPI.py", line 209, in _parse_result

    raise Failure(result['ErrorDescription'])

XenAPI.Failure: ['SESSION_AUTHENTICATION_FAILED', 'admin', 'Authentication failure']

root@vstb:~/VSTB/test_python#

 

Thank you.

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxx
http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.