mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
tools: allow to limit xenstore features via guest config
Add a guest config parameter "xenstore_feature_mask" allowing to limit the Xenstore features the guest can see and use. This can be needed in order to allow migrating a guest to a host running a Xenstore version providing less features than the source host. Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Jason Andryuk <jason.andryuk@amd.com> Acked-by: Nick Rosbrook <enr0n@ubuntu.com> # tools/golang Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
This commit is contained in:
1 parent
e54a6cd6a1
commit
f6c990ac3c
7 files changed
+65
-1
No files matched your search
@@ -714,6 +714,42 @@ If this option is not specified then it will default to B<false>.
|
||||
|
||||
=back
|
||||
|
||||
=head3 Xenstore related settings
|
||||
|
||||
=over 4
|
||||
|
||||
=item B<xenstore_feature_mask=NUMBER>
|
||||
|
||||
Specify which Xenstore features are visible for the guest.
|
||||
|
||||
This might be needed when a guest should be able to be migrated to a host
|
||||
running a Xenstore implementation with less features than the one the guest
|
||||
is created on.
|
||||
|
||||
The visible features are specified via a binary or of the following
|
||||
values:
|
||||
|
||||
=over 4
|
||||
|
||||
=item B<0x00000001>
|
||||
|
||||
Xenstore is capable to reconnect to a guest.
|
||||
|
||||
=item B<0x00000002>
|
||||
|
||||
Xenstore will present an error value in case it disconnects due to an error
|
||||
condition.
|
||||
|
||||
=back
|
||||
|
||||
The features supported by the running Xenstore instance can be retrieved
|
||||
via the B<xl info> command in dom0.
|
||||
|
||||
The default value is B<0xffffffff>, meaning that all possible Xenstore
|
||||
features are visible by the guest.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Devices
|
||||
|
||||
The following options define the paravirtual, emulated and physical
|
||||
|
||||
@@ -1175,6 +1175,7 @@ return fmt.Errorf("converting field Vpmu: %v", err)
|
||||
if err := x.TrapUnmappedAccesses.fromC(&xc.trap_unmapped_accesses);err != nil {
|
||||
return fmt.Errorf("converting field TrapUnmappedAccesses: %v", err)
|
||||
}
|
||||
x.XenstoreFeatureMask = uint32(xc.xenstore_feature_mask)
|
||||
|
||||
return nil}
|
||||
|
||||
@@ -1710,6 +1711,7 @@ return fmt.Errorf("converting field Vpmu: %v", err)
|
||||
if err := x.TrapUnmappedAccesses.toC(&xc.trap_unmapped_accesses); err != nil {
|
||||
return fmt.Errorf("converting field TrapUnmappedAccesses: %v", err)
|
||||
}
|
||||
xc.xenstore_feature_mask = C.uint32_t(x.XenstoreFeatureMask)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -608,6 +608,7 @@ Altp2MCount uint32
|
||||
VmtraceBufKb int
|
||||
Vpmu Defbool
|
||||
TrapUnmappedAccesses Defbool
|
||||
XenstoreFeatureMask uint32
|
||||
}
|
||||
|
||||
type DomainBuildInfoTypeUnion interface {
|
||||
|
||||
@@ -654,6 +654,12 @@
|
||||
*/
|
||||
#define LIBXL_HAVE_DT_OVERLAY_DOMAIN 1
|
||||
|
||||
/*
|
||||
* LIBXL_HAVE_XENSTORE_FEATURE_MASK indicates the presence of
|
||||
* xenstore_feature_mask in struct libxl_domain_build_info.
|
||||
*/
|
||||
#define LIBXL_HAVE_XENSTORE_FEATURE_MASK 1
|
||||
|
||||
/*
|
||||
* libxl memory management
|
||||
*
|
||||
|
||||
@@ -494,9 +494,24 @@ retry_transaction:
|
||||
if (!xs_transaction_end(ctx->xsh, t, 0))
|
||||
if (errno == EAGAIN)
|
||||
goto retry_transaction;
|
||||
|
||||
if (info->xenstore_feature_mask != ~0U) {
|
||||
unsigned int features;
|
||||
|
||||
if (xs_get_features_supported(ctx->xsh, &features) &&
|
||||
!xs_set_features_domain(ctx->xsh, domid,
|
||||
features & info->xenstore_feature_mask)) {
|
||||
LOGED(ERROR, domid, "Failed to set Xenstore features");
|
||||
rc = ERROR_FAIL;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
xs_introduce_domain(ctx->xsh, domid, state->store_mfn, state->store_port);
|
||||
|
||||
out:
|
||||
free(vm_path);
|
||||
return 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int set_vnuma_info(libxl__gc *gc, uint32_t domid,
|
||||
|
||||
@@ -739,6 +739,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
|
||||
|
||||
("vpmu", libxl_defbool),
|
||||
("trap_unmapped_accesses", libxl_defbool),
|
||||
("xenstore_feature_mask", uint32, {'init_val': '~0U'}),
|
||||
|
||||
], dir=DIR_IN,
|
||||
copy_deprecated_fn="libxl__domain_build_info_copy_deprecated",
|
||||
|
||||
@@ -1409,6 +1409,9 @@ void parse_config_data(const char *config_source,
|
||||
if (!xlu_cfg_get_string (config, "pool", &buf, 0))
|
||||
xlu_cfg_replace_string(config, "pool", &c_info->pool_name, 0);
|
||||
|
||||
if (!xlu_cfg_get_long (config, "xenstore_feature_mask", &l, 0))
|
||||
b_info->xenstore_feature_mask = l;
|
||||
|
||||
libxl_domain_build_info_init_type(b_info, c_info->type);
|
||||
|
||||
if (b_info->type == LIBXL_DOMAIN_TYPE_PVH) {
|
||||
|
||||