>
>
> Hello All,
>
> I am not able to use the library functions provided by the LibXenlight
> though I am able to use it through XL. I am in need to develop my own CLI
> . I am able to perform few basic operations like listing the VM, reboot
> and all. But the calls that require a structure to be filled is not
> functioning . I am getting a segmentation fault.
>
> I have attached my code. I have also attached the system call traces file
> which was generated by the command truss for the command that was
> successful through XL and the other one that failed where I used the call
> directly.
>
> 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;
}

Attachment: xlout
Description: Binary data

Attachment: eout
Description: Binary data

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to