backport libxl from xen-unstable to xen-4.0-testing
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest1 patch 7 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/1 | backport libxl from xen-unstable to xen-4.0-testingtools/ tools/ tools/ +19 more | +6555 | 2 replies |
Reviews trailers per patch
The patch has a Reviewed-by or Acked-by.
| Patch | Ian Jackson | Stefano Stabellini |
|---|---|---|
| 1/1 | A-b | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/1] backport libxl from xen-unstable to xen-4.0-testing
Hi,
Following patch does what it says on the tin. It's a straightforward backport of libxl to xen-4.0-testing. This buys harmony of functionality between the two trees with the minimal of disruption to anything outside tools/libxl.
The backport is therefore modulo features such as blktap2, vif2, cpupools, numa, sched2, libxc logging API changes and so forth. To ease review process I have attached a patch between the post-backport libxl. DO NOT ATTEMPT TO APPLY THIS ONE :)
Makefile | 4
libxl.c | 320 +++++++++++++++++++++++++++++++++++++++++-------------- libxl.h | 57 ++++++++- libxl_device.c | 6 - libxl_dom.c | 6 - libxl_exec.c | 3 libxl_internal.c | 44 +++---- libxl_internal.h | 25 +++- libxl_utils.c | 86 ++++++++++++++ libxl_utils.h | 11 - xenguest.c | 2 xl.c | 45 ++++--- xl.h | 12 +- xl_cmdimpl.c | 300 +++++++++++++++++++++++++++++++++++++++++++++++++-- xl_cmdtable.c | 18 +++ 15 files changed, 777 insertions(+), 162 deletions(-)
tools/libxl/libxl.c +244 -76
@@ -33,28 +33,34 @@#include "libxl_utils.h" #include "libxl_internal.h" #include "flexarray.h" +#include "tap-ctl.h" #define PAGE_TO_MEMKB (pages) ((pages) * 4) -int libxl_ctx_init (struct libxl_ctx *ctx,int version) +int libxl_ctx_init (struct libxl_ctx *ctx,int version,xentoollog_logger *lg) {if (version !=LIBXL_VERSION )return ERROR_VERSION ;memset (ctx,0 ,sizeof (struct libxl_ctx )); + ctx->lg = lg; ctx->alloc_maxsize =256 ; ctx->alloc_ptrs =calloc (ctx->alloc_maxsize,sizeof (void *));if (!ctx->alloc_ptrs)return ERROR_NOMEM ;memset (&ctx->version_info,0 ,sizeof (libxl_version_info)); - ctx->xch =xc_interface_open (); -if (ctx->xch ==-1 ) { + ctx->xch =xc_interface_open (lg,lg,0 ); +if (!ctx->xch) { +XL_LOG_ERRNOVAL (ctx,XL_LOG_ERROR , errno, +"cannot open libxc handle" );free (ctx->alloc_ptrs);return ERROR_FAIL ; } ctx->xsh =xs_daemon_open ();if (!ctx->xsh) { +XL_LOG_ERRNOVAL (ctx,XL_LOG_ERROR , errno, +"cannot connect to xenstore" );xc_interface_close (ctx->xch);free (ctx->alloc_ptrs);return ERROR_FAIL ;
@@ -71,13 +77,6 @@ int libxl_ctx_free(struct libxl_ctx *ctxreturn 0 ; } -int libxl_ctx_set_log (struct libxl_ctx *ctx,libxl_log_callback log_callback,void *log_data) -{ - ctx->log_callback = log_callback; - ctx->log_userdata = log_data; -return 0 ; -} -/******************************************************************************/ int libxl_domain_make(struct libxl_ctx *ctx, libxl_domain_create_info *info,
@@ -111,6 +110,12 @@ int libxl_domain_make(struct libxl_ctx *return ERROR_FAIL ; } + ret =xc_cpupool_movedomain (ctx->xch, info->poolid, *domid); +if (ret <0 ) { +XL_LOG_ERRNOVAL (ctx,XL_LOG_ERROR , ret,"domain move fail" ); +return ERROR_FAIL ; + } + dom_path =libxl_xs_get_dompath (ctx, *domid);if (!dom_path)return ERROR_FAIL ;
@@ -163,6 +168,8 @@ retry_transaction:xs_write (ctx->xsh, t,libxl_sprintf (ctx,"%s/uuid" , vm_path), uuid_string,strlen (uuid_string));xs_write (ctx->xsh, t,libxl_sprintf (ctx,"%s/name" , vm_path), info->name,strlen (info->name)); +if (info->poolname) +xs_write (ctx->xsh, t,libxl_sprintf (ctx,"%s/pool_name" , vm_path), info->poolname,strlen (info->poolname));libxl_xs_writev (ctx, t, dom_path, info->xsdata);libxl_xs_writev (ctx, t,libxl_sprintf (ctx,"%s/platform" , dom_path), info->platformdata);
@@ -443,6 +450,26 @@ int libxl_domain_info(struct libxl_ctx *return 0 ; } +struct libxl_poolinfo *libxl_list_pool (struct libxl_ctx *ctx,int *nb_pool) +{ +struct libxl_poolinfo *ptr; +int i, ret; +xc_cpupoolinfo_t info[256 ]; +int size =256 ; + + ptr =calloc (size,sizeof (struct libxl_poolinfo )); +if (!ptr)return NULL ; + + ret =xc_cpupool_getinfo (ctx->xch,0 ,256 , info); +if (ret<0 )return NULL ; + +for (i =0 ; i < ret; i++) { + ptr[i].poolid = info[i].cpupool_id; + } + *nb_pool = ret; +return ptr; +} +/* this API call only list VM running on this host. a VM can be an aggregate of multiple domains. */ struct libxl_vminfo *libxl_list_vm (struct libxl_ctx *ctx,int *nb_vm) {
@@ -1226,44 +1253,25 @@ int libxl_confirm_device_model_startup(s/******************************************************************************/ -static int is_blktap2_supported (void ) +static char *get_blktap2_device (struct libxl_ctx *ctx, +const char *name,const char *type) { -char buf[1024 ]; -FILE *f =fopen ("/proc/devices" ,"r" ); - - -while (fgets (buf,sizeof (buf), f) !=NULL ) { -if (strstr (buf,"blktap2" )) { -fclose (f); -return 1 ; - } - } -fclose (f); -return 0 ; +int minor =tap_ctl_find_minor (type, name); +if (minor <0 ) +return NULL ; +return libxl_sprintf (ctx,"/dev/xen/blktap-2/tapdev%d" , minor); } -static char *get_blktap2_device (struct libxl_ctx *ctx,char *name,char *type) +static char *make_blktap2_device (struct libxl_ctx *ctx, +const char *name,const char *type) { -char buf[1024 ]; -char *p; -int devnum; -FILE *f =fopen ("/sys/class/blktap2/devices" ,"r" ); - - -while (!feof (f)) { -if (fscanf (f,"%d %s" , &devnum, buf) !=2 ) -continue ; - p =strchr (buf,':' ); -if (p ==NULL ) -continue ; - p++; -if (!strcmp (p, name) && !strncmp (buf, type,3 )) { -fclose (f); -return libxl_sprintf (ctx,"/dev/xen/blktap-2/tapdev%d" , devnum); - } - } -fclose (f); -return NULL ; +char *params, *devname =NULL ; +int err; + params =libxl_sprintf (ctx,"%s:%s" , type, name); + err =tap_ctl_create (params, &devname); +if (!err) +libxl_ptr_add (ctx, devname); +return err ?NULL : devname; }int libxl_device_disk_add (struct libxl_ctx *ctx,uint32_t domid,libxl_device_disk *disk)
@@ -1314,38 +1322,16 @@ int libxl_device_disk_add(struct libxl_ccase PHYSTYPE_FILE :/* let's pretend is tap:aio for the moment */ disk->phystype =PHYSTYPE_AIO ; -case PHYSTYPE_AIO :case PHYSTYPE_QCOW :case PHYSTYPE_QCOW2 :case PHYSTYPE_VHD : -if (is_blktap2_supported ()) { -int rc, c, p[2 ], tot; -char buf[1024 ], *dev; - dev =get_blktap2_device (ctx, disk->physpath,device_disk_string_of_phystype (disk->phystype)); -if (dev ==NULL ) { - rc=libxl_pipe (ctx, p);if (rc==-1 )return -1 ; - rc=libxl_fork (ctx);if (rc==-1 )return -1 ; -if (!rc) {/* child */ -int null_r, null_w; -char *args[4 ]; - args[0 ] ="tapdisk2" ; - args[1 ] ="-n" ; - args[2 ] =libxl_sprintf (ctx,"%s:%s" ,device_disk_string_of_phystype (disk->phystype), disk->physpath); - args[3 ] =NULL ; - - null_r =open ("/dev/null" ,O_RDONLY ); - null_w =open ("/dev/null" ,O_WRONLY ); -libxl_exec (null_r, p[1 ], null_w, -libxl_abs_path (ctx,"tapdisk2" , -libxl_sbindir_path ()), - args); -XL_LOG (ctx,XL_LOG_ERROR ,"Error execing tapdisk2" ); - } -close (p[1 ]); - tot =0 ; -while ((c =read (p[0 ], buf + tot,sizeof (buf) - tot)) >0 ) - tot = tot + c; -close (p[0 ]); - buf[tot -1 ] ='\0' ; - dev = buf; - } +case PHYSTYPE_AIO :case PHYSTYPE_QCOW :case PHYSTYPE_QCOW2 :case PHYSTYPE_VHD : { +const char *msg; +if (!tap_ctl_check (&msg)) { +const char *type =device_disk_string_of_phystype (disk->phystype); +char *dev; + dev =get_blktap2_device (ctx, disk->physpath, type); +if (!dev) + dev =make_blktap2_device (ctx, disk->physpath, type); +if (!dev) +return -1 ;flexarray_set (back, boffset++,"tapdisk-params" );flexarray_set (back, boffset++,libxl_sprintf (ctx,"%s:%s" ,device_disk_string_of_phystype (disk->phystype), disk->physpath));flexarray_set (back, boffset++,"params" );
@@ -1364,6 +1350,7 @@ int libxl_device_disk_add(struct libxl_c device.backend_kind =DEVICE_TAP ;break ; + }default :XL_LOG (ctx,XL_LOG_ERROR ,"unrecognized disk physical type: %d\n" , disk->phystype);return ERROR_INVAL ;
@@ -1579,6 +1566,186 @@ libxl_nicinfo *libxl_list_nics(struct lireturn res; } +/******************************************************************************/ +int libxl_device_net2_add (struct libxl_ctx *ctx,uint32_t domid,libxl_device_net2 *net2) +{ +flexarray_t *front, *back; +unsigned int boffset =0 , foffset =0 ; +libxl_device device; +char *dompath, *dom, **l; +unsigned int nb; + + front =flexarray_make (16 ,1 ); +if (!front) +return ERROR_NOMEM ; + back =flexarray_make (16 ,1 ); +if (!back) +return ERROR_NOMEM ; + +if (!(dompath =libxl_xs_get_dompath (ctx, domid))) { +return ERROR_FAIL ; + } + dom =libxl_xs_read (ctx,XBT_NULL ,libxl_sprintf (ctx,"%s/name" , dompath)); + +if (net2->devid ==-1 ) { +if (!(l =libxl_xs_directory (ctx,XBT_NULL , +libxl_sprintf (ctx,"%s/device/vif2" , dompath), &nb))) { + net2->devid =0 ; + }else { + net2->devid =strtoul (l[nb -1 ],NULL ,10 ) +1 ; +libxl_free (ctx, l); + } + } + + device.backend_devid = net2->devid; + device.backend_domid = net2->backend_domid; + device.backend_kind =DEVICE_VIF2 ; + device.devid = net2->devid; + device.domid = net2->domid; + device.kind =DEVICE_VIF2 ; + +flexarray_set (back, boffset++,"domain" ); +flexarray_set (back, boffset++, dom); +flexarray_set (back, boffset++,"frontend-id" ); +flexarray_set (back, boffset++,libxl_sprintf (ctx,"%d" , net2->domid)); + +flexarray_set (back, boffset++,"local-trusted" ); +flexarray_set (back, boffset++,libxl_sprintf (ctx,"%d" , net2->back_trusted)); +flexarray_set (back, boffset++,"mac" ); +flexarray_set (back, boffset++,libxl_sprintf (ctx,"%02x:%02x:%02x:%02x:%02x:%02x" , + net2->back_mac[0 ], net2->back_mac[1 ], + net2->back_mac[2 ], net2->back_mac[3 ], + net2->back_mac[4 ], net2->back_mac[5 ])); + +flexarray_set (back, boffset++,"remote-trusted" ); +flexarray_set (back, boffset++,libxl_sprintf (ctx,"%d" , net2->trusted)); +flexarray_set (back, boffset++,"remote-mac" ); +flexarray_set (back, boffset++,libxl_sprintf (ctx,"%02x:%02x:%02x:%02x:%02x:%02x" , + net2->front_mac[0 ], net2->front_mac[1 ], + net2->front_mac[2 ], net2->front_mac[3 ], + net2->front_mac[4 ], net2->front_mac[5 ])); + +flexarray_set (back, boffset++,"max-bypasses" ); +flexarray_set (back, boffset++,libxl_sprintf (ctx,"%d" , net2->max_bypasses)); +flexarray_set (back, boffset++,"filter-mac" ); +flexarray_set (back, boffset++,libxl_sprintf (ctx,"%d" , !!(net2->filter_mac))); +flexarray_set (back, boffset++,"handle" ); +flexarray_set (back, boffset++,libxl_sprintf (ctx,"%d" , net2->devid)); +flexarray_set (back, boffset++,"online" ); +flexarray_set (back, boffset++,"1" ); +flexarray_set (back, boffset++,"state" ); +flexarray_set (back, boffset++,"1" ); + +flexarray_set (front, foffset++,"backend-id" ); +flexarray_set (front, foffset++,libxl_sprintf (ctx,"%d" , net2->backend_domid)); + +flexarray_set (front, foffset++,"local-trusted" ); +flexarray_set (front, foffset++,libxl_sprintf (ctx,"%d" , net2->trusted)); +flexarray_set (front, foffset++,"mac" ); +flexarray_set (front, foffset++,libxl_sprintf (ctx,"%02x:%02x:%02x:%02x:%02x:%02x" , + net2->front_mac[0 ], net2->front_mac[1 ], + net2->front_mac[2 ], net2->front_mac[3 ], + net2->front_mac[4 ], net2->front_mac[5 ])); + +flexarray_set (front, foffset++,"remote-trusted" ); +flexarray_set (front, foffset++,libxl_sprintf (ctx,"%d" , net2->back_trusted)); +flexarray_set (front, foffset++,"remote-mac" ); +flexarray_set (front, foffset++,libxl_sprintf (ctx,"%02x:%02x:%02x:%02x:%02x:%02x" , + net2->back_mac[0 ], net2->back_mac[1 ], + net2->back_mac[2 ], net2->back_mac[3 ], + net2->back_mac[4 ], net2->back_mac[5 ])); + +flexarray_set (front, foffset++,"filter-mac" ); +flexarray_set (front, foffset++,libxl_sprintf (ctx,"%d" , !!(net2->filter_mac))); +flexarray_set (front, foffset++,"state" ); +flexarray_set (front, foffset++,"1" ); + +libxl_device_generic_add (ctx, &device, +libxl_xs_kvs_of_flexarray (ctx, back, boffset), +libxl_xs_kvs_of_flexarray (ctx, front, foffset)); + +/* FIXME: wait for plug */ +flexarray_free (back); +flexarray_free (front); +return 0 ; +} + +libxl_net2info *libxl_device_net2_list (struct libxl_ctx *ctx,uint32_t domid,unsigned int *nb) +{ +char *dompath, *net2_path_fe; +char **l; +char *val, *tok; +unsigned int nb_net2s, i; +libxl_net2info *res, *net2s; + + dompath =libxl_xs_get_dompath (ctx, domid); +if (!dompath) { +return NULL ; + } + l =libxl_xs_directory (ctx,XBT_NULL , +libxl_sprintf (ctx,"%s/device/vif2" , dompath), &nb_net2s); +if (!l) { +return NULL ; + } + res =libxl_calloc (ctx, nb_net2s,sizeof (libxl_net2info)); +if (!res) { +libxl_free (ctx, l); +return NULL ; + } + net2s = res; +for (*nb = nb_net2s; nb_net2s >0 ; --nb_net2s, ++l, ++net2s) { + net2_path_fe =libxl_sprintf (ctx,"%s/device/vif2/%s" , dompath, *l); + + net2s->backend =libxl_xs_read (ctx,XBT_NULL , +libxl_sprintf (ctx,"%s/backend" , net2_path_fe)); + val =libxl_xs_read (ctx,XBT_NULL ,libxl_sprintf (ctx,"%s/backend-id" , net2_path_fe)); + net2s->backend_id = val ?strtoul (val,NULL ,10 ) :-1 ; + + net2s->devid =strtoul (*l,NULL ,10 ); + val =libxl_xs_read (ctx,XBT_NULL ,libxl_sprintf (ctx,"%s/state" , net2_path_fe)); + net2s->state = val ?strtoul (val,NULL ,10 ) :-1 ; + + val =libxl_xs_read (ctx,XBT_NULL ,libxl_sprintf (ctx,"%s/mac" , net2_path_fe)); +for (i =0 , tok =strtok (val,":" ); tok && (i <6 ); + ++i, tok =strtok (NULL ,":" )) { + net2s->mac[i] =strtoul (tok,NULL ,16 ); + } + val =libxl_xs_read (ctx,XBT_NULL ,libxl_sprintf (ctx,"%s/remote-trusted" , net2_path_fe)); + net2s->trusted = val ?strtoul (val,NULL ,10 ) :-1 ; + + val =libxl_xs_read (ctx,XBT_NULL ,libxl_sprintf (ctx,"%s/remote-mac" , net2_path_fe)); +for (i =0 , tok =strtok (val,":" ); tok && (i <6 ); + ++i, tok =strtok (NULL ,":" )) { + net2s->back_mac[i] =strtoul (tok,NULL ,16 ); + } + val =libxl_xs_read (ctx,XBT_NULL ,libxl_sprintf (ctx,"%s/filter-mac" , net2_path_fe)); + net2s->filter_mac = val ?strtoul (val,NULL ,10 ) :-1 ; + + net2s->frontend =libxl_xs_read (ctx,XBT_NULL , +libxl_sprintf (ctx,"%s/frontend" , net2s->backend)); + val =libxl_xs_read (ctx,XBT_NULL ,libxl_sprintf (ctx,"%s/frontend-id" , net2s->backend)); + net2s->frontend_id = val ?strtoul (val,NULL ,10 ) :-1 ; +libxl_free (ctx, net2_path_fe); + } + +libxl_free (ctx, l); +return res; +} + +int libxl_device_net2_del (struct libxl_ctx *ctx,libxl_device_net2 *net2,int wait) +{ +libxl_device device; + + device.backend_devid = net2->devid; + device.backend_domid = net2->backend_domid; + device.backend_kind =DEVICE_VIF2 ; + device.devid = net2->devid; + device.domid = net2->domid; + device.kind =DEVICE_VIF2 ; + +return libxl_device_del (ctx, &device, wait); +} +/******************************************************************************/ int libxl_device_console_add (struct libxl_ctx *ctx,uint32_t domid,libxl_device_console *console)
@@ -2584,6 +2751,7 @@ int libxl_get_physinfo(struct libxl_ctx physinfo->total_pages = xcphysinfo.total_pages; physinfo->free_pages = xcphysinfo.free_pages; physinfo->scrub_pages = xcphysinfo.scrub_pages; + physinfo->nr_nodes = xcphysinfo.nr_nodes;memcpy (physinfo->hw_cap,xcphysinfo.hw_cap,sizeof (physinfo->hw_cap)); physinfo->phys_cap = xcphysinfo.capabilities;
tools/libxl/libxl_device.c +4 -2
@@ -24,11 +24,13 @@#include <unistd.h> #include <fcntl.h> +#include "libxl.h" #include "libxl_internal.h" static const char *string_of_kinds[] = { [DEVICE_VIF ] ="vif" , + [DEVICE_VIF2 ] ="vif2" , [DEVICE_VBD ] ="vbd" , [DEVICE_TAP ] ="tap" , [DEVICE_PCI ] ="pci" ,
@@ -292,7 +294,7 @@ int libxl_devices_destroy(struct libxl_cflexarray_t *toremove;struct libxl_ctx clone; -if (libxl_ctx_init (&clone,LIBXL_VERSION )) { +if (libxl_ctx_init (&clone,LIBXL_VERSION , ctx->lg)) {return -1 ; }
@@ -355,7 +357,7 @@ int libxl_device_del(struct libxl_ctx *cint rc;struct libxl_ctx clone; -if (libxl_ctx_init (&clone,LIBXL_VERSION )) { +if (libxl_ctx_init (&clone,LIBXL_VERSION , ctx->lg)) {return -1 ; }
tools/libxl/libxl_dom.c +3 -3
@@ -148,7 +148,7 @@ int build_pv(struct libxl_ctx *ctx, uintint ret;int flags =0 ; - dom =xc_dom_allocate (info->u.pv.cmdline, info->u.pv.features); + dom =xc_dom_allocate (ctx->xch, info->u.pv.cmdline, info->u.pv.features);if (!dom) {XL_LOG_ERRNO (ctx,XL_LOG_ERROR ,"xc_dom_allocate failed" );return -1 ;
@@ -244,7 +244,7 @@ static int core_suspend_callback(void *dXL_LOG (si->ctx,XL_LOG_ERROR ,"xc_evtchn_notify failed ret=%d" , ret);return 0 ; } - ret =xc_await_suspend (si->xce, si->suspend_eventchn); + ret =xc_await_suspend (si->ctx->xch, si->xce, si->suspend_eventchn);if (ret <0 ) {XL_LOG (si->ctx,XL_LOG_ERROR ,"xc_await_suspend failed ret=%d" , ret);return 0 ;
@@ -329,7 +329,7 @@ int core_suspend(struct libxl_ctx *ctx, &core_suspend_switch_qemu_logdirty);if (si.suspend_eventchn >0 ) -xc_suspend_evtchn_release (si.xce, si.suspend_eventchn); +xc_suspend_evtchn_release (si.ctx->xch, si.xce, domid, si.suspend_eventchn);if (si.xce >0 )xc_evtchn_close (si.xce);
tools/libxl/libxl_exec.c +2 -1
@@ -57,7 +57,8 @@ void libxl_exec(int stdinfd, int stdoutf_exit (-1 ); } -void libxl_report_child_exitstatus (struct libxl_ctx *ctx,int level, +void libxl_report_child_exitstatus (struct libxl_ctx *ctx, +xentoollog_level level,const char *what,pid_t pid,int status) {
tools/libxl/libxl.h +48 -9
113 lines not on this page · raw message
tools/libxl/libxl_internal.c +18 -26
66 lines not on this page · raw message
tools/libxl/libxl_internal.h +21 -4
@@ -23,6 +23,7 @@#include <xs.h> #include <xenctrl.h> +#include "xentoollog.h" #include "flexarray.h" #include "libxl_utils.h"
@@ -50,13 +51,24 @@/* all of these macros preserve errno (saving and restoring) */ /* logging */ -void xl_logv (struct libxl_ctx *ctx,int errnoval,int loglevel,const char *file,int line,const char *func,char *fmt,va_list al); -void xl_log (struct libxl_ctx *ctx,int errnoval,int loglevel,const char *file,int line,const char *func,char *fmt, ...); -/* these functions preserve errno (saving and restoring) */ +void xl_logv (struct libxl_ctx *ctx,xentoollog_level msglevel,int errnoval, +const char *file/* may be 0 */ ,int line/* ignored if !file */ , +const char *func/* may be 0 */ , +char *fmt,va_list al) + __attribute__((format (printf,7 ,0 ))); + +void xl_log (struct libxl_ctx *ctx,xentoollog_level msglevel,int errnoval, +const char *file/* may be 0 */ ,int line/* ignored if !file */ , +const char *func/* may be 0 */ , +char *fmt, ...) + __attribute__((format (printf,7 ,8 ))); + +/* these functions preserve errno (saving and restoring) */ typedef enum { DEVICE_VIF = 1, + DEVICE_VIF2, DEVICE_VBD, DEVICE_TAP, DEVICE_PCI,
@@ -154,7 +166,7 @@ int libxl_device_pci_reset(struct libxl_ unsigned int dev, unsigned int func);/* from xenguest (helper */ -int hvm_build_set_params (int handle,uint32_t domid, +int hvm_build_set_params (xc_interface *handle,uint32_t domid,libxl_domain_build_info *info,int store_evtchn,unsigned long *store_mfn);
@@ -204,5 +216,10 @@ void libxl_log_child_exitstatus(struct lchar *libxl_abs_path (struct libxl_ctx *ctx,char *s,const char *path); +#define XL_LOG_DEBUG XTL_DEBUG +#define XL_LOG_INFO XTL_INFO +#define XL_LOG_WARNING XTL_WARN +#define XL_LOG_ERROR XTL_ERROR +#endif
tools/libxl/libxl_utils.c +86 -0
95 lines not on this page · raw message
tools/libxl/libxl_utils.h +5 -6
@@ -50,7 +50,7 @@ pid_t libxl_fork(struct libxl_ctx *ctx);int libxl_pipe (struct libxl_ctx *ctx,int pipes[2 ]);/* Just like fork(2), pipe(2), but log errors. */ -void libxl_report_child_exitstatus (struct libxl_ctx *ctx,int level, +void libxl_report_child_exitstatus (struct libxl_ctx *ctx,xentoollog_level ,const char *what,pid_t pid,int status);/* treats all exit statuses as errors; if that's not what you want, * check status yourself first */
@@ -63,11 +63,10 @@ int libxl_devid_to_device_nic(struct libint libxl_devid_to_device_disk (struct libxl_ctx *ctx,uint32_t domid,const char *devid,libxl_device_disk *disk); -/* log levels: */ -#define XL_LOG_DEBUG 3 -#define XL_LOG_INFO 2 -#define XL_LOG_WARNING 1 -#define XL_LOG_ERROR 0 +int libxl_strtomac (const char *mac_s,uint8_t *mac); + +int libxl_devid_to_device_net2 (struct libxl_ctx *ctx,uint32_t domid, +const char *devid,libxl_device_net2 *net2);#endif
tools/libxl/Makefile +2 -2
@@ -13,9 +13,9 @@ XLUMINOR = 0 CFLAGS += -Werror CFLAGS += -I. -fPIC -CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) +CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl) -LIBS = $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenguest) $(LDFLAGS_libxenstore) +LIBS = $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenguest) $(LDFLAGS_libxenstore) $(LDFLAGS_libblktapctl) LIBXL_OBJS-y = osdeps.o libxl_paths.o LIBXL_OBJS = flexarray.o libxl.o libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o libxl_internal.o xenguest.o libxl_utils.o $(LIBXL_OBJS-y)
tools/libxl/xenguest.c +1 -1
@@ -21,7 +21,7 @@#include "libxl.h" -int hvm_build_set_params (int handle,uint32_t domid, +int hvm_build_set_params (xc_interface *handle,uint32_t domid,libxl_domain_build_info *info,int store_evtchn,unsigned long *store_mfn) {
tools/libxl/xl.c +25 -20
69 lines not on this page · raw message
tools/libxl/xl_cmdimpl.c +290 -10
431 lines not on this page · raw message
tools/libxl/xl_cmdtable.c +18 -0
@@ -295,6 +295,24 @@ struct cmd_spec cmd_table[] = { " (abcdef01-2345-6789-1234-567890abcdef)\n" " -A AUTH 0=auth,1=deauth", }, + {"network2-attach" , + &main_network2attach, +"Create a new version 2 virtual network device" , +"<Domain> [front_mac=<mac>] [back_mac=<mac>] [backend=<BackDomain>]" +" [trusted=<0|1>] [back_trusted=<0|1>] [bridge=<bridge>]" +" [filter_mac=<0|1>] [front_filter_mac=<0|1>] [pdev=<PDEV>]" +" [max_bypasses=n]" , + }, + { "network2-list", + &main_network2list, +"list version 2 virtual network interfaces for a domain" , +"<Domain(s)>" , + }, + { "network2-detach", + &main_network2detach, +"destroy a domain's version 2 virtual network device" , + "<Domain> <DevId>", + }, };int cmdtable_len =sizeof (cmd_table)/sizeof (struct cmd_spec );
tools/libxl/xl.h +10 -2
@@ -15,6 +15,8 @@ #ifndef XL_H #define XL_H +#include "xentoollog.h" + struct cmd_spec { char *cmd_name; int (*cmd_impl)(int argc, char **argv);
@@ -70,12 +72,18 @@ int main_tmem_destroy(int argc, char **aint main_tmem_thaw (int argc,char **argv);int main_tmem_set (int argc,char **argv);int main_tmem_shared_auth (int argc,char **argv); +int main_network2attach (int argc,char **argv); +int main_network2list (int argc,char **argv); +int main_network2detach (int argc,char **argv);void help (char *command); -/* Look up a command in the table, allowing unambiguous truncation */ -struct cmd_spec *cmdtable_lookup (const char *s);extern struct cmd_spec cmd_table[];extern int cmdtable_len; +/* Look up a command in the table, allowing unambiguous truncation */ +struct cmd_spec *cmdtable_lookup (const char *s); + +extern struct libxl_ctx ctx; +extern xentoollog_logger_stdiostream *logger;#endif /* XL_H */