From: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
To: qemu-devel@nongnu.org
Cc: mitsuhiro.tanino@hds.com, mdroth@linux.vnet.ibm.com
Subject: [Qemu-devel] [PATCH v4 1/2] qga: Add guest-fsfreeze-freeze-list command
Date: Thu, 05 Jun 2014 10:57:28 -0400 [thread overview]
Message-ID: <20140605145728.10787.41278.stgit@hds.com> (raw)
In-Reply-To: <20140605145714.10787.97053.stgit@hds.com>
If an array of mount point paths is specified as 'mountpoints' argument
of guest-fsfreeze-freeze-list, qemu-ga will only freeze the file systems
mounted on specified paths in Linux guests. Otherwise, it works as the
same way as guest-fsfreeze-freeze.
This would be useful when the host wants to create partial disk snapshots.
Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
---
qga/commands-posix.c | 32 +++++++++++++++++++++++++++++++-
qga/commands-win32.c | 9 +++++++++
qga/qapi-schema.json | 17 +++++++++++++++++
3 files changed, 57 insertions(+), 1 deletion(-)
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 34ddba0..212988f 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -710,13 +710,21 @@ GuestFsfreezeStatus qmp_guest_fsfreeze_status(Error **errp)
return GUEST_FSFREEZE_STATUS_THAWED;
}
+int64_t qmp_guest_fsfreeze_freeze(Error **errp)
+{
+ return qmp_guest_fsfreeze_freeze_list(false, NULL, errp);
+}
+
/*
* Walk list of mounted file systems in the guest, and freeze the ones which
* are real local file systems.
*/
-int64_t qmp_guest_fsfreeze_freeze(Error **errp)
+int64_t qmp_guest_fsfreeze_freeze_list(bool has_mountpoints,
+ strList *mountpoints,
+ Error **errp)
{
int ret = 0, i = 0;
+ strList *list;
FsMountList mounts;
struct FsMount *mount;
Error *local_err = NULL;
@@ -741,6 +749,19 @@ int64_t qmp_guest_fsfreeze_freeze(Error **errp)
ga_set_frozen(ga_state);
QTAILQ_FOREACH_REVERSE(mount, &mounts, FsMountList, next) {
+ /* To issue fsfreeze in the reverse order of mounts, check if the
+ * mount is listed in the list here */
+ if (has_mountpoints) {
+ for (list = mountpoints; list; list = list->next) {
+ if (strcmp(list->value, mount->dirname) == 0) {
+ break;
+ }
+ }
+ if (!list) {
+ continue;
+ }
+ }
+
fd = qemu_open(mount->dirname, O_RDONLY);
if (fd == -1) {
error_setg_errno(errp, errno, "failed to open %s", mount->dirname);
@@ -1474,6 +1495,15 @@ int64_t qmp_guest_fsfreeze_freeze(Error **errp)
return 0;
}
+int64_t qmp_guest_fsfreeze_freeze_list(bool has_mountpoints,
+ strList *mountpoints,
+ Error **errp)
+{
+ error_set(errp, QERR_UNSUPPORTED);
+
+ return 0;
+}
+
int64_t qmp_guest_fsfreeze_thaw(Error **errp)
{
error_set(errp, QERR_UNSUPPORTED);
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index d793dd0..6184d05 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -204,6 +204,15 @@ error:
return 0;
}
+int64_t qmp_guest_fsfreeze_freeze_list(bool has_mountpoints,
+ strList *mountpoints,
+ Error **errp)
+{
+ error_set(errp, QERR_UNSUPPORTED);
+
+ return 0;
+}
+
/*
* Thaw local file systems using Volume Shadow-copy Service.
*/
diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json
index a8cdcb3..caa4612 100644
--- a/qga/qapi-schema.json
+++ b/qga/qapi-schema.json
@@ -387,6 +387,23 @@
'returns': 'int' }
##
+# @guest-fsfreeze-freeze-list:
+#
+# Sync and freeze specified guest filesystems
+#
+# @mountpoints: #optional an array of mountpoints of filesystems to be frozen.
+# If omitted, every mounted filesystem is frozen.
+#
+# Returns: Number of file systems currently frozen. On error, all filesystems
+# will be thawed.
+#
+# Since: 2.1
+##
+{ 'command': 'guest-fsfreeze-freeze-list',
+ 'data': { '*mountpoints': ['str'] },
+ 'returns': 'int' }
+
+##
# @guest-fsfreeze-thaw:
#
# Unfreeze all frozen guest filesystems
next prev parent reply other threads:[~2014-06-05 15:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-05 14:57 [Qemu-devel] [PATCH v4 0/2] qga: Add guest-fsfreeze-freeze-list command Tomoki Sekiyama
2014-06-05 14:57 ` Tomoki Sekiyama [this message]
2014-06-19 21:03 ` [Qemu-devel] [PATCH v4 1/2] " Eric Blake
2014-06-05 14:57 ` [Qemu-devel] [PATCH v4 2/2] qga: Add guest-get-fsinfo command Tomoki Sekiyama
2014-06-19 21:23 ` Eric Blake
2014-06-20 0:34 ` Tomoki Sekiyama
2014-06-20 15:21 ` Eric Blake
2014-06-20 21:19 ` Tomoki Sekiyama
2014-06-16 19:39 ` [Qemu-devel] [PATCH v4 0/2] qga: Add guest-fsfreeze-freeze-list command Tomoki Sekiyama
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140605145728.10787.41278.stgit@hds.com \
--to=tomoki.sekiyama@hds.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=mitsuhiro.tanino@hds.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.