libxl: set the device model version earlier in xenstore

So libxl doesn't have to pass the build info around just to get the device
model used by the guest. This allows to simplify
libxl__device_nic_setdefault.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
This commit is contained in:
Roger Pau Monne authored and Ian Jackson committed 2016-04-08 17:58:02 +01:00
1 parent 2c8d85bd15
commit 53c41d3bfb
4 files changed
+16 -23

No files matched your search

+7 -17
View File
@@ -3299,7 +3299,7 @@ out:
/******************************************************************************/
int libxl__device_nic_setdefault(libxl__gc *gc, libxl_device_nic *nic,
uint32_t domid, libxl_domain_build_info *info)
uint32_t domid)
{
int rc;
@@ -3337,21 +3337,11 @@ int libxl__device_nic_setdefault(libxl__gc *gc, libxl_device_nic *nic,
switch (libxl__domain_type(gc, domid)) {
case LIBXL_DOMAIN_TYPE_HVM:
if (!nic->nictype) {
if (info != NULL) {
/* Path taken at creation time. */
if (info->device_model_version ==
LIBXL_DEVICE_MODEL_VERSION_NONE)
nic->nictype = LIBXL_NIC_TYPE_VIF;
else
nic->nictype = LIBXL_NIC_TYPE_VIF_IOEMU;
} else {
/* Path taken when hot-adding a nic. */
if (libxl__device_model_version_running(gc, domid) ==
LIBXL_DEVICE_MODEL_VERSION_NONE)
nic->nictype = LIBXL_NIC_TYPE_VIF;
else
nic->nictype = LIBXL_NIC_TYPE_VIF_IOEMU;
}
if (libxl__device_model_version_running(gc, domid) ==
LIBXL_DEVICE_MODEL_VERSION_NONE)
nic->nictype = LIBXL_NIC_TYPE_VIF;
else
nic->nictype = LIBXL_NIC_TYPE_VIF_IOEMU;
}
break;
case LIBXL_DOMAIN_TYPE_PV:
@@ -3401,7 +3391,7 @@ void libxl__device_nic_add(libxl__egc *egc, uint32_t domid,
libxl_device_nic_init(&nic_saved);
libxl_device_nic_copy(CTX, &nic_saved, nic);
rc = libxl__device_nic_setdefault(gc, nic, domid, NULL);
rc = libxl__device_nic_setdefault(gc, nic, domid);
if (rc) goto out;
front = flexarray_make(gc, 16, 1);
+7 -2
View File
@@ -916,6 +916,12 @@ static void initiate_domain_create(libxl__egc *egc,
goto error_out;
}
/*
* Set the dm version quite early so that libxl doesn't have to pass the
* build info around just to know if the domain has a device model or not.
*/
store_libxl_entry(gc, domid, &d_config->b_info);
for (i = 0; i < d_config->num_disks; i++) {
ret = libxl__device_disk_setdefault(gc, &d_config->disks[i]);
if (ret) {
@@ -940,8 +946,7 @@ static void initiate_domain_create(libxl__egc *egc,
* called libxl_device_nic_add when domcreate_launch_dm gets called,
* but qemu needs the nic information to be complete.
*/
ret = libxl__device_nic_setdefault(gc, &d_config->nics[i], domid,
&d_config->b_info);
ret = libxl__device_nic_setdefault(gc, &d_config->nics[i], domid);
if (ret) {
LOG(ERROR, "Unable to set nic defaults for nic %d", i);
goto error_out;
+1 -2
View File
@@ -1811,8 +1811,7 @@ static void spawn_stub_launch_dm(libxl__egc *egc,
* called libxl_device_nic_add at this point, but qemu needs
* the nic information to be complete.
*/
ret = libxl__device_nic_setdefault(gc, &dm_config->nics[i], dm_domid,
&dm_config->b_info);
ret = libxl__device_nic_setdefault(gc, &dm_config->nics[i], dm_domid);
if (ret)
goto out;
}
+1 -2
View File
@@ -1216,8 +1216,7 @@ _hidden int libxl__domain_build_info_setdefault(libxl__gc *gc,
_hidden int libxl__device_disk_setdefault(libxl__gc *gc,
libxl_device_disk *disk);
_hidden int libxl__device_nic_setdefault(libxl__gc *gc, libxl_device_nic *nic,
uint32_t domid,
libxl_domain_build_info *info);
uint32_t domid);
_hidden int libxl__device_vtpm_setdefault(libxl__gc *gc, libxl_device_vtpm *vtpm);
_hidden int libxl__device_vfb_setdefault(libxl__gc *gc, libxl_device_vfb *vfb);
_hidden int libxl__device_vkb_setdefault(libxl__gc *gc, libxl_device_vkb *vkb);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.