mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
tools/libxl: Plumb a restore boolean into libxl__domain_build_state
To fix CPUID handling, libxl__build_pre() is going to have to distinguish between a brand new VM vs one which is being migrated-in/resumed. Transcribe dcs->restore_fd into dbs->restore in initiate_domain_create() only (specifically avoiding the stubdom state in libxl__spawn_stub_dm()). While tweaking initiate_domain_create(), make a new dbs alias and simplify later code, and drop the local restore_fd alias as the new dbs->restore is more intuitive in context. No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
This commit is contained in:
1 parent
77c8294999
commit
779efdbb50
2 files changed
+11
-7
No files matched your search
@@ -1181,18 +1181,18 @@ static void initiate_domain_create(libxl__egc *egc,
|
||||
|
||||
/* convenience aliases */
|
||||
libxl_domain_config *const d_config = dcs->guest_config;
|
||||
const int restore_fd = dcs->restore_fd;
|
||||
libxl__domain_build_state *dbs = &dcs->build_state;
|
||||
|
||||
libxl__xswait_init(&dcs->console_xswait);
|
||||
|
||||
domid = dcs->domid;
|
||||
libxl__domain_build_state_init(&dcs->build_state);
|
||||
libxl__domain_build_state_init(dbs);
|
||||
dbs->restore = dcs->restore_fd >= 0;
|
||||
|
||||
ret = libxl__domain_config_setdefault(gc,d_config,domid);
|
||||
if (ret) goto error_out;
|
||||
|
||||
ret = libxl__domain_make(gc, d_config, &dcs->build_state, &domid,
|
||||
dcs->soft_reset);
|
||||
ret = libxl__domain_make(gc, d_config, dbs, &domid, dcs->soft_reset);
|
||||
if (ret) {
|
||||
LOGD(ERROR, domid, "cannot make domain: %d", ret);
|
||||
dcs->guest_domid = domid;
|
||||
@@ -1236,7 +1236,7 @@ static void initiate_domain_create(libxl__egc *egc,
|
||||
if (ret)
|
||||
goto error_out;
|
||||
|
||||
if (restore_fd >= 0 || dcs->soft_reset) {
|
||||
if (dbs->restore || dcs->soft_reset) {
|
||||
LOGD(DEBUG, domid, "restoring, not running bootloader");
|
||||
domcreate_bootloader_done(egc, &dcs->bl, 0);
|
||||
} else {
|
||||
@@ -1247,8 +1247,8 @@ static void initiate_domain_create(libxl__egc *egc,
|
||||
dcs->bl.disk = bootdisk;
|
||||
dcs->bl.domid = dcs->guest_domid;
|
||||
|
||||
dcs->bl.kernel = &dcs->build_state.pv_kernel;
|
||||
dcs->bl.ramdisk = &dcs->build_state.pv_ramdisk;
|
||||
dcs->bl.kernel = &dbs->pv_kernel;
|
||||
dcs->bl.ramdisk = &dbs->pv_ramdisk;
|
||||
|
||||
libxl__bootloader_run(egc, &dcs->bl);
|
||||
}
|
||||
|
||||
@@ -1397,6 +1397,10 @@ typedef struct {
|
||||
|
||||
/* ARM only to deal with broken firmware */
|
||||
uint32_t clock_frequency;
|
||||
|
||||
/* Whether this domain is being migrated/restored, or booting fresh. Only
|
||||
* applicable to the primary domain, not support domains (e.g. stub QEMU). */
|
||||
bool restore;
|
||||
} libxl__domain_build_state;
|
||||
|
||||
_hidden void libxl__domain_build_state_init(libxl__domain_build_state *s);
|
||||
|
||||