diff options
author | Tomoki Sekiyama <tomoki.sekiyama@hds.com> | 2014-06-30 17:51:27 -0400 |
---|---|---|
committer | Michael Roth <mdroth@linux.vnet.ibm.com> | 2014-08-07 17:13:10 -0500 |
commit | e99bce2021d2fd41a4d02f5e7e83734b03ff2b6f (patch) | |
tree | a3c6fc8d072ef3d9b62858e289049074ee3ac56a /qga/commands-posix.c | |
parent | 2ee55b8351910e5dd898f52415064a4c5479baba (diff) |
qga: Add guest-fsfreeze-freeze-list command
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>
Reviewed-by: Eric Blake <eblake@redhat.com>
*updated schema to report 2.2 as initial supported version
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'qga/commands-posix.c')
-rw-r--r-- | qga/commands-posix.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 8e6272c5a2..883e3c50fd 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); |