summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-Andre Lureau <marcandre.lureau@gmail.com>2013-11-18 11:28:33 +0100
committerPavel Grunt <pgrunt@redhat.com>2016-02-12 19:05:19 +0100
commit9339284646b84a1b1e8229b38e8a991713030abc (patch)
tree42bfd82e5a5327ba56667de8efc6acf49628b77d
parentf5f84d31af424df1579250365d91e8bdb1351c62 (diff)
chardev: learn to keep running when vm is stoppedcdrom
All chardev channels are stopped when calling spice_server_vm_stop(), which prevents them from doing any i/o. However, the Spice block device channel needs to keep running even when the VM is stopped. It is entirely drived by the server, so it is entirely to the server to deal with the channel running state (finish all outstanding operations or block io).
-rw-r--r--server/char-device.c11
-rw-r--r--server/char-device.h1
-rw-r--r--server/reds.c1
3 files changed, 12 insertions, 1 deletions
diff --git a/server/char-device.c b/server/char-device.c
index 64c602da..97ef2963 100644
--- a/server/char-device.c
+++ b/server/char-device.c
@@ -47,6 +47,7 @@ struct SpiceCharDeviceClientState {
};
struct SpiceCharDeviceState {
+ int non_stop;
int running;
int active; /* has read/write been performed since the device was started */
int wait_for_migrate_data;
@@ -864,7 +865,10 @@ void spice_char_device_start(SpiceCharDeviceState *dev)
void spice_char_device_stop(SpiceCharDeviceState *dev)
{
- spice_debug("dev_state %p", dev);
+ spice_debug("char_device_stop %p: non_stop:%d", dev, dev->non_stop);
+
+ if (dev->non_stop)
+ return;
dev->running = FALSE;
dev->active = FALSE;
if (dev->write_to_dev_timer) {
@@ -872,6 +876,11 @@ void spice_char_device_stop(SpiceCharDeviceState *dev)
}
}
+void spice_char_device_set_non_stop(SpiceCharDeviceState *dev, int non_stop)
+{
+ dev->non_stop = non_stop;
+}
+
void spice_char_device_reset(SpiceCharDeviceState *dev)
{
RingItem *client_item;
diff --git a/server/char-device.h b/server/char-device.h
index db72bfe6..172757d6 100644
--- a/server/char-device.h
+++ b/server/char-device.h
@@ -182,6 +182,7 @@ void spice_char_device_client_remove(SpiceCharDeviceState *dev,
int spice_char_device_client_exists(SpiceCharDeviceState *dev,
RedClient *client);
+void spice_char_device_set_non_stop(SpiceCharDeviceState *dev, int non_stop);
void spice_char_device_start(SpiceCharDeviceState *dev);
void spice_char_device_stop(SpiceCharDeviceState *dev);
SpiceServer* spice_char_device_get_server(SpiceCharDeviceState *dev);
diff --git a/server/reds.c b/server/reds.c
index f9989e27..0fc6b64c 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3112,6 +3112,7 @@ static int spice_server_char_device_add_interface(SpiceServer *s,
}
else if (strcmp(char_device->subtype, SUBTYPE_NBD) == 0) {
dev_state = spicevmc_device_connect(reds, char_device, SPICE_CHANNEL_NBD);
+ spice_char_device_set_non_stop(dev_state, TRUE);
}
else if (strcmp(char_device->subtype, SUBTYPE_PORT) == 0) {
if (strcmp(char_device->portname, "org.spice-space.webdav.0") == 0) {