libxl: domain create: Do not destroy on ao abort

If we aborted the domain creation, do not try to tear it down again
Document this.

This is a backwards-compatible API change since old libxl users will
never abort any operations.

In the current code, there is no functional change, because
ERROR_ABORTED is never generated anywhere yet.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---
v4: ABORTED not CANCELLED.
    Always write out guest domid on completion.
    Do not trash rc with libxl__set_domain_configuration on preserve path.
This commit is contained in:
Ian Jackson authored and Ian Jackson committed 2015-06-26 16:53:50 +01:00
1 parent 8a56a84b03
commit f0c4c53ff2
2 files changed
+13 -6

No files matched your search

+4
View File
@@ -975,6 +975,10 @@ int libxl_ctx_free(libxl_ctx *ctx /* 0 is OK */);
/* domain related functions */
/* If the result is ERROR_ABORTED, the domain may or may not exist
* (in a half-created state). *domid will be valid and will be the
* domain id, or -1, as appropriate */
int libxl_domain_create_new(libxl_ctx *ctx, libxl_domain_config *d_config,
uint32_t *domid,
const libxl_asyncop_how *ao_how,
+9 -6
View File
@@ -1519,7 +1519,9 @@ static void domcreate_complete(libxl__egc *egc,
if (!rc && d_config->b_info.exec_ssidref)
rc = xc_flask_relabel_domain(CTX->xch, dcs->guest_domid, d_config->b_info.exec_ssidref);
if (!rc) {
bool retain_domain = !rc || rc == ERROR_ABORTED;
if (retain_domain) {
libxl__domain_userdata_lock *lock;
/* Note that we hold CTX lock at this point so only need to
@@ -1530,15 +1532,17 @@ static void domcreate_complete(libxl__egc *egc,
rc = ERROR_LOCK_FAIL;
} else {
libxl__update_domain_configuration(gc, d_config_saved, d_config);
rc = libxl__set_domain_configuration(gc, dcs->guest_domid,
d_config_saved);
int cfg_rc = libxl__set_domain_configuration
(gc, dcs->guest_domid, d_config_saved);
if (!rc)
rc = cfg_rc;
libxl__unlock_domain_userdata(lock);
}
}
libxl_domain_config_dispose(d_config_saved);
if (rc) {
if (!retain_domain) {
if (dcs->guest_domid) {
dcs->dds.ao = ao;
dcs->dds.domid = dcs->guest_domid;
@@ -1608,8 +1612,7 @@ static void domain_create_cb(libxl__egc *egc,
libxl__app_domain_create_state *cdcs = CONTAINER_OF(dcs, *cdcs, dcs);
STATE_AO_GC(cdcs->dcs.ao);
if (!rc)
*cdcs->domid_out = domid;
*cdcs->domid_out = domid;
libxl__ao_complete(egc, ao, rc);
}
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.