|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] tools/xenstored: fix live update
Commit e5b0a940557 ("tools/xenstored: Auto-introduce domains") broke
xenstored live update, as init_domains() will be skipped when live
update is detected to have happened. This will leave priv_domid and
store_domid set as invalid.
Fix that by calling init_domains() in live update case, too. In case
of live update skip introducing any found domains, as this will be done
when reading the live update state.
Fixes: e5b0a940557 ("tools/xenstored: Auto-introduce domains")
Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
tools/xenstored/core.c | 3 ++-
tools/xenstored/domain.c | 20 +++++++++++++-------
tools/xenstored/domain.h | 2 +-
3 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c
index 64c478a801..d509736c32 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -2763,7 +2763,7 @@ int main(int argc, char *argv[])
/* Listen to hypervisor. */
if (!live_update) {
domain_init(-1);
- init_domains();
+ init_domains(false);
}
/* redirect to /dev/null now we're ready to accept connections */
@@ -3109,6 +3109,7 @@ void read_state_global(const void *ctx, const void *state)
set_socket_fd(glb->socket_fd);
domain_init(glb->evtchn_fd);
+ init_domains(true);
}
static void add_buffered_data(struct buffered_data *bdata,
diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index 10ac1c1a8f..e453b3061f 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -1344,7 +1344,7 @@ static bool init_domain(unsigned int domid)
return true;
}
-void init_domains(void)
+void init_domains(bool live_update)
{
unsigned int *domids = NULL;
unsigned int nr_domids = 0;
@@ -1356,12 +1356,15 @@ void init_domains(void)
while (!xenmanage_poll_changed_domain(xm_handle, &domid, &state, &caps,
&unique_id)) {
- nr_domids++;
- domids = talloc_realloc(NULL, domids, unsigned int, nr_domids);
- if (!domids)
- barf_perror("Failed to reallocate domids");
-
- domids[nr_domids - 1] = domid;
+ if (!live_update) {
+ nr_domids++;
+ domids = talloc_realloc(NULL, domids,
+ unsigned int, nr_domids);
+ if (!domids)
+ barf_perror("Failed to reallocate domids");
+
+ domids[nr_domids - 1] = domid;
+ }
if (caps & XENMANAGE_GETDOMSTATE_CAP_CONTROL) {
/*
@@ -1397,6 +1400,9 @@ void init_domains(void)
snprintf(store_domain_path, sizeof(store_domain_path),
"/local/domain/%u", store_domid);
+ if (live_update)
+ return;
+
/*
* Privileged domid must be first to setup structures for firing the
* special watches.
diff --git a/tools/xenstored/domain.h b/tools/xenstored/domain.h
index 3b1fce74cf..28186ccac0 100644
--- a/tools/xenstored/domain.h
+++ b/tools/xenstored/domain.h
@@ -92,7 +92,7 @@ int do_set_feature(const void *ctx, struct connection *conn,
void domain_early_init(void);
void domain_init(int evtfd);
-void init_domains(void);
+void init_domains(bool live_update);
void stubdom_init(bool live_update);
void domain_deinit(void);
void ignore_connection(struct connection *conn, unsigned int err);
--
2.53.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |