[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] qga: Add 'mountpoints' argument to guest-fsfreeze-f
From: |
Tomoki Sekiyama |
Subject: |
[Qemu-devel] [PATCH] qga: Add 'mountpoints' argument to guest-fsfreeze-freeze command |
Date: |
Fri, 25 Apr 2014 19:01:41 -0400 |
User-agent: |
StGit/0.17-dirty |
When an array of mount point paths is specified as 'mountpoints' argument
of guest-fsfreeze-freeze, qemu-ga with this patch will only freeze the file
systems mounted on specified paths in Linux.
This would be useful when the host wants to create partial disk snapshots.
Signed-off-by: Tomoki Sekiyama <address@hidden>
---
qga/commands-posix.c | 17 ++++++++++++++++-
qga/commands-win32.c | 3 ++-
qga/qapi-schema.json | 1 +
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 935a4ec..13efe96 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -711,9 +711,11 @@ GuestFsfreezeStatus qmp_guest_fsfreeze_status(Error **err)
* 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 **err)
+int64_t qmp_guest_fsfreeze_freeze(bool has_mountpoints, strList *mountpoints,
+ Error **err)
{
int ret = 0, i = 0;
+ strList *list;
FsMountList mounts;
struct FsMount *mount;
Error *local_err = NULL;
@@ -738,6 +740,19 @@ int64_t qmp_guest_fsfreeze_freeze(Error **err)
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(err, errno, "failed to open %s", mount->dirname);
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index 0ee07b6..98dd996 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -173,7 +173,8 @@ GuestFsfreezeStatus qmp_guest_fsfreeze_status(Error **err)
* Freeze local file systems using Volume Shadow-copy Service.
* The frozen state is limited for up to 10 seconds by VSS.
*/
-int64_t qmp_guest_fsfreeze_freeze(Error **err)
+int64_t qmp_guest_fsfreeze_freeze(bool has_mountpoints, strList *mountpoints,
+ Error **err)
{
int i;
Error *local_err = NULL;
diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json
index a8cdcb3..ae2f631 100644
--- a/qga/qapi-schema.json
+++ b/qga/qapi-schema.json
@@ -384,6 +384,7 @@
# Since: 0.15.0
##
{ 'command': 'guest-fsfreeze-freeze',
+ 'data': { '*mountpoints': ['str'] },
'returns': 'int' }
##
- [Qemu-devel] [PATCH] qga: Add 'mountpoints' argument to guest-fsfreeze-freeze command,
Tomoki Sekiyama <=