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

Re: [libvirt-users] Is libvirt supported on Citrix Xenserver?



2011/7/16 G Naresh Kumar <naresh gadepalli gmail com>:
> Hi Matthias,
>
>
>
> Sorry for the confusion.It was an edited one & hence the typo. Below is the
>
> actual output:
>
>
>
> # virsh -c xenapi://<myip>
>
> Enter username for <myip>: root
>
> Enter root's password for <myip>:
>
> error: authentication failed: (null)
>
>
>
> I was not able to get anything in the Xen logs. Somehow figured out to print
>
> the Xen error using the patch given at the link http://osdir.com/ml/libvir-
>
> list/2011-06/msg00298.html. It prints "TRANSPORT_FAULT". Any pointers to
> this
>
> error would be much appreciated. Iam also trying to debug this issue.

The mentioned patch is part of libvirt 0.9.3, but it has a problem. It
altered the call to xenapiSessionErrorHandler in xenapiOpen in a way
that breaks error reporting. libxenserver returns a list of strings
that represents the complete error message. xenapiSessionErrorHandler
with last parameter set to NULL, composes all parts of the error
message into a single string. But the mentioned patch only takes the
first part, in your case "TRANSPORT_FAULT". The second part of that
error message is an numeric error code that might help to understand
the problem.

I just posed a patch to be applied on top of current git to fix this

  https://www.redhat.com/archives/libvir-list/2011-July/msg01496.html

I attached a version of this patch that should apply to libvirt 0.9.3.
I'd be glad if you could test it, as I don't have a XenAPI setup at
hand. With that patch applied to libvirt 0.9.3 (or libvirt 0.9.2 + the
patch you mentioned before) you should get 'TRANSPORT_FAULT :
<error_code>' as error message and the number could help to figure out
what the actual problem is.

> As per your suggestion,
>
> I had used make rpm. But it requires xen-devel pacakge, which I was
>
> not able to get for Xen 3.4.2. Is there any way where I can use the source
>
> package and build & install the library without using 'make rpm' ?

You can just do the normal ./configure, make and make install dance as
libvirt is autotools based.

> Thanks for all the help.
>
> Regards
>
> Naresh
>
> On Thu, Jul 14, 2011 at 7:07 PM, Matthias Bolte
> <matthias bolte googlemail com> wrote:
>>
>> 2011/7/14 G Naresh Kumar <naresh gadepalli gmail com>:
>> > Hi Maththias,
>> > Thanks for the help. I finally was able to compile/install libvirt on
>> > xenserver.
>> >
>> > I tried compiling the libvirt 0.9.2 with xen api support. Was able to
>> > install it successfully. When I tried giving the virsh command, I got an
>> > ‘authentication failed’ error as shown below.
>> >
>> > # virsh -c xenapi://<my local ip>
>> > Enter username for <mylocalip>: root
>>
>> Here you entered root
>>
>> > Enter intel123's password for <my local ip>:
>>
>> but here it asks for intel123's, that's unexpected. Did you edit this
>> one before mailing it, or is there really this mismatch?
>>
>> > error: authentication failed: (null)
>>
>> Outputting (null) here is actually a bug. The only way this can happen
>> is when the login attempt fails but the XenServer doesn't provide an
>> error message. Maybe have a look at the XenServer logs to see if it
>> says something about a failed login attempt.
>>
>> > I also tried connecting to the local machine as below,
>> >
>> > virsh -c "xenapi:///"
>> > error: authentication failed: Server name not in URI
>> > error: failed to connect to the hypervisor
>>
>> The XenAPI driver expects a server name. xenapi:/// _could_ be treated
>> as xenapi://localhost, but it's not implemented that way.
>>
>> > Also I am trying to install ruby-libvirt on xenserver, which looks like
>> > requires libvirt-devel package to be installed. How do I build it from
>> > the
>> > libvirt 0.9.2 source package.
>>
>> Running 'make rpm' should build an libvirt-devel RPM package for you.
>>
>> > Thanks,
>> >
>> > Naresh
>> >
>> > On Wed, Jun 15, 2011 at 8:19 PM, Matthias Bolte
>> > <matthias bolte googlemail com> wrote:
>> >>
>> >> 2011/6/15 G Naresh Kumar <naresh gadepalli gmail com>:
>> >> > Hi Maththias,
>> >> >
>> >> > Thanks a lot for your response!.
>> >> >
>> >> > Is there a specific version of libvirt from which xenserver support
>> >> > is
>> >> > added? I am getting the below error
>> >> >
>> >> > "error: invalid argument in libvirt was built without the 'xenapi'
>> >> > driver"
>> >>
>> >> The means that your libvirt version is new enough and contains the
>> >> XenAPI driver but that it was disabled on configure time, probably
>> >> because the build server didn't have libxenserver installed and
>> >> libvirt's configure script automatically disabled the driver because
>> >> of a missing dependency.
>> >>
>> >> > I have installed libvirt from citrix yum repo.
>> >>
>> >> Then Citrix build libvirt without XenAPI support. As a long term
>> >> solution you could report to whom ever is responsible for that repo
>> >> and request to enabled XenAPI support in that libvirt package. As a
>> >> short term solution you could build libvirt from source yourself and
>> >> make sure to get the XenAPI driver enabled.
>> >>
>> >> > I am using Xenserver 5.5 with libvirt 0.8.2 and it does not seem to
>> >> > be
>> >> > working.
>> >>
>> >> According to http://libvirt.org/hvsupport.html and the error message
>> >> 0.8.2 is new enough.
>> >>
>> >> Matthias
>> >>
>> >> > Thanks,
>> >> >
>> >> > Naresh
>> >> >
>> >> > On Jun 15, 2011 7:03 PM, "Matthias Bolte"
>> >> > <matthias bolte googlemail com>
>> >> > wrote:
>> >> >> 2011/6/15 G Naresh Kumar <naresh gadepalli gmail com>:
>> >> >>> Hi,
>> >> >>> Is libvirt supported on Citrix Xenserver. I have been searching for
>> >> >>> the
>> >> >>> same
>> >> >>> with little/no luck.
>> >> >>> If supported, can you point to some links/documents which can help
>> >> >>> me
>> >> >>> try
>> >> >>> out the same.
>> >> >>> Thanks,
>> >> >>> Naresh
>> >> >>
>> >> >> libvirt can use XenAPI via libxenserver [1]. That should allow you
>> >> >> to
>> >> >> use libvirt with a Citrix XenServer. You can use virsh like this
>> >> >> assuming you have a libxenserver enabled libvirt:
>> >> >>
>> >> >> virsh -c xenapi://my-xen-server
>> >> >>
>> >> >> But it's true, there is no documentation about this on the libvirt
>> >> >> website
>> >> >> yet.
>> >> >>
>> >> >> [1] http://community.citrix.com/display/xs/Download+SDKs
>> >> >>
>> >> >> --
>> >> >> Matthias Bolte
>> >> >> http://photron.blogspot.com
>> >> >
>> > --
>> > I was an atheist till I realized I am GOD
>> >
>>
>> --
>> Matthias Bolte
>> http://photron.blogspot.com
>
>
>
> --
> I was an atheist till I realized I am GOD
>



