char *got_old_name;
unsigned int got_old_len;
xs_transaction_t our_trans = 0;
+ uint32_t stub_dm_domid;
+ const char *stub_dm_old_name = NULL, *stub_dm_new_name = NULL;
int rc;
dom_path = libxl__xs_get_dompath(gc, domid);
name_path= libxl__sprintf(gc, "%s/name", dom_path);
if (!name_path) goto x_nomem;
+ stub_dm_domid = libxl_get_stubdom_id(CTX, domid);
+ if (stub_dm_domid) {
+ stub_dm_old_name = libxl__stub_dm_name(gc, old_name);
+ stub_dm_new_name = libxl__stub_dm_name(gc, new_name);
+ }
+
retry_transaction:
if (!trans) {
trans = our_trans = xs_transaction_start(ctx->xsh);
goto x_fail;
}
+ if (stub_dm_domid) {
+ rc = libxl__domain_rename(gc, stub_dm_domid,
+ stub_dm_old_name,
+ stub_dm_new_name,
+ trans);
+ if (rc) {
+ LOGE(ERROR, "unable to rename stub-domain");
+ goto x_rc;
+ }
+ }
+
if (our_trans) {
if (!xs_transaction_end(ctx->xsh, our_trans, 0)) {
trans = our_trans = 0;
libxl__destroy_domid_state *dis,
int rc);
+char *libxl__stub_dm_name(libxl__gc *gc, const char *guest_name)
+{
+ return libxl__sprintf(gc, "%s-dm", guest_name);
+}
+
void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss)
{
STATE_AO_GC(sdss->dm.spawn.ao);
libxl_domain_create_info_init(&dm_config->c_info);
dm_config->c_info.type = LIBXL_DOMAIN_TYPE_PV;
- dm_config->c_info.name = libxl__sprintf(gc, "%s-dm",
+ dm_config->c_info.name = libxl__stub_dm_name(gc,
libxl__domid_to_name(gc, guest_domid));
dm_config->c_info.ssidref = guest_config->b_info.device_model_ssidref;
_hidden void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state*);
+_hidden char *libxl__stub_dm_name(libxl__gc *gc, const char * guest_name);
+
/*----- Domain creation -----*/
typedef struct libxl__domain_create_state libxl__domain_create_state;