* [Qemu-devel] [RFC PATCH 0/2] Migration: support working on file:url
@ 2016-07-21 5:05 zhanghailiang
2016-07-21 5:05 ` [Qemu-devel] [RFC PATCH 1/2] migration: Allow the migrate command to work on file:urls zhanghailiang
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: zhanghailiang @ 2016-07-21 5:05 UTC (permalink / raw)
To: qemu-devel; +Cc: amit.shah, quintela, dgilbert, peter.huangpeng, zhanghailiang
It is more simple to use file:url to migrate VM into file.
Besides, it will be used in memory snapshot.
Test:
1) migrate VM state into file:
migrate file:url
2) Restore VM from the file:
qemu-system-x86_64 xxx --incoming file:url
zhanghailiang (2):
migration: Allow the migrate command to work on file:urls
migration: Allow -incoming to work on file: urls
include/migration/migration.h | 4 +++
migration/fd.c | 71 +++++++++++++++++++++++++++++++++++--------
migration/migration.c | 4 +++
migration/trace-events | 2 ++
4 files changed, 69 insertions(+), 12 deletions(-)
--
1.8.3.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Qemu-devel] [RFC PATCH 1/2] migration: Allow the migrate command to work on file:urls
2016-07-21 5:05 [Qemu-devel] [RFC PATCH 0/2] Migration: support working on file:url zhanghailiang
@ 2016-07-21 5:05 ` zhanghailiang
2016-07-21 12:05 ` Dr. David Alan Gilbert
2016-07-21 12:13 ` Daniel P. Berrange
2016-07-21 5:06 ` [Qemu-devel] [RFC PATCH 2/2] migration: Allow -incoming to work on file: urls zhanghailiang
2016-07-21 12:19 ` [Qemu-devel] [RFC PATCH 0/2] Migration: support working on file:url Daniel P. Berrange
2 siblings, 2 replies; 10+ messages in thread
From: zhanghailiang @ 2016-07-21 5:05 UTC (permalink / raw)
To: qemu-devel
Cc: amit.shah, quintela, dgilbert, peter.huangpeng, zhanghailiang,
Benoit Canet
Usage:
(qemu) migrate file:/path/to/vm_statefile
Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
---
include/migration/migration.h | 2 ++
migration/fd.c | 34 ++++++++++++++++++++++++++++------
migration/migration.c | 2 ++
migration/trace-events | 1 +
4 files changed, 33 insertions(+), 6 deletions(-)
diff --git a/include/migration/migration.h b/include/migration/migration.h
index 3c96623..cc2e4f6 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -221,6 +221,8 @@ void fd_start_incoming_migration(const char *path, Error **errp);
void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **errp);
+void file_start_outgoing_migration(MigrationState *s, const char *filename, Error **errp);
+
void rdma_start_outgoing_migration(void *opaque, const char *host_port, Error **errp);
void rdma_start_incoming_migration(const char *host_port, Error **errp);
diff --git a/migration/fd.c b/migration/fd.c
index 84a10fd..fa5df67 100644
--- a/migration/fd.c
+++ b/migration/fd.c
@@ -23,15 +23,11 @@
#include "trace.h"
-void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **errp)
+static void fd_start_outgoing_migration_core(MigrationState *s, int fd,
+ Error **errp)
{
QIOChannel *ioc;
- int fd = monitor_get_fd(cur_mon, fdname, errp);
- if (fd == -1) {
- return;
- }
- trace_migration_fd_outgoing(fd);
ioc = qio_channel_new_fd(fd, errp);
if (!ioc) {
close(fd);
@@ -42,6 +38,32 @@ void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **
object_unref(OBJECT(ioc));
}
+void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **errp)
+{
+ int fd = monitor_get_fd(cur_mon, fdname, errp);
+ if (fd == -1) {
+ return;
+ }
+
+ trace_migration_fd_outgoing(fd);
+ fd_start_outgoing_migration_core(s, fd, errp);
+}
+
+void file_start_outgoing_migration(MigrationState *s, const char *filename,
+ Error **errp)
+{
+ int fd;
+
+ fd = qemu_open(filename, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR);
+ if (fd < 0) {
+ error_setg_errno(errp, errno, "Failed to open file: %s", filename);
+ return;
+ }
+
+ trace_migration_file_outgoing(filename);
+ fd_start_outgoing_migration_core(s, fd, errp);
+}
+
static gboolean fd_accept_incoming_migration(QIOChannel *ioc,
GIOCondition condition,
gpointer opaque)
diff --git a/migration/migration.c b/migration/migration.c
index c4e0193..097adba 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1109,6 +1109,8 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
unix_start_outgoing_migration(s, p, &local_err);
} else if (strstart(uri, "fd:", &p)) {
fd_start_outgoing_migration(s, p, &local_err);
+ } else if (strstart(uri, "file:", &p)) {
+ file_start_outgoing_migration(s, p, &local_err);
} else {
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "uri",
"a valid migration protocol");
diff --git a/migration/trace-events b/migration/trace-events
index 8568dab..4fca64c 100644
--- a/migration/trace-events
+++ b/migration/trace-events
@@ -194,6 +194,7 @@ migration_exec_incoming(const char *cmd) "cmd=%s"
# migration/fd.c
migration_fd_outgoing(int fd) "fd=%d"
migration_fd_incoming(int fd) "fd=%d"
+migration_file_outgoing(const char *filename) "file=%s"
# migration/socket.c
migration_socket_incoming_accepted(void) ""
--
1.8.3.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Qemu-devel] [RFC PATCH 2/2] migration: Allow -incoming to work on file: urls
2016-07-21 5:05 [Qemu-devel] [RFC PATCH 0/2] Migration: support working on file:url zhanghailiang
2016-07-21 5:05 ` [Qemu-devel] [RFC PATCH 1/2] migration: Allow the migrate command to work on file:urls zhanghailiang
@ 2016-07-21 5:06 ` zhanghailiang
2016-07-21 12:07 ` Dr. David Alan Gilbert
2016-07-21 12:19 ` [Qemu-devel] [RFC PATCH 0/2] Migration: support working on file:url Daniel P. Berrange
2 siblings, 1 reply; 10+ messages in thread
From: zhanghailiang @ 2016-07-21 5:06 UTC (permalink / raw)
To: qemu-devel
Cc: amit.shah, quintela, dgilbert, peter.huangpeng, zhanghailiang,
Benoit Canet
Usage:
-incoming file:/path/to/vm_statefile
Besides, use qemu_strtol() instead of strtol().
Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
---
include/migration/migration.h | 2 ++
migration/fd.c | 37 +++++++++++++++++++++++++++++++------
migration/migration.c | 2 ++
migration/trace-events | 1 +
4 files changed, 36 insertions(+), 6 deletions(-)
diff --git a/include/migration/migration.h b/include/migration/migration.h
index cc2e4f6..a7f1051 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -223,6 +223,8 @@ void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **
void file_start_outgoing_migration(MigrationState *s, const char *filename, Error **errp);
+void file_start_incoming_migration(const char *filename, Error **errp);
+
void rdma_start_outgoing_migration(void *opaque, const char *host_port, Error **errp);
void rdma_start_incoming_migration(const char *host_port, Error **errp);
diff --git a/migration/fd.c b/migration/fd.c
index fa5df67..472876c 100644
--- a/migration/fd.c
+++ b/migration/fd.c
@@ -21,7 +21,7 @@
#include "monitor/monitor.h"
#include "io/channel-util.h"
#include "trace.h"
-
+#include "qemu/cutils.h"
static void fd_start_outgoing_migration_core(MigrationState *s, int fd,
Error **errp)
@@ -73,13 +73,9 @@ static gboolean fd_accept_incoming_migration(QIOChannel *ioc,
return FALSE; /* unregister */
}
-void fd_start_incoming_migration(const char *infd, Error **errp)
+static void fd_start_incoming_migration_core(int fd, Error **errp)
{
QIOChannel *ioc;
- int fd;
-
- fd = strtol(infd, NULL, 0);
- trace_migration_fd_incoming(fd);
ioc = qio_channel_new_fd(fd, errp);
if (!ioc) {
@@ -93,3 +89,32 @@ void fd_start_incoming_migration(const char *infd, Error **errp)
NULL,
NULL);
}
+
+void fd_start_incoming_migration(const char *infd, Error **errp)
+{
+ long fd;
+ int err;
+
+ err = qemu_strtol(infd, NULL, 0, &fd);
+ if (err < 0) {
+ error_setg_errno(errp, -err, "Failed to convert string '%s'"
+ " to number", infd);
+ return;
+ }
+
+ trace_migration_fd_incoming((int)fd);
+ fd_start_incoming_migration_core((int)fd, errp);
+}
+
+void file_start_incoming_migration(const char *filename, Error **errp)
+{
+ int fd;
+
+ fd = qemu_open(filename, O_RDONLY);
+ if (fd < 0) {
+ error_setg_errno(errp, errno, "Failed to open file:%s", filename);
+ return;
+ }
+ trace_migration_file_incoming(filename);
+ fd_start_incoming_migration_core(fd, errp);
+}
diff --git a/migration/migration.c b/migration/migration.c
index 097adba..5ed3fea 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -315,6 +315,8 @@ void qemu_start_incoming_migration(const char *uri, Error **errp)
unix_start_incoming_migration(p, errp);
} else if (strstart(uri, "fd:", &p)) {
fd_start_incoming_migration(p, errp);
+ } else if (strstart(uri, "file:", &p)) {
+ file_start_incoming_migration(p, errp);
} else {
error_setg(errp, "unknown migration protocol: %s", uri);
}
diff --git a/migration/trace-events b/migration/trace-events
index 4fca64c..8a76595 100644
--- a/migration/trace-events
+++ b/migration/trace-events
@@ -195,6 +195,7 @@ migration_exec_incoming(const char *cmd) "cmd=%s"
migration_fd_outgoing(int fd) "fd=%d"
migration_fd_incoming(int fd) "fd=%d"
migration_file_outgoing(const char *filename) "file=%s"
+migration_file_incoming(const char *filename) "file=%s"
# migration/socket.c
migration_socket_incoming_accepted(void) ""
--
1.8.3.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [RFC PATCH 1/2] migration: Allow the migrate command to work on file:urls
2016-07-21 5:05 ` [Qemu-devel] [RFC PATCH 1/2] migration: Allow the migrate command to work on file:urls zhanghailiang
@ 2016-07-21 12:05 ` Dr. David Alan Gilbert
2016-07-21 12:13 ` Daniel P. Berrange
1 sibling, 0 replies; 10+ messages in thread
From: Dr. David Alan Gilbert @ 2016-07-21 12:05 UTC (permalink / raw)
To: zhanghailiang
Cc: qemu-devel, amit.shah, quintela, peter.huangpeng, Benoit Canet
* zhanghailiang (zhang.zhanghailiang@huawei.com) wrote:
> Usage:
> (qemu) migrate file:/path/to/vm_statefile
>
> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
> Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> include/migration/migration.h | 2 ++
> migration/fd.c | 34 ++++++++++++++++++++++++++++------
> migration/migration.c | 2 ++
> migration/trace-events | 1 +
> 4 files changed, 33 insertions(+), 6 deletions(-)
>
> diff --git a/include/migration/migration.h b/include/migration/migration.h
> index 3c96623..cc2e4f6 100644
> --- a/include/migration/migration.h
> +++ b/include/migration/migration.h
> @@ -221,6 +221,8 @@ void fd_start_incoming_migration(const char *path, Error **errp);
>
> void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **errp);
>
> +void file_start_outgoing_migration(MigrationState *s, const char *filename, Error **errp);
> +
> void rdma_start_outgoing_migration(void *opaque, const char *host_port, Error **errp);
>
> void rdma_start_incoming_migration(const char *host_port, Error **errp);
> diff --git a/migration/fd.c b/migration/fd.c
> index 84a10fd..fa5df67 100644
> --- a/migration/fd.c
> +++ b/migration/fd.c
> @@ -23,15 +23,11 @@
> #include "trace.h"
>
>
> -void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **errp)
> +static void fd_start_outgoing_migration_core(MigrationState *s, int fd,
> + Error **errp)
> {
> QIOChannel *ioc;
> - int fd = monitor_get_fd(cur_mon, fdname, errp);
> - if (fd == -1) {
> - return;
> - }
>
> - trace_migration_fd_outgoing(fd);
> ioc = qio_channel_new_fd(fd, errp);
> if (!ioc) {
> close(fd);
> @@ -42,6 +38,32 @@ void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **
> object_unref(OBJECT(ioc));
> }
>
> +void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **errp)
> +{
> + int fd = monitor_get_fd(cur_mon, fdname, errp);
> + if (fd == -1) {
> + return;
> + }
> +
> + trace_migration_fd_outgoing(fd);
> + fd_start_outgoing_migration_core(s, fd, errp);
> +}
> +
> +void file_start_outgoing_migration(MigrationState *s, const char *filename,
> + Error **errp)
> +{
> + int fd;
> +
> + fd = qemu_open(filename, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR);
> + if (fd < 0) {
> + error_setg_errno(errp, errno, "Failed to open file: %s", filename);
> + return;
> + }
> +
> + trace_migration_file_outgoing(filename);
> + fd_start_outgoing_migration_core(s, fd, errp);
> +}
> +
> static gboolean fd_accept_incoming_migration(QIOChannel *ioc,
> GIOCondition condition,
> gpointer opaque)
> diff --git a/migration/migration.c b/migration/migration.c
> index c4e0193..097adba 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -1109,6 +1109,8 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
> unix_start_outgoing_migration(s, p, &local_err);
> } else if (strstart(uri, "fd:", &p)) {
> fd_start_outgoing_migration(s, p, &local_err);
> + } else if (strstart(uri, "file:", &p)) {
> + file_start_outgoing_migration(s, p, &local_err);
> } else {
> error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "uri",
> "a valid migration protocol");
> diff --git a/migration/trace-events b/migration/trace-events
> index 8568dab..4fca64c 100644
> --- a/migration/trace-events
> +++ b/migration/trace-events
> @@ -194,6 +194,7 @@ migration_exec_incoming(const char *cmd) "cmd=%s"
> # migration/fd.c
> migration_fd_outgoing(int fd) "fd=%d"
> migration_fd_incoming(int fd) "fd=%d"
> +migration_file_outgoing(const char *filename) "file=%s"
>
> # migration/socket.c
> migration_socket_incoming_accepted(void) ""
> --
> 1.8.3.1
>
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [RFC PATCH 2/2] migration: Allow -incoming to work on file: urls
2016-07-21 5:06 ` [Qemu-devel] [RFC PATCH 2/2] migration: Allow -incoming to work on file: urls zhanghailiang
@ 2016-07-21 12:07 ` Dr. David Alan Gilbert
0 siblings, 0 replies; 10+ messages in thread
From: Dr. David Alan Gilbert @ 2016-07-21 12:07 UTC (permalink / raw)
To: zhanghailiang
Cc: qemu-devel, amit.shah, quintela, peter.huangpeng, Benoit Canet
* zhanghailiang (zhang.zhanghailiang@huawei.com) wrote:
> Usage:
> -incoming file:/path/to/vm_statefile
>
> Besides, use qemu_strtol() instead of strtol().
>
> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
> Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> include/migration/migration.h | 2 ++
> migration/fd.c | 37 +++++++++++++++++++++++++++++++------
> migration/migration.c | 2 ++
> migration/trace-events | 1 +
> 4 files changed, 36 insertions(+), 6 deletions(-)
>
> diff --git a/include/migration/migration.h b/include/migration/migration.h
> index cc2e4f6..a7f1051 100644
> --- a/include/migration/migration.h
> +++ b/include/migration/migration.h
> @@ -223,6 +223,8 @@ void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **
>
> void file_start_outgoing_migration(MigrationState *s, const char *filename, Error **errp);
>
> +void file_start_incoming_migration(const char *filename, Error **errp);
> +
> void rdma_start_outgoing_migration(void *opaque, const char *host_port, Error **errp);
>
> void rdma_start_incoming_migration(const char *host_port, Error **errp);
> diff --git a/migration/fd.c b/migration/fd.c
> index fa5df67..472876c 100644
> --- a/migration/fd.c
> +++ b/migration/fd.c
> @@ -21,7 +21,7 @@
> #include "monitor/monitor.h"
> #include "io/channel-util.h"
> #include "trace.h"
> -
> +#include "qemu/cutils.h"
>
> static void fd_start_outgoing_migration_core(MigrationState *s, int fd,
> Error **errp)
> @@ -73,13 +73,9 @@ static gboolean fd_accept_incoming_migration(QIOChannel *ioc,
> return FALSE; /* unregister */
> }
>
> -void fd_start_incoming_migration(const char *infd, Error **errp)
> +static void fd_start_incoming_migration_core(int fd, Error **errp)
> {
> QIOChannel *ioc;
> - int fd;
> -
> - fd = strtol(infd, NULL, 0);
> - trace_migration_fd_incoming(fd);
>
> ioc = qio_channel_new_fd(fd, errp);
> if (!ioc) {
> @@ -93,3 +89,32 @@ void fd_start_incoming_migration(const char *infd, Error **errp)
> NULL,
> NULL);
> }
> +
> +void fd_start_incoming_migration(const char *infd, Error **errp)
> +{
> + long fd;
> + int err;
> +
> + err = qemu_strtol(infd, NULL, 0, &fd);
> + if (err < 0) {
> + error_setg_errno(errp, -err, "Failed to convert string '%s'"
> + " to number", infd);
> + return;
> + }
> +
> + trace_migration_fd_incoming((int)fd);
> + fd_start_incoming_migration_core((int)fd, errp);
> +}
> +
> +void file_start_incoming_migration(const char *filename, Error **errp)
> +{
> + int fd;
> +
> + fd = qemu_open(filename, O_RDONLY);
> + if (fd < 0) {
> + error_setg_errno(errp, errno, "Failed to open file:%s", filename);
> + return;
> + }
> + trace_migration_file_incoming(filename);
> + fd_start_incoming_migration_core(fd, errp);
> +}
> diff --git a/migration/migration.c b/migration/migration.c
> index 097adba..5ed3fea 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -315,6 +315,8 @@ void qemu_start_incoming_migration(const char *uri, Error **errp)
> unix_start_incoming_migration(p, errp);
> } else if (strstart(uri, "fd:", &p)) {
> fd_start_incoming_migration(p, errp);
> + } else if (strstart(uri, "file:", &p)) {
> + file_start_incoming_migration(p, errp);
> } else {
> error_setg(errp, "unknown migration protocol: %s", uri);
> }
> diff --git a/migration/trace-events b/migration/trace-events
> index 4fca64c..8a76595 100644
> --- a/migration/trace-events
> +++ b/migration/trace-events
> @@ -195,6 +195,7 @@ migration_exec_incoming(const char *cmd) "cmd=%s"
> migration_fd_outgoing(int fd) "fd=%d"
> migration_fd_incoming(int fd) "fd=%d"
> migration_file_outgoing(const char *filename) "file=%s"
> +migration_file_incoming(const char *filename) "file=%s"
>
> # migration/socket.c
> migration_socket_incoming_accepted(void) ""
> --
> 1.8.3.1
>
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [RFC PATCH 1/2] migration: Allow the migrate command to work on file:urls
2016-07-21 5:05 ` [Qemu-devel] [RFC PATCH 1/2] migration: Allow the migrate command to work on file:urls zhanghailiang
2016-07-21 12:05 ` Dr. David Alan Gilbert
@ 2016-07-21 12:13 ` Daniel P. Berrange
1 sibling, 0 replies; 10+ messages in thread
From: Daniel P. Berrange @ 2016-07-21 12:13 UTC (permalink / raw)
To: zhanghailiang
Cc: qemu-devel, Benoit Canet, quintela, peter.huangpeng, dgilbert, amit.shah
On Thu, Jul 21, 2016 at 01:05:59PM +0800, zhanghailiang wrote:
> Usage:
> (qemu) migrate file:/path/to/vm_statefile
>
> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
> Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
> ---
> include/migration/migration.h | 2 ++
> migration/fd.c | 34 ++++++++++++++++++++++++++++------
> migration/migration.c | 2 ++
> migration/trace-events | 1 +
> 4 files changed, 33 insertions(+), 6 deletions(-)
>
> diff --git a/include/migration/migration.h b/include/migration/migration.h
> index 3c96623..cc2e4f6 100644
> --- a/include/migration/migration.h
> +++ b/include/migration/migration.h
> @@ -221,6 +221,8 @@ void fd_start_incoming_migration(const char *path, Error **errp);
>
> void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **errp);
>
> +void file_start_outgoing_migration(MigrationState *s, const char *filename, Error **errp);
> +
> void rdma_start_outgoing_migration(void *opaque, const char *host_port, Error **errp);
>
> void rdma_start_incoming_migration(const char *host_port, Error **errp);
> diff --git a/migration/fd.c b/migration/fd.c
> index 84a10fd..fa5df67 100644
> --- a/migration/fd.c
> +++ b/migration/fd.c
> @@ -23,15 +23,11 @@
> #include "trace.h"
>
>
> -void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **errp)
> +static void fd_start_outgoing_migration_core(MigrationState *s, int fd,
> + Error **errp)
> {
> QIOChannel *ioc;
> - int fd = monitor_get_fd(cur_mon, fdname, errp);
> - if (fd == -1) {
> - return;
> - }
>
> - trace_migration_fd_outgoing(fd);
> ioc = qio_channel_new_fd(fd, errp);
> if (!ioc) {
> close(fd);
> @@ -42,6 +38,32 @@ void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **
> object_unref(OBJECT(ioc));
> }
>
> +void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **errp)
> +{
> + int fd = monitor_get_fd(cur_mon, fdname, errp);
> + if (fd == -1) {
> + return;
> + }
> +
> + trace_migration_fd_outgoing(fd);
> + fd_start_outgoing_migration_core(s, fd, errp);
> +}
> +
> +void file_start_outgoing_migration(MigrationState *s, const char *filename,
> + Error **errp)
> +{
> + int fd;
> +
> + fd = qemu_open(filename, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR);
> + if (fd < 0) {
> + error_setg_errno(errp, errno, "Failed to open file: %s", filename);
> + return;
> + }
> +
> + trace_migration_file_outgoing(filename);
> + fd_start_outgoing_migration_core(s, fd, errp);
> +}
This isn't going to fly.
Annoyingly with plain files on POSIX platforms you can't get non-blocking
I/O, so even though we'll be setting the O_NONBLOCK on fd shortly, I/O is
still going to block the entire thread. The same applies for file reads
wrt to your next patch supporting incoming mode.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [RFC PATCH 0/2] Migration: support working on file:url
2016-07-21 5:05 [Qemu-devel] [RFC PATCH 0/2] Migration: support working on file:url zhanghailiang
2016-07-21 5:05 ` [Qemu-devel] [RFC PATCH 1/2] migration: Allow the migrate command to work on file:urls zhanghailiang
2016-07-21 5:06 ` [Qemu-devel] [RFC PATCH 2/2] migration: Allow -incoming to work on file: urls zhanghailiang
@ 2016-07-21 12:19 ` Daniel P. Berrange
2016-07-21 17:41 ` Dr. David Alan Gilbert
2016-07-22 6:28 ` Hailiang Zhang
2 siblings, 2 replies; 10+ messages in thread
From: Daniel P. Berrange @ 2016-07-21 12:19 UTC (permalink / raw)
To: zhanghailiang; +Cc: qemu-devel, amit.shah, peter.huangpeng, dgilbert, quintela
On Thu, Jul 21, 2016 at 01:05:58PM +0800, zhanghailiang wrote:
> It is more simple to use file:url to migrate VM into file.
> Besides, it will be used in memory snapshot.
NB, you can already migrate into a file
"exec:/bin/cat > /path/to/file"
and likewise
qemu -incoming "exec:/bin/cat /path/to/file"
This avoids the problem with POSIX I/O on plain files not actually
supporting O_NONBLOCK in any sensible manner, which your file:
suggestion suffers from.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [RFC PATCH 0/2] Migration: support working on file:url
2016-07-21 12:19 ` [Qemu-devel] [RFC PATCH 0/2] Migration: support working on file:url Daniel P. Berrange
@ 2016-07-21 17:41 ` Dr. David Alan Gilbert
2016-07-22 8:04 ` Daniel P. Berrange
2016-07-22 6:28 ` Hailiang Zhang
1 sibling, 1 reply; 10+ messages in thread
From: Dr. David Alan Gilbert @ 2016-07-21 17:41 UTC (permalink / raw)
To: Daniel P. Berrange
Cc: zhanghailiang, qemu-devel, amit.shah, peter.huangpeng, quintela
* Daniel P. Berrange (berrange@redhat.com) wrote:
> On Thu, Jul 21, 2016 at 01:05:58PM +0800, zhanghailiang wrote:
> > It is more simple to use file:url to migrate VM into file.
> > Besides, it will be used in memory snapshot.
>
> NB, you can already migrate into a file
>
> "exec:/bin/cat > /path/to/file"
>
> and likewise
>
> qemu -incoming "exec:/bin/cat /path/to/file"
>
> This avoids the problem with POSIX I/O on plain files not actually
> supporting O_NONBLOCK in any sensible manner, which your file:
> suggestion suffers from.
Hmm that's a shame; I liked this idea as a nice simplification of the
exec: stuff.
Dave
> Regards,
> Daniel
> --
> |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
> |: http://libvirt.org -o- http://virt-manager.org :|
> |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
> |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [RFC PATCH 0/2] Migration: support working on file:url
2016-07-21 12:19 ` [Qemu-devel] [RFC PATCH 0/2] Migration: support working on file:url Daniel P. Berrange
2016-07-21 17:41 ` Dr. David Alan Gilbert
@ 2016-07-22 6:28 ` Hailiang Zhang
1 sibling, 0 replies; 10+ messages in thread
From: Hailiang Zhang @ 2016-07-22 6:28 UTC (permalink / raw)
To: Daniel P. Berrange
Cc: peter.huangpeng, qemu-devel, amit.shah, dgilbert, quintela
On 2016/7/21 20:19, Daniel P. Berrange wrote:
> On Thu, Jul 21, 2016 at 01:05:58PM +0800, zhanghailiang wrote:
>> It is more simple to use file:url to migrate VM into file.
>> Besides, it will be used in memory snapshot.
>
> NB, you can already migrate into a file
>
> "exec:/bin/cat > /path/to/file"
>
> and likewise
>
> qemu -incoming "exec:/bin/cat /path/to/file"
>
> This avoids the problem with POSIX I/O on plain files not actually
> supporting O_NONBLOCK in any sensible manner, which your file:
> suggestion suffers from.
>
OK, got it, please ignore this series. Thanks.
> Regards,
> Daniel
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [RFC PATCH 0/2] Migration: support working on file:url
2016-07-21 17:41 ` Dr. David Alan Gilbert
@ 2016-07-22 8:04 ` Daniel P. Berrange
0 siblings, 0 replies; 10+ messages in thread
From: Daniel P. Berrange @ 2016-07-22 8:04 UTC (permalink / raw)
To: Dr. David Alan Gilbert
Cc: zhanghailiang, qemu-devel, amit.shah, peter.huangpeng, quintela
On Thu, Jul 21, 2016 at 06:41:23PM +0100, Dr. David Alan Gilbert wrote:
> * Daniel P. Berrange (berrange@redhat.com) wrote:
> > On Thu, Jul 21, 2016 at 01:05:58PM +0800, zhanghailiang wrote:
> > > It is more simple to use file:url to migrate VM into file.
> > > Besides, it will be used in memory snapshot.
> >
> > NB, you can already migrate into a file
> >
> > "exec:/bin/cat > /path/to/file"
> >
> > and likewise
> >
> > qemu -incoming "exec:/bin/cat /path/to/file"
> >
> > This avoids the problem with POSIX I/O on plain files not actually
> > supporting O_NONBLOCK in any sensible manner, which your file:
> > suggestion suffers from.
>
> Hmm that's a shame; I liked this idea as a nice simplification of the
> exec: stuff.
The only way to achieve that would be to spawn a thread in QEMU that
does I/O to the actual file, and then have the migration code do I/O
to/from that thread via a pipe. IOW, the thread would take the role
of cat. What that's worth doing or not I don't know, given that it
is already possible to use exec+cat.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-07-22 8:04 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-21 5:05 [Qemu-devel] [RFC PATCH 0/2] Migration: support working on file:url zhanghailiang
2016-07-21 5:05 ` [Qemu-devel] [RFC PATCH 1/2] migration: Allow the migrate command to work on file:urls zhanghailiang
2016-07-21 12:05 ` Dr. David Alan Gilbert
2016-07-21 12:13 ` Daniel P. Berrange
2016-07-21 5:06 ` [Qemu-devel] [RFC PATCH 2/2] migration: Allow -incoming to work on file: urls zhanghailiang
2016-07-21 12:07 ` Dr. David Alan Gilbert
2016-07-21 12:19 ` [Qemu-devel] [RFC PATCH 0/2] Migration: support working on file:url Daniel P. Berrange
2016-07-21 17:41 ` Dr. David Alan Gilbert
2016-07-22 8:04 ` Daniel P. Berrange
2016-07-22 6:28 ` Hailiang Zhang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.