-- 
Matthias Bolte
http://photron.blogspot.com
From cec38824ea406e5adfebcb0740141c709d0599ab Mon Sep 17 00:00:00 2001
From: Matthias Bolte <matthias bolte googlemail com>
Date: Thu, 21 Jul 2011 15:16:11 +0200
Subject: [PATCH] xenapi: Improve error reporting in xenapiOpen once again

privP->session->error_description is a list and in order to get the
complete error message all parts of the list should be concatenated.
xenapiSessionErrorHandler does this when its third parameter is NULL.
The current code discards all but the first part of the error message
resulting in a potentially incomplete error message.

This partly reverts 006be75ee214f9b4, that tried to avoid reporting
a (null) in the error message. The actual problem is more general in
returnErrorFromSession that might return NULL if there is no error.

Make sure that returnErrorFromSession return non-NULL always. Also
don't skip the last error message part.
---
 src/xenapi/xenapi_driver.c |    5 +----
 src/xenapi/xenapi_utils.c  |    4 +++-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index 97da1d1..77bf82d 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -193,10 +193,7 @@ xenapiOpen (virConnectPtr conn, virConnectAuthPtr auth,
         return VIR_DRV_OPEN_SUCCESS;
     }
 
-    xenapiSessionErrorHandler(conn, VIR_ERR_AUTH_FAILED,
-                              *privP->session->error_description);
+    xenapiSessionErrorHandler(conn, VIR_ERR_AUTH_FAILED, NULL);
 
   error:
     VIR_FREE(username);
diff --git a/src/xenapi/xenapi_utils.c b/src/xenapi/xenapi_utils.c
index 342ae5b..79fd946 100644
--- a/src/xenapi/xenapi_utils.c
+++ b/src/xenapi/xenapi_utils.c
@@ -272,12 +272,14 @@ returnErrorFromSession(xen_session *session)
 {
     int i;
     virBuffer buf = VIR_BUFFER_INITIALIZER;
-    for (i = 0; i < session->error_description_count - 1; i++) {
+    for (i = 0; i < session->error_description_count; i++) {
         if (!i)
             virBufferEscapeString(&buf, "%s", session->error_description[i]);
         else
             virBufferEscapeString(&buf, " : %s", session->error_description[i]);
     }
+    if (virBufferUse(&buf) < 1)
+        virBufferAdd(&buf, _("unknown error"), -1);
     return virBufferContentAndReset(&buf);
 }
 
-- 
1.7.4.1


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