qga: unset frozen state if no mount points are frozen
PATCH RESEND 1/1 qga: unset frozen state if no mount points are frozen
From: Chen Hanxiao <[email protected]>
If we set mountpoints to qmp_guest_fsfreeze_freeze_list, we may got nothing to freeze as all mountpoints are not valid.
Call ga_unset_frozen in this senario.
---
Rebase on master
qga/commands-posix.c | 6 ++++++ 1 file changed, 6 insertions(+)
qga/commands-posix.c +6 -0
@@ -1273,6 +1273,12 @@ int64_t qmp_guest_fsfreeze_freeze_list(bool has_mountpoints, }free_fs_mount_list (&mounts); +/* We may not issue any FIFREEZE here when had mountpoints. +* Just unset ga_state here and ready for the next call. +*/ +if (has_mountpoints && i ==0 ) { +ga_unset_frozen (ga_state); + }return i; error:
Signature · 1 line
2.14.3
Quoting Chen Hanxiao (2018-02-08 19:35:42)
Quoted 20 lines
From: Chen Hanxiao <[email protected]>
If we set mountpoints to
qmp_guest_fsfreeze_freeze_list, we may got nothing to freeze as all mountpoints are not valid.
Callga_unset_frozenin this senario.Cc Michael Roth <[email protected]>Signed-off-by Chen Hanxiao <[email protected]>---
Rebase on masterqga/commands-posix.c | 6 ++++++ 1 file changed, 6 insertions(+)qga/commands-posix.c +0
-0
qga/commands-posix.c int64_t qmp_guest_fsfreeze_freeze_list(bool has_mountpoints, · line 1281
Quoted 9 lines
qga/commands-posix.c +6
-0@@ -1273,6 +1273,12 @@ int64_t qmp_guest_fsfreeze_freeze_list(bool has_mountpoints, }free_fs_mount_list (&mounts); +/* We may not issue any FIFREEZE here when had mountpoints. +* Just unset ga_state here and ready for the next call. +*/ +if (has_mountpoints && i ==0 ) { +ga_unset_frozen (ga_state); + }
It seems odd to special-case has_mountpoints. Wouldn't:
if (i == 0) {
...
}be more consistent? Then management could infer i==0 leaves qga in unfrozen state. Otherwise I'd rather just stick with expecting a gratuitous unfreeze() since it requires less special-casing on the management/ side.
And if we do change this, we'd probably want to update qga/qapi-schema.json to reflect the behavior. I.e.:
##
# @guest-fsfreeze-freeze:
#
# Sync and freeze all freezable, local guest filesystems. If this
# command succeeded, you may call @guest-fsfreeze-thaw later to # unfreeze. ... # Returns: Number of file systems currently frozen. On error, all filesystems -# will be thawed. +# will be thawed. If no filesystems are frozen as a result of this call, +# then @guest-fsfreeze-status will remain "thawed" and calling +# @guest-fsfreeze-thaw is not necessary.
Quoted 6 lines
qga/commands-posix.c +0
-0return i; error:Signature · 1 line
2.14.3
Quoted 54 lines · Michael Roth
Quoting Chen Hanxiao (2018-02-08 19:35:42)
Quoted 20 lines
From: Chen Hanxiao <[email protected]>
If we set mountpoints to
qmp_guest_fsfreeze_freeze_list, we may got nothing to freeze as all mountpoints are not valid.
Callga_unset_frozenin this senario.Cc Michael Roth <[email protected]>Signed-off-by Chen Hanxiao <[email protected]>---
Rebase on masterqga/commands-posix.c | 6 ++++++ 1 file changed, 6 insertions(+)qga/commands-posix.c +0
-0qga/commands-posix.c int64_t qmp_guest_fsfreeze_freeze_list(bool has_mountpoints, · line 1281
Quoted 9 lines
qga/commands-posix.c +6
-0@@ -1273,6 +1273,12 @@ int64_t qmp_guest_fsfreeze_freeze_list(bool has_mountpoints, }free_fs_mount_list (&mounts); +/* We may not issue any FIFREEZE here when had mountpoints. +* Just unset ga_state here and ready for the next call. +*/ +if (has_mountpoints && i ==0 ) { +ga_unset_frozen (ga_state); + }It seems odd to special-case
has_mountpoints. Wouldn't:if (i == 0) { ...}
be more consistent? Then management could infer i==0 leaves qga in unfrozen state. Otherwise I'd rather just stick with expecting a gratuitous
unfreeze()since it requires less special-casing on the management/ side.And if we do change this, we'd probably want to update
qga/qapi-schema.jsonto reflect the behavior. I.e.:##
# @guest-fsfreeze-freeze:
#
# Sync and freeze all freezable, local guest filesystems. If this# command succeeded, you may call @guest-fsfreeze-thaw later to # unfreeze. ... # Returns: Number of file systems currently frozen. On error, all filesystems
Review
Quoted 4 lines
(quoted diff) +3
-1-# will be thawed. +# will be thawed. If no filesystems are frozen as a result of this call, +# then @guest-fsfreeze-status will remain "thawed" and calling +# @guest-fsfreeze-thaw is not necessary.
Thanks for the review.
Will be fixed in v2.
Regards,
- Chen