libxl: enabling upstream qemu as pure pv backend.
PATCH 1/1 libxl: enabling upstream qemu as pure pv backend.
Ian Campbell has updated libxl internal a bit. I rebase my patch onto 23718:809882b6f1f8.
Change "fv" to "hvm" to match terminology change.
BTW, why not setup a xen-unstable-staging *git* repository?
Wei.
========================================================
# HG changeset patch
# User Wei Liu <[email protected]>
# Date 1311048390 -28800
# Node ID 3861ded02ff88ac09e6d6d1a701fb2dd7c00e425 # Parent 809882b6f1f84a5673d0ea18dfd392bb35774741
libxl: enabling upstream qemu as pure pv backend.
This patch makes device_model_{version,override} work for pure pv guest, so that users can specify upstream qemu as pure pv backend other than traditional qemu-xen.
This patch also adds device_model_args_{pv,hvm} options for pv and hvm guest respectively.
Internally, original libxl__create_xenpv_qemu allocates a new empty dm_info (struct libxl_device_model_info) for every xenpv qemu created. Now the caller of libxl__create_xenpv_qemu is responsible for allocating this dm_info.
tools/libxl/libxl.idl +2 -0
@@ -238,6 +238,8 @@ ("vcpu_avail", integer, False, "vcpus actually available"), ("xen_platform_pci", bool, False, "enable/disable the xen platform pci device"), ("extra", libxl_string_list, False, "extra parameters pass directly to qemu, NULL terminated"), + ("extra_pv", libxl_string_list, False, "extra parameters pass directly to qemu for PV guest, NULL terminated"), + ("extra_hvm", libxl_string_list, False, "extra parameters pass directly to qemu for HVM guest, NULL terminated"), ], comment= """Device Model information.
tools/libxl/libxl_create.c +13 -1
@@ -530,6 +530,7 @@ {int need_qemu =0 ;libxl_device_console console; +libxl_device_model_info xenpv_dm_info;for (i =0 ; i < d_config->num_vfbs; i++) {libxl_device_vfb_add (ctx, domid, &d_config->vfbs[i]);
@@ -550,8 +551,19 @@libxl__device_console_add (gc, domid, &console, &state);libxl_device_console_destroy (&console); +/* only copy those useful configs */ +memset ((void *)&xenpv_dm_info,0x00 ,sizeof (libxl_device_model_info)); + xenpv_dm_info.device_model_version = + d_config->dm_info.device_model_version; + xenpv_dm_info.type = d_config->dm_info.type; + xenpv_dm_info.device_model = d_config->dm_info.device_model; + xenpv_dm_info.extra = d_config->dm_info.extra; + xenpv_dm_info.extra_pv = d_config->dm_info.extra_pv; + xenpv_dm_info.extra_hvm = d_config->dm_info.extra_hvm; +if (need_qemu) -libxl__create_xenpv_qemu (gc, domid, d_config->vfbs, &dm_starting); +libxl__create_xenpv_qemu (gc, domid, &xenpv_dm_info, + d_config->vfbs, &dm_starting);break ; }default :
tools/libxl/libxl_dm.c +23 -11
@@ -206,9 +206,13 @@switch (info->type) {case LIBXL_DOMAIN_TYPE_PV :flexarray_append (dm_args,"xenpv" ); +for (i =0 ; info->extra_pv && info->extra_pv[i] !=NULL ; i++) +flexarray_append (dm_args, info->extra_pv[i]);break ;case LIBXL_DOMAIN_TYPE_HVM :flexarray_append (dm_args,"xenfv" ); +for (i =0 ; info->extra_hvm && info->extra_hvm[i] !=NULL ; i++) +flexarray_append (dm_args, info->extra_hvm[i]);break ; }flexarray_append (dm_args,NULL );
@@ -403,9 +407,13 @@switch (info->type) {case LIBXL_DOMAIN_TYPE_PV :flexarray_append (dm_args,"xenpv" ); +for (i =0 ; info->extra_pv && info->extra_pv[i] !=NULL ; i++) +flexarray_append (dm_args, info->extra_pv[i]);break ;case LIBXL_DOMAIN_TYPE_HVM :flexarray_append (dm_args,"xenfv" ); +for (i =0 ; info->extra_hvm && info->extra_hvm[i] !=NULL ; i++) +flexarray_append (dm_args, info->extra_hvm[i]);break ; }
@@ -614,6 +622,7 @@struct xs_permissions perm[2 ];xs_transaction_t t;libxl__device_model_starting *dm_starting =0 ; +libxl_device_model_info xenpv_dm_info;if (info->device_model_version !=LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL ) { ret =ERROR_INVAL ;
@@ -647,7 +656,7 @@ b_info.u.pv.features ="" ;/* fixme: this function can leak the stubdom if it fails */ - + domid =0 ; ret =libxl__domain_make (gc, &c_info, &domid);if (ret) goto out_free;
@@ -742,7 +751,14 @@if (ret) goto out_free; } -if (libxl__create_xenpv_qemu (gc, domid, vfb, &dm_starting) <0 ) { + +memset ((void *)&xenpv_dm_info,0x00 ,sizeof (libxl_device_model_info)); + xenpv_dm_info.device_model_version = info->device_model_version; + xenpv_dm_info.type =LIBXL_DOMAIN_TYPE_PV ; + xenpv_dm_info.device_model = info->device_model; +if (libxl__create_xenpv_qemu (gc, domid, + &xenpv_dm_info, + vfb, &dm_starting) <0 ) { ret =ERROR_FAIL ; goto out_free; }
@@ -951,7 +967,6 @@ libxl_device_model_info *info) {libxl_ctx *ctx =libxl__gc_owner (gc); -memset (info,0x00 ,sizeof (libxl_device_model_info));if (vfb !=NULL ) { info->vnc = vfb->vnc;
@@ -969,9 +984,6 @@ info->nographic =1 ; info->domid = domid; info->dom_name =libxl_domid_to_name (ctx, domid); - info->device_model_version =LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL ; - info->device_model =NULL ; - info->type =LIBXL_DOMAIN_TYPE_PV ;return 0 ; }
@@ -1012,12 +1024,12 @@return ret; } -int libxl__create_xenpv_qemu (libxl__gc *gc,uint32_t domid,libxl_device_vfb *vfb, +int libxl__create_xenpv_qemu (libxl__gc *gc,uint32_t domid, +libxl_device_model_info *info, +libxl_device_vfb *vfb,libxl__device_model_starting **starting_r) { -libxl_device_model_info info; - -libxl__build_xenpv_qemu_args (gc, domid, vfb, &info); -libxl__create_device_model (gc, &info,NULL ,0 ,NULL ,0 , starting_r); +libxl__build_xenpv_qemu_args (gc, domid, vfb, info); +libxl__create_device_model (gc, info,NULL ,0 ,NULL ,0 , starting_r);return 0 ; }
tools/libxl/libxl_internal.h +4 -2
@@ -267,8 +267,10 @@ 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__gc *gc, uint32_t domid, libxl_device_vfb *vfb, -libxl__device_model_starting **starting_r); +_hidden int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid, +libxl_device_model_info *dm_info, +libxl_device_vfb *vfb, +libxl__device_model_starting **starting_r); _hidden int libxl__need_xenpv_qemu(libxl__gc *gc, int nr_consoles, libxl_device_console *consoles, int nr_vfbs, libxl_device_vfb *vfbs,
tools/libxl/xl_cmdimpl.c +73 -46
144 lines not on this page · raw message
Oops, I forgot to update comments...
Update comments in code. Change "fv" to "hvm".
Wei.
------8<------
# HG changeset patch
# User Wei Liu <[email protected]>
# Date 1311054699 -28800
# Node ID fd24899c25582e0d3c5e0a50953402fa139c8133 # Parent 809882b6f1f84a5673d0ea18dfd392bb35774741
libxl: enabling upstream qemu as pure pv backend.
This patch makes device_model_{version,override} work for pure pv guest, so that users can specify upstream qemu as pure pv backend other than traditional qemu-xen.
This patch also adds device_model_args_{pv,hvm} options for pv and hvm guest respectively.
Internally, original libxl__create_xenpv_qemu allocates a new empty dm_info (struct libxl_device_model_info) for every xenpv qemu created. Now the caller of libxl__create_xenpv_qemu is responsible for allocating this dm_info.
tools/libxl/libxl.idl +2 -0
@@ -238,6 +238,8 @@ ("vcpu_avail", integer, False, "vcpus actually available"), ("xen_platform_pci", bool, False, "enable/disable the xen platform pci device"), ("extra", libxl_string_list, False, "extra parameters pass directly to qemu, NULL terminated"), + ("extra_pv", libxl_string_list, False, "extra parameters pass directly to qemu for PV guest, NULL terminated"), + ("extra_hvm", libxl_string_list, False, "extra parameters pass directly to qemu for HVM guest, NULL terminated"), ], comment= """Device Model information.
tools/libxl/libxl_create.c +13 -1
@@ -530,6 +530,7 @@ {int need_qemu =0 ;libxl_device_console console; +libxl_device_model_info xenpv_dm_info;for (i =0 ; i < d_config->num_vfbs; i++) {libxl_device_vfb_add (ctx, domid, &d_config->vfbs[i]);
@@ -550,8 +551,19 @@libxl__device_console_add (gc, domid, &console, &state);libxl_device_console_destroy (&console); +/* only copy those useful configs */ +memset ((void *)&xenpv_dm_info,0x00 ,sizeof (libxl_device_model_info)); + xenpv_dm_info.device_model_version = + d_config->dm_info.device_model_version; + xenpv_dm_info.type = d_config->dm_info.type; + xenpv_dm_info.device_model = d_config->dm_info.device_model; + xenpv_dm_info.extra = d_config->dm_info.extra; + xenpv_dm_info.extra_pv = d_config->dm_info.extra_pv; + xenpv_dm_info.extra_hvm = d_config->dm_info.extra_hvm; +if (need_qemu) -libxl__create_xenpv_qemu (gc, domid, d_config->vfbs, &dm_starting); +libxl__create_xenpv_qemu (gc, domid, &xenpv_dm_info, + d_config->vfbs, &dm_starting);break ; }default :
tools/libxl/libxl_dm.c +23 -11
@@ -206,9 +206,13 @@switch (info->type) {case LIBXL_DOMAIN_TYPE_PV :flexarray_append (dm_args,"xenpv" ); +for (i =0 ; info->extra_pv && info->extra_pv[i] !=NULL ; i++) +flexarray_append (dm_args, info->extra_pv[i]);break ;case LIBXL_DOMAIN_TYPE_HVM :flexarray_append (dm_args,"xenfv" ); +for (i =0 ; info->extra_hvm && info->extra_hvm[i] !=NULL ; i++) +flexarray_append (dm_args, info->extra_hvm[i]);break ; }flexarray_append (dm_args,NULL );
@@ -403,9 +407,13 @@switch (info->type) {case LIBXL_DOMAIN_TYPE_PV :flexarray_append (dm_args,"xenpv" ); +for (i =0 ; info->extra_pv && info->extra_pv[i] !=NULL ; i++) +flexarray_append (dm_args, info->extra_pv[i]);break ;case LIBXL_DOMAIN_TYPE_HVM :flexarray_append (dm_args,"xenfv" ); +for (i =0 ; info->extra_hvm && info->extra_hvm[i] !=NULL ; i++) +flexarray_append (dm_args, info->extra_hvm[i]);break ; }
@@ -614,6 +622,7 @@struct xs_permissions perm[2 ];xs_transaction_t t;libxl__device_model_starting *dm_starting =0 ; +libxl_device_model_info xenpv_dm_info;if (info->device_model_version !=LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL ) { ret =ERROR_INVAL ;
@@ -647,7 +656,7 @@ b_info.u.pv.features ="" ;/* fixme: this function can leak the stubdom if it fails */ - + domid =0 ; ret =libxl__domain_make (gc, &c_info, &domid);if (ret) goto out_free;
@@ -742,7 +751,14 @@if (ret) goto out_free; } -if (libxl__create_xenpv_qemu (gc, domid, vfb, &dm_starting) <0 ) { + +memset ((void *)&xenpv_dm_info,0x00 ,sizeof (libxl_device_model_info)); + xenpv_dm_info.device_model_version = info->device_model_version; + xenpv_dm_info.type =LIBXL_DOMAIN_TYPE_PV ; + xenpv_dm_info.device_model = info->device_model; +if (libxl__create_xenpv_qemu (gc, domid, + &xenpv_dm_info, + vfb, &dm_starting) <0 ) { ret =ERROR_FAIL ; goto out_free; }
@@ -951,7 +967,6 @@ libxl_device_model_info *info) {libxl_ctx *ctx =libxl__gc_owner (gc); -memset (info,0x00 ,sizeof (libxl_device_model_info));if (vfb !=NULL ) { info->vnc = vfb->vnc;
@@ -969,9 +984,6 @@ info->nographic =1 ; info->domid = domid; info->dom_name =libxl_domid_to_name (ctx, domid); - info->device_model_version =LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL ; - info->device_model =NULL ; - info->type =LIBXL_DOMAIN_TYPE_PV ;return 0 ; }
@@ -1012,12 +1024,12 @@return ret; } -int libxl__create_xenpv_qemu (libxl__gc *gc,uint32_t domid,libxl_device_vfb *vfb, +int libxl__create_xenpv_qemu (libxl__gc *gc,uint32_t domid, +libxl_device_model_info *info, +libxl_device_vfb *vfb,libxl__device_model_starting **starting_r) { -libxl_device_model_info info; - -libxl__build_xenpv_qemu_args (gc, domid, vfb, &info); -libxl__create_device_model (gc, &info,NULL ,0 ,NULL ,0 , starting_r); +libxl__build_xenpv_qemu_args (gc, domid, vfb, info); +libxl__create_device_model (gc, info,NULL ,0 ,NULL ,0 , starting_r);return 0 ; }
tools/libxl/libxl_internal.h +4 -2
@@ -267,8 +267,10 @@ 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__gc *gc, uint32_t domid, libxl_device_vfb *vfb, -libxl__device_model_starting **starting_r); +_hidden int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid, +libxl_device_model_info *dm_info, +libxl_device_vfb *vfb, +libxl__device_model_starting **starting_r); _hidden int libxl__need_xenpv_qemu(libxl__gc *gc, int nr_consoles, libxl_device_console *consoles, int nr_vfbs, libxl_device_vfb *vfbs,
tools/libxl/xl_cmdimpl.c +73 -46
144 lines not on this page · raw message
tools/libxl/libxl_create.c Tue Jul 19 13:51:39 2011 +0800
Quoted 12 lines · Wei Liu
diff -r
809882b6f1f8-rfd24899c2558tools/libxl/libxl_create.ctools/libxl/libxl_create.c Tue Jul 19 13:51:39 2011 +0800 renamed from tools/libxl/libxl_create.c Mon Jul 18 14:52:30 2011 +0100 +1
-0@@ -530,6 +530,7 @@ { int need_qemu = 0; libxl_device_console console; + libxl_device_model_info xenpv_dm_info; for (i = 0; i < d_config->num_vfbs; i++) { libxl_device_vfb_add(ctx, domid, &d_config->vfbs[i]);@@ -550,8 +551,19 @@
Please can you add to your ~/.hgrc:
[diff]
showfunc = True
I've updated http://wiki.xen.org/xenwiki/SubmittingXenPatches with it.
tools/libxl/libxl_create.c Tue Jul 19 13:51:39 2011 +0800 line 562
Quoted 12 lines
tools/libxl/libxl_create.c Tue Jul 19 13:51:39 2011 +0800 renamed from tools/libxl/libxl_create.c Mon Jul 18 14:52:30 2011 +0100 +9
-0libxl__device_console_add(gc, domid, &console, &state); libxl_device_console_destroy(&console); + /* only copy those useful configs */ + memset((void*)&xenpv_dm_info, 0x00, sizeof(libxl_device_model_info)); + xenpv_dm_info.device_model_version = + d_config->dm_info.device_model_version; + xenpv_dm_info.type = d_config->dm_info.type; + xenpv_dm_info.device_model = d_config->dm_info.device_model; + xenpv_dm_info.extra = d_config->dm_info.extra; + xenpv_dm_info.extra_pv = d_config->dm_info.extra_pv; + xenpv_dm_info.extra_hvm = d_config->dm_info.extra_hvm;
All this could be under the following if ?
Quoted 6 lines
tools/libxl/libxl_create.c Tue Jul 19 13:51:39 2011 +0800 renamed from tools/libxl/libxl_create.c Mon Jul 18 14:52:30 2011 +0100 +2
-1if (need_qemu) - libxl__create_xenpv_qemu(gc, domid, d_config->vfbs, &dm_starting); + libxl__create_xenpv_qemu(gc, domid, &xenpv_dm_info, + d_config->vfbs, &dm_starting);
tools/libxl/libxl_create.c Tue Jul 19 13:51:39 2011 +0800 line 758
Quoted 9 lines
tools/libxl/libxl_create.c Tue Jul 19 13:51:39 2011 +0800 renamed from tools/libxl/libxl_create.c Mon Jul 18 14:52:30 2011 +0100 +5
-1@@ -742,7 +751,14 @@ if (ret) goto out_free; } - if (libxl__create_xenpv_qemu(gc, domid, vfb, &dm_starting) < 0) { + + memset((void*)&xenpv_dm_info, 0x00, sizeof(libxl_device_model_info)); + xenpv_dm_info.device_model_version = info->device_model_version; + xenpv_dm_info.type = LIBXL_DOMAIN_TYPE_PV; + xenpv_dm_info.device_model = info->device_model;
Why don't extra_* get copied here?
Perhaps this and the other similar hunk above could be split into a common libxl__init_xenpv_dm_info(&xenpv_dm_info, info)?
If there is a reason for the extra_* difference then add an "int is_stubdom" to the init function and gate accordingly?
That said, I've no objection to this patch going in as is and addressing comments later as necessary.
Ian.
Quoted 10 lines · Ian Campbell
Quoted 9 lines · Wei Liu
diff -r
809882b6f1f8-rfd24899c2558tools/libxl/libxl_create.ctools/libxl/libxl_create.c Tue Jul 19 13:51:39 2011 +0800 renamed from tools/libxl/libxl_create.c Mon Jul 18 14:52:30 2011 +0100 +1
-0@@ -530,6 +530,7 @@ { int need_qemu = 0; libxl_device_console console; + libxl_device_model_info xenpv_dm_info;
Quoted 8 lines
tools/libxl/libxl_create.c Tue Jul 19 13:51:39 2011 +0800
Quoted 3 lines
tools/libxl/libxl_create.c Tue Jul 19 13:51:39 2011 +0800 renamed from tools/libxl/libxl_create.c Mon Jul 18 14:52:30 2011 +0100 +0
-0for (i = 0; i < d_config->num_vfbs; i++) { libxl_device_vfb_add(ctx, domid, &d_config->vfbs[i]);@@ -550,8 +551,19 @@Please can you add to your ~/.hgrc:
[diff]
showfunc = True
Done. I'm not a hg fan TBH...
Quoted 15 lines
I've updated http://wiki.xen.org/xenwiki/SubmittingXenPatches with it.
tools/libxl/libxl_create.c Tue Jul 19 13:51:39 2011 +0800 line 562
Quoted 12 lines
tools/libxl/libxl_create.c Tue Jul 19 13:51:39 2011 +0800 renamed from tools/libxl/libxl_create.c Mon Jul 18 14:52:30 2011 +0100 +9
-0libxl__device_console_add(gc, domid, &console, &state); libxl_device_console_destroy(&console); + /* only copy those useful configs */ + memset((void*)&xenpv_dm_info, 0x00, sizeof(libxl_device_model_info)); + xenpv_dm_info.device_model_version = + d_config->dm_info.device_model_version; + xenpv_dm_info.type = d_config->dm_info.type; + xenpv_dm_info.device_model = d_config->dm_info.device_model; + xenpv_dm_info.extra = d_config->dm_info.extra; + xenpv_dm_info.extra_pv = d_config->dm_info.extra_pv; + xenpv_dm_info.extra_hvm = d_config->dm_info.extra_hvm;
Quoted 2 lines
All this could be under the following if ?
OK, that's fine.
Quoted 5 lines
Quoted 5 lines
tools/libxl/libxl_create.c Tue Jul 19 13:51:39 2011 +0800 renamed from tools/libxl/libxl_create.c Mon Jul 18 14:52:30 2011 +0100 +2
-1if (need_qemu) - libxl__create_xenpv_qemu(gc, domid, d_config->vfbs, &dm_starting); + libxl__create_xenpv_qemu(gc, domid, &xenpv_dm_info, + d_config->vfbs, &dm_starting);
Quoted 13 lines
tools/libxl/libxl_create.c Tue Jul 19 13:51:39 2011 +0800 line 758
Quoted 10 lines
tools/libxl/libxl_create.c Tue Jul 19 13:51:39 2011 +0800 renamed from tools/libxl/libxl_create.c Mon Jul 18 14:52:30 2011 +0100 +5
-1@@ -742,7 +751,14 @@ if (ret) goto out_free; } - if (libxl__create_xenpv_qemu(gc, domid, vfb, &dm_starting) < 0) { + + memset((void*)&xenpv_dm_info, 0x00, sizeof(libxl_device_model_info)); + xenpv_dm_info.device_model_version = info->device_model_version; + xenpv_dm_info.type = LIBXL_DOMAIN_TYPE_PV; + xenpv_dm_info.device_model = info->device_model;Why don't extra_* get copied here?
Because they are useless to stubdom at the moment.
However, adding three more lines won't hurt.
Quoted 9 lines
Perhaps this and the other similar hunk above could be split into a common
libxl__init_xenpv_dm_info(&xenpv_dm_info, info)?If there is a reason for the extra_* difference then add an "int
is_stubdom" to the init function and gate accordingly?That said, I've no objection to this patch going in as is and addressing comments later as necessary.
I think I would just leave it as it is at the moment.
Quoted 3 lines
Ian.
Patch revised according to your comments.
Wei.
------8<------
# HG changeset patch
# User Wei Liu <[email protected]>
# Date 1311067941 -28800
# Node ID db9937db859a634f1aa6361bdba41bdcb9906224 # Parent 809882b6f1f84a5673d0ea18dfd392bb35774741
libxl: enabling upstream qemu as pure pv backend.
This patch makes device_model_{version,override} work for pure pv guest, so that users can specify upstream qemu as pure pv backend other than traditional qemu-xen.
This patch also adds device_model_args_{pv,hvm} options for pv and hvm guest respectively.
Internally, original libxl__create_xenpv_qemu allocates a new empty dm_info (struct libxl_device_model_info) for every xenpv qemu created. Now the caller of libxl__create_xenpv_qemu is responsible for allocating this dm_info.
tools/libxl/libxl.idl +2 -0
@@ -238,6 +238,8 @@ The password never expires"""), ("vcpu_avail", integer, False, "vcpus actually available"), ("xen_platform_pci", bool, False, "enable/disable the xen platform pci device"), ("extra", libxl_string_list, False, "extra parameters pass directly to qemu, NULL terminated"), + ("extra_pv", libxl_string_list, False, "extra parameters pass directly to qemu for PV guest, NULL terminated"), + ("extra_hvm", libxl_string_list, False, "extra parameters pass directly to qemu for HVM guest, NULL terminated"), ], comment= """Device Model information.
tools/libxl/libxl_create.c +15 -2
@@ -530,6 +530,7 @@ static int do_domain_create(libxl__gc *g {int need_qemu =0 ;libxl_device_console console; +libxl_device_model_info xenpv_dm_info;for (i =0 ; i < d_config->num_vfbs; i++) {libxl_device_vfb_add (ctx, domid, &d_config->vfbs[i]);
@@ -550,8 +551,20 @@ static int do_domain_create(libxl__gc *glibxl__device_console_add (gc, domid, &console, &state);libxl_device_console_destroy (&console); -if (need_qemu) -libxl__create_xenpv_qemu (gc, domid, d_config->vfbs, &dm_starting); +if (need_qemu) { +/* only copy those useful configs */ +memset ((void *)&xenpv_dm_info,0 ,sizeof (libxl_device_model_info)); + xenpv_dm_info.device_model_version = + d_config->dm_info.device_model_version; + xenpv_dm_info.type = d_config->dm_info.type; + xenpv_dm_info.device_model = d_config->dm_info.device_model; + xenpv_dm_info.extra = d_config->dm_info.extra; + xenpv_dm_info.extra_pv = d_config->dm_info.extra_pv; + xenpv_dm_info.extra_hvm = d_config->dm_info.extra_hvm; + +libxl__create_xenpv_qemu (gc, domid, &xenpv_dm_info, + d_config->vfbs, &dm_starting); + }break ; }default :
tools/libxl/libxl_dm.c +27 -11
@@ -206,9 +206,13 @@ static char ** libxl__build_device_modelswitch (info->type) {case LIBXL_DOMAIN_TYPE_PV :flexarray_append (dm_args,"xenpv" ); +for (i =0 ; info->extra_pv && info->extra_pv[i] !=NULL ; i++) +flexarray_append (dm_args, info->extra_pv[i]);break ;case LIBXL_DOMAIN_TYPE_HVM :flexarray_append (dm_args,"xenfv" ); +for (i =0 ; info->extra_hvm && info->extra_hvm[i] !=NULL ; i++) +flexarray_append (dm_args, info->extra_hvm[i]);break ; }flexarray_append (dm_args,NULL );
@@ -403,9 +407,13 @@ static char ** libxl__build_device_modelswitch (info->type) {case LIBXL_DOMAIN_TYPE_PV :flexarray_append (dm_args,"xenpv" ); +for (i =0 ; info->extra_pv && info->extra_pv[i] !=NULL ; i++) +flexarray_append (dm_args, info->extra_pv[i]);break ;case LIBXL_DOMAIN_TYPE_HVM :flexarray_append (dm_args,"xenfv" ); +for (i =0 ; info->extra_hvm && info->extra_hvm[i] !=NULL ; i++) +flexarray_append (dm_args, info->extra_hvm[i]);break ; }
@@ -614,6 +622,7 @@ static int libxl__create_stubdom(libxl__struct xs_permissions perm[2 ];xs_transaction_t t;libxl__device_model_starting *dm_starting =0 ; +libxl_device_model_info xenpv_dm_info;if (info->device_model_version !=LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL ) { ret =ERROR_INVAL ;
@@ -647,7 +656,7 @@ static int libxl__create_stubdom(libxl__ b_info.u.pv.features ="" ;/* fixme: this function can leak the stubdom if it fails */ - + domid =0 ; ret =libxl__domain_make (gc, &c_info, &domid);if (ret) goto out_free;
@@ -742,7 +751,18 @@ retry_transaction:if (ret) goto out_free; } -if (libxl__create_xenpv_qemu (gc, domid, vfb, &dm_starting) <0 ) { + +memset ((void *)&xenpv_dm_info,0 ,sizeof (libxl_device_model_info)); + xenpv_dm_info.device_model_version = info->device_model_version; + xenpv_dm_info.type =LIBXL_DOMAIN_TYPE_PV ; + xenpv_dm_info.device_model = info->device_model; + xenpv_dm_info.extra = info->extra; + xenpv_dm_info.extra_pv = info->extra_pv; + xenpv_dm_info.extra_hvm = info->extra_hvm; + +if (libxl__create_xenpv_qemu (gc, domid, + &xenpv_dm_info, + vfb, &dm_starting) <0 ) { ret =ERROR_FAIL ; goto out_free; }
@@ -951,7 +971,6 @@ static int libxl__build_xenpv_qemu_args( libxl_device_model_info *info) {libxl_ctx *ctx =libxl__gc_owner (gc); -memset (info,0x00 ,sizeof (libxl_device_model_info));if (vfb !=NULL ) { info->vnc = vfb->vnc;
@@ -969,9 +988,6 @@ static int libxl__build_xenpv_qemu_args( info->nographic =1 ; info->domid = domid; info->dom_name =libxl_domid_to_name (ctx, domid); - info->device_model_version =LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL ; - info->device_model =NULL ; - info->type =LIBXL_DOMAIN_TYPE_PV ;return 0 ; }
@@ -1012,12 +1028,12 @@ out:return ret; } -int libxl__create_xenpv_qemu (libxl__gc *gc,uint32_t domid,libxl_device_vfb *vfb, +int libxl__create_xenpv_qemu (libxl__gc *gc,uint32_t domid, +libxl_device_model_info *info, +libxl_device_vfb *vfb,libxl__device_model_starting **starting_r) { -libxl_device_model_info info; - -libxl__build_xenpv_qemu_args (gc, domid, vfb, &info); -libxl__create_device_model (gc, &info,NULL ,0 ,NULL ,0 , starting_r); +libxl__build_xenpv_qemu_args (gc, domid, vfb, info); +libxl__create_device_model (gc, info,NULL ,0 ,NULL ,0 , starting_r);return 0 ; }
tools/libxl/libxl_internal.h +4 -2
@@ -267,8 +267,10 @@ _hidden int libxl__create_device_model(l 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__gc *gc, uint32_t domid, libxl_device_vfb *vfb, -libxl__device_model_starting **starting_r); +_hidden int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid, +libxl_device_model_info *dm_info, +libxl_device_vfb *vfb, +libxl__device_model_starting **starting_r); _hidden int libxl__need_xenpv_qemu(libxl__gc *gc, int nr_consoles, libxl_device_console *consoles, int nr_vfbs, libxl_device_vfb *vfbs,
tools/libxl/xl_cmdimpl.c +73 -46
144 lines not on this page · raw message
Ian Jackson
AppliedWei Liu writes ("[Xen-devel] Re: [PATCH UPDATED] libxl: enabling upstream qemu as pure pv backend."):
Quoted 1 line
Patch revised according to your comments.
...
Quoted 1 line
libxl: enabling upstream qemu as pure pv backend.
I've applied this, thanks.
Ian.