Skip to contentSkip to conversation

: xl: Introduce libxl_domain_create_new() and libxl_domain_create_restore()

PATCH In review Gianni Tedesco 2 participants 2 messages Jan 10, 2011 – Jan 11, 2011

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 : xl: Introduce libxl_domain_create_new() and libxl_domain_create_restore()

Changes since v2:
- rebased for previous two patches
- more thorough testing
Not changed:
- not moved init_*_info in to libxl, I think it's a good idea but I will try to send a follow-up patch that does that.

---

These functions are introduced as the new way to create domains with libxl they prevent the callers from need to know about low-level implementation details such as:
- libxl_domain_make()
- libxl_domain_build()
- libxl_domain_restore()
- when to attach the console
- how to start the device model

Above mentioned functions and all API's for the device model, which are now redundant, have been made internal to libxl and no longer accessible.

The ocaml binding for libxl has not been properly updated to reflect the changes, wrappers for the old functions have been removed but the code to wrap the new functions has not been added.

# HG changeset patch
# Parent 02773e0763a0bb0936548e7676d7a866babdffe3

tools/libxl/Makefile +4 -2
diff -r 02773e0763a0 tools/libxl/Makefile
@@ -20,7 +20,7 @@ ifeq ($(CONFIG_Linux),y)
 LIBS += -luuid
 endif
 
-LIBXL_OBJS-y = osdeps.o libxl_paths.o libxl_bootloader.o
+LIBXL_OBJS-y = osdeps.o libxl_paths.o libxl_bootloader.o flexarray.o
 ifeq ($(LIBXL_BLKTAP),y)
 LIBXL_OBJS-y += libxl_blktap2.o
 else
@@ -29,7 +29,9 @@ endif
 LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o
 LIBXL_OBJS-$(CONFIG_IA64) += libxl_nocpuid.o
 
-LIBXL_OBJS = flexarray.o libxl.o libxl_dm.o libxl_pci.o libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o libxl_internal.o libxl_utils.o $(LIBXL_OBJS-y)
+LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
+			libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o \
+			libxl_internal.o libxl_utils.o $(LIBXL_OBJS-y)
 LIBXL_OBJS += _libxl_types.o
 
 AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h
tools/libxl/libxl.c +0 -243

255 lines not on this page · raw message

tools/libxl/libxl.h +36 -26

80 lines not on this page · raw message

tools/libxl/libxl_create.c new file +482 -0

482 lines not on this page · raw message

tools/libxl/libxl_dm.c +21 -21

138 lines not on this page · raw message

tools/libxl/libxl_exec.c +1 -1
diff -r 02773e0763a0 tools/libxl/libxl_exec.c
@@ -90,7 +90,7 @@ void libxl_report_child_exitstatus(libxl
 }
 
 int libxl__spawn_spawn(libxl_ctx *ctx,
-                      libxl_device_model_starting *starting,
+                      libxl__device_model_starting *starting,
                       const char *what,
                       void (*intermediate_hook)(void *for_spawn,
                                                 pid_t innerchild))
tools/libxl/libxl_internal.h +26 -3
diff -r 02773e0763a0 tools/libxl/libxl_internal.h
@@ -194,14 +194,37 @@ typedef struct {
     char *what; /* malloc'd in spawn_spawn */
 } libxl__spawn_starting;
 
-struct libxl__device_model_starting {
+typedef struct {
     libxl__spawn_starting *for_spawn; /* first! */
     char *dom_path; /* from libxl_malloc, only for dm_xenstore_record_pid */
     int domid;
-};
+} libxl__device_model_starting;
+
+/* from xl_create */
+_hidden int libxl__domain_make(libxl_ctx *ctx, libxl_domain_create_info *info, uint32_t *domid);
+_hidden int libxl__domain_build(libxl_ctx *ctx, libxl_domain_build_info *info, uint32_t domid, /* out */ libxl_domain_build_state *state);
+
+/* for device model creation */
+_hidden int libxl__create_device_model(libxl_ctx *ctx,
+                              libxl_device_model_info *info,
+                              libxl_device_disk *disk, int num_disks,
+                              libxl_device_nic *vifs, int num_vifs,
+                              libxl__device_model_starting **starting_r);
+_hidden int libxl__create_xenpv_qemu(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb,
+                            libxl__device_model_starting **starting_r);
+_hidden int libxl__need_xenpv_qemu(libxl_ctx *ctx,
+        int nr_consoles, libxl_device_console *consoles,
+        int nr_vfbs, libxl_device_vfb *vfbs,
+        int nr_disks, libxl_device_disk *disks);
+
+  /* Caller must either: pass starting_r==0, or on successful
+   * return pass *starting_r (which will be non-0) to
+   * libxl_confirm_device_model or libxl_detach_device_model. */
+_hidden int libxl__confirm_device_model_startup(libxl_ctx *ctx,
+                              libxl__device_model_starting *starting);
 
 _hidden int libxl__spawn_spawn(libxl_ctx *ctx,
-                      libxl_device_model_starting *starting,
+                      libxl__device_model_starting *starting,
                       const char *what,
                       void (*intermediate_hook)(void *for_spawn, pid_t innerchild));
 _hidden int libxl__destroy_device_model(libxl_ctx *ctx, uint32_t domid);
tools/libxl/xl_cmdimpl.c +75 -253

480 lines not on this page · raw message

tools/ocaml/libs/xl/xl_stubs.c +13 -72

121 lines not on this page · raw message

#1 lore raw

Gianni Tedesco writes ("[Xen-devel] [PATCH, v3]: xl: Introduce libxl_domain_create_new() and libxl_domain_create_restore()"):

Quoted 3 lines

These functions are introduced as the new way to create domains with libxl they prevent the callers from need to know about low-level implementation details such as:

Thanks, I have applied this.

Ian.