aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/console
diff options
context:
space:
mode:
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>2011-01-21 18:06:23 +0000
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>2011-01-21 18:06:23 +0000
commit648429dc4066e47d190484921845871000be217d (patch)
tree24d5fa8792ffe67913d11aaa59be1a53740ffbc6 /extras/mini-os/console
parente6859a733df7c723b211e447c6f3f3fccace6f8d (diff)
downloadxen-648429dc4066e47d190484921845871000be217d.tar.gz
xen-648429dc4066e47d190484921845871000be217d.tar.bz2
xen-648429dc4066e47d190484921845871000be217d.zip
libxl, minios: stubdom console based save/restore
Add two "special" PV consoles to stubdoms that are going to be used to send and receive the qemu-xen save files on save/restore. Use the second PV console to send the qemu-xen save file and the third PV console to receive the qemu-xen save file on restore. Fix the console shutdown function free_consfront that is called when the qemu save file is closed. Stubdom save/restore is still broken with xend. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'extras/mini-os/console')
-rw-r--r--extras/mini-os/console/xencons_ring.c39
1 files changed, 33 insertions, 6 deletions
diff --git a/extras/mini-os/console/xencons_ring.c b/extras/mini-os/console/xencons_ring.c
index bfe5cb663c..22fd6187bc 100644
--- a/extras/mini-os/console/xencons_ring.c
+++ b/extras/mini-os/console/xencons_ring.c
@@ -184,16 +184,43 @@ struct consfront_dev *xencons_ring_init(void)
void free_consfront(struct consfront_dev *dev)
{
- mask_evtchn(dev->evtchn);
+ char* err = NULL;
+ XenbusState state;
- free(dev->backend);
+ char path[strlen(dev->backend) + 1 + 5 + 1];
+ char nodename[strlen(dev->nodename) + 1 + 5 + 1];
- gnttab_end_access(dev->ring_ref);
- free_page(dev->ring);
+ snprintf(path, sizeof(path), "%s/state", dev->backend);
+ snprintf(nodename, sizeof(nodename), "%s/state", dev->nodename);
- unbind_evtchn(dev->evtchn);
+ if ((err = xenbus_switch_state(XBT_NIL, nodename, XenbusStateClosing)) != NULL) {
+ printk("free_consfront: error changing state to %d: %s\n",
+ XenbusStateClosing, err);
+ goto close;
+ }
+ state = xenbus_read_integer(path);
+ while (err == NULL && state < XenbusStateClosing)
+ err = xenbus_wait_for_state_change(path, &state, &dev->events);
+ if (err) free(err);
+
+ if ((err = xenbus_switch_state(XBT_NIL, nodename, XenbusStateClosed)) != NULL) {
+ printk("free_consfront: error changing state to %d: %s\n",
+ XenbusStateClosed, err);
+ goto close;
+ }
+close:
+ if (err) free(err);
+ xenbus_unwatch_path_token(XBT_NIL, path, path);
+
+ mask_evtchn(dev->evtchn);
+ unbind_evtchn(dev->evtchn);
+ free(dev->backend);
free(dev->nodename);
+
+ gnttab_end_access(dev->ring_ref);
+
+ free_page(dev->ring);
free(dev);
}
@@ -206,7 +233,7 @@ struct consfront_dev *init_consfront(char *_nodename)
char* msg = NULL;
char nodename[256];
char path[256];
- static int consfrontends = 1;
+ static int consfrontends = 3;
struct consfront_dev *dev;
int res;