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

[Xen-API] Fwd: [Xen-devel] libxen-light


  • To: xen-api@xxxxxxxxxxxxx
  • From: kumara rathnavel <kumara.bsd@xxxxxxxxx>
  • Date: Mon, 21 Sep 2015 17:40:38 +0530
  • Delivery-date: Mon, 21 Sep 2015 12:10:53 +0000
  • List-id: User and development list for XCP and XAPI <xen-api.lists.xen.org>


---------- Forwarded message ----------
From: kumara rathnavel <kumara.bsd@xxxxxxxxx>
Date: 21 September 2015 at 17:17
Subject: Re: [Xen-devel] libxen-light
To: Ian Campbell <ian.campbell@xxxxxxxxxx>


Thanks for the reply Ian.

Please find the code below..
I have also attached the output files from the command truss...

The one prefixed with xl is generated when command is successful
The other one is from the code generated the SEGFAULT.

Thank You,..


#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/syslog.h>
#include <libxl.h>
#include <libxl_utils.h>
#include <libxlutil.h>
#include <fcntl.h>
#define INVALID_DOMID 0
#define LIBXL__DEFBOOL_FALSE (-1)
#define LIBXL__DEFBOOL_TRUE (1)

int
main(
    Âint argc,
    Âchar **argv
   )
{
 Âlibxl_ctx *ctx;

 Âint rc = 0;

 Âlibxl_device_nic nic;
 Âint domid = 0;
 Âchar *bridge = NULL;

 Âbridge = "bridge0";


 Âlibxl_device_nic_init(&nic);


 Âdomid = 2; //Have a domain running with ID 2.

 Ârc = libxl_ctx_alloc(&ctx, LIBXL_VERSION, 0, NULL);
 Âif (rc < 0) {
   perror("ctx alloc failed.");
   return rc;
 Â}

 Ânic.devid = -1;
 Ânic.bridge = bridge;
 Ânic.nictype = LIBXL_NIC_TYPE_VIF;

 Ârc = libxl_device_nic_add(ctx, domid, &nic, 0);
 Âif(rc != 0 ) {
   printf("Attach Failed\n");
 Â}

 Âlibxl_ctx_free(ctx);
 Âreturn rc;
}




On 21 September 2015 at 13:57, Ian Campbell <ian.campbell@xxxxxxxxxx> wrote:
On Mon, 2015-09-21 at 11:56 +0530, kumara rathnavel wrote:
> Hello,
>
> I do not find any proper documentation regarding API provided by the
> Libxenlight. All I find is the documentation for the xl that in turn uses
> Libxl Library. But I would like to use the library calls directly, I am
> able to basic operations like listing vm, reboot and all those . But when
> it comes to creation of domain or attaching device , I am filling the
> structures the same way as xl is doing. But I get a Seg Fault. Can you
> share some documentation on the Libxenlight API if possible or guidance
> would do,,.....

The documentation is mainly in the headers, starting with libxl.h.

If you have specific questions then please provide the code as well as the
error (e.g. the stack trace).

Ian.


Attachment: xlout
Description: Binary data

Attachment: eout
Description: Binary data

_______________________________________________
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®.