mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
libxl: remove redundant info from dm info.
Remove "target_ram", "acpi", "vcpus" and "vcpu_avail" from device model info and use domain_build_info instead. These must all be consistently specified to both the domain and the device model, there is no need (and a great deal of danger) in exposing a way for a user of libxl to set them differently. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
This commit is contained in:
1 parent
e4e8aee7d3
commit
629a2840b6
4 files changed
+22
-20
No files matched your search
@@ -122,11 +122,7 @@ int libxl_init_dm_info(libxl_ctx *ctx,
|
||||
dm_info->device_model_version = LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
|
||||
dm_info->device_model_stubdomain = false;
|
||||
dm_info->device_model = NULL;
|
||||
dm_info->target_ram = libxl__sizekb_to_mb(b_info->target_memkb);
|
||||
dm_info->videoram = libxl__sizekb_to_mb(b_info->video_memkb);
|
||||
dm_info->acpi = b_info->u.hvm.acpi;
|
||||
dm_info->vcpus = b_info->max_vcpus;
|
||||
dm_info->vcpu_avail = b_info->cur_vcpus;
|
||||
|
||||
dm_info->stdvga = 0;
|
||||
dm_info->vnc.enable = 1;
|
||||
|
||||
+22
-11
@@ -78,6 +78,7 @@ static char ** libxl__build_device_model_args_old(libxl__gc *gc,
|
||||
const libxl_domain_config *guest_config,
|
||||
const libxl_device_model_info *info)
|
||||
{
|
||||
const libxl_domain_build_info *b_info = &guest_config->b_info;
|
||||
const libxl_device_nic *vifs = guest_config->vifs;
|
||||
const int num_vifs = guest_config->num_vifs;
|
||||
int i;
|
||||
@@ -159,14 +160,18 @@ static char ** libxl__build_device_model_args_old(libxl__gc *gc,
|
||||
if (info->soundhw) {
|
||||
flexarray_vappend(dm_args, "-soundhw", info->soundhw, NULL);
|
||||
}
|
||||
if (info->acpi) {
|
||||
if (b_info->u.hvm.acpi) {
|
||||
flexarray_append(dm_args, "-acpi");
|
||||
}
|
||||
if (info->vcpus > 1) {
|
||||
flexarray_vappend(dm_args, "-vcpus", libxl__sprintf(gc, "%d", info->vcpus), NULL);
|
||||
if (b_info->max_vcpus > 1) {
|
||||
flexarray_vappend(dm_args, "-vcpus",
|
||||
libxl__sprintf(gc, "%d", b_info->max_vcpus),
|
||||
NULL);
|
||||
}
|
||||
if (info->vcpu_avail) {
|
||||
flexarray_vappend(dm_args, "-vcpu_avail", libxl__sprintf(gc, "0x%x", info->vcpu_avail), NULL);
|
||||
if (b_info->cur_vcpus) {
|
||||
flexarray_vappend(dm_args, "-vcpu_avail",
|
||||
libxl__sprintf(gc, "0x%x", b_info->cur_vcpus),
|
||||
NULL);
|
||||
}
|
||||
for (i = 0; i < num_vifs; i++) {
|
||||
if (vifs[i].nictype == LIBXL_NIC_TYPE_IOEMU) {
|
||||
@@ -234,6 +239,7 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
|
||||
const libxl_device_model_info *info)
|
||||
{
|
||||
libxl_ctx *ctx = libxl__gc_owner(gc);
|
||||
const libxl_domain_build_info *b_info = &guest_config->b_info;
|
||||
const libxl_device_disk *disks = guest_config->disks;
|
||||
const libxl_device_nic *vifs = guest_config->vifs;
|
||||
const int num_disks = guest_config->num_disks;
|
||||
@@ -366,15 +372,18 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
|
||||
if (info->soundhw) {
|
||||
flexarray_vappend(dm_args, "-soundhw", info->soundhw, NULL);
|
||||
}
|
||||
if (!info->acpi) {
|
||||
if (!b_info->u.hvm.acpi) {
|
||||
flexarray_append(dm_args, "-no-acpi");
|
||||
}
|
||||
if (info->vcpus > 1) {
|
||||
if (b_info->max_vcpus > 1) {
|
||||
flexarray_append(dm_args, "-smp");
|
||||
if (info->vcpu_avail)
|
||||
flexarray_append(dm_args, libxl__sprintf(gc, "%d,maxcpus=%d", info->vcpus, info->vcpu_avail));
|
||||
if (b_info->cur_vcpus)
|
||||
flexarray_append(dm_args, libxl__sprintf(gc, "%d,maxcpus=%d",
|
||||
b_info->max_vcpus,
|
||||
b_info->cur_vcpus));
|
||||
else
|
||||
flexarray_append(dm_args, libxl__sprintf(gc, "%d", info->vcpus));
|
||||
flexarray_append(dm_args, libxl__sprintf(gc, "%d",
|
||||
b_info->max_vcpus));
|
||||
}
|
||||
for (i = 0; i < num_vifs; i++) {
|
||||
if (vifs[i].nictype == LIBXL_NIC_TYPE_IOEMU) {
|
||||
@@ -432,7 +441,9 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
|
||||
|
||||
/* RAM Size */
|
||||
flexarray_append(dm_args, "-m");
|
||||
flexarray_append(dm_args, libxl__sprintf(gc, "%d", info->target_ram));
|
||||
flexarray_append(dm_args,
|
||||
libxl__sprintf(gc, "%d",
|
||||
libxl__sizekb_to_mb(b_info->target_memkb)));
|
||||
|
||||
if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
|
||||
for (i = 0; i < num_disks; i++) {
|
||||
|
||||
@@ -244,7 +244,6 @@ libxl_device_model_info = Struct("device_model_info",[
|
||||
("device_model", string),
|
||||
("saved_state", string),
|
||||
("type", libxl_domain_type),
|
||||
("target_ram", uint32),
|
||||
# size of the videoram in MB
|
||||
("videoram", integer),
|
||||
("stdvga", bool),
|
||||
@@ -261,9 +260,6 @@ libxl_device_model_info = Struct("device_model_info",[
|
||||
# usbdevice: "tablet" for absolute mouse, "mouse" for PS/2 protocol relative mouse
|
||||
("usbdevice", string),
|
||||
("soundhw", string),
|
||||
("acpi", bool),
|
||||
("vcpus", integer), # max number of vcpus
|
||||
("vcpu_avail", integer), # vcpus actually available
|
||||
("xen_platform_pci", bool),
|
||||
# extra parameters pass directly to qemu, NULL terminated
|
||||
("extra", libxl_string_list),
|
||||
|
||||
@@ -380,7 +380,6 @@ static void printf_info(int domid,
|
||||
printf("\t\t\t(boot %s)\n", dm_info->boot);
|
||||
printf("\t\t\t(usb %d)\n", dm_info->usb);
|
||||
printf("\t\t\t(usbdevice %s)\n", dm_info->usbdevice);
|
||||
printf("\t\t\t(acpi %d)\n", dm_info->acpi);
|
||||
printf("\t\t\t(spice %d)\n", dm_info->spice.enable);
|
||||
printf("\t\t\t(spiceport %d)\n", dm_info->spice.port);
|
||||
printf("\t\t\t(spicetls_port %d)\n", dm_info->spice.tls_port);
|
||||
|
||||