virtagent - fsfreeze support
v3 cover virtagent - fsfreeze support
From: Jes Sorensen <[email protected]>
Hi
This is a first attempt to add fsfreeze support to virtagent. The idea is for the guest agent to walk the list of locally mounted file systems in the guest, and issuing an ioctl to freeze them. The host can then do a live snapshot of the guest, obtaining stable file systems. After the snapshot, the host then calls the thaw function in virtagent, which goes through the list of previously frozen file systems and unfreezes them.
The list walking ignores remote file systems such as NFS and CIFS as well as all pseudo file systems.
The guest agent code is in the first patch, and host agent code is in the second patch. For now there is only human monitor support, but it should be pretty straight forward to add QMP support as well.
Comments and suggestions welcome!
v3 of the patch encapsulates the freeze states in a struct and fixes some tab issues that I had missed. Both pointed out by Michael Roth.
v2 of the patch addresses the issues pointed out by Stefan and Michael.
Note I will be gone all of next week, so if I don't reply it's because I am busy skiing :)
Cheers,
Jes
Jes Sorensen (2):
Add virtagent file system freeze/thaw
Add monitor commands for fsfreeze support
hmp-commands.hx | 48 +++++++++++ virtagent-common.h | 9 ++ virtagent-server.c | 195 +++++++++++++++++++++++++++++++++++++++++++ virtagent.c | 235 ++++++++++++++++++++++++++++++++++++++++++++++++++++ virtagent.h | 9 ++ 5 files changed, 496 insertions(+), 0 deletions(-)
Signature · 1 line
1.7.3.5
PATCH v3 1/2 Add virtagent file system freeze/thaw
From: Jes Sorensen <[email protected]>
Implement freeze/thaw support in the guest, allowing the host to request the guest freezes all it's file systems before a live snapshot is performed.
- fsfreeze(): Walk the list of mounted local real file systems, and freeze them.
- fsthaw(): Walk the list of previously frozen file systems and
thaw them.
- fsstatus(): Return the current status of freeze/thaw. The host must poll this function, in case fsfreeze() returned with a timeout, to wait for the operation to finish.
--- virtagent-common.h | 8 ++ virtagent-server.c | 195 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 203 insertions(+), 0 deletions(-)
virtagent-common.h +8 -0
@@ -61,6 +61,14 @@ typedef struct VAContext {const char *channel_path; } VAContext; +enum va_fsfreeze_status { +FREEZE_ERROR =-1 , +FREEZE_THAWED =0 , +FREEZE_INPROGRESS =1 , +FREEZE_FROZEN =2 , +FREEZE_THAWINPROGRESS =3 , +}; +enum va_job_status {VA_JOB_STATUS_PENDING =0 ,VA_JOB_STATUS_OK ,
virtagent-server.c +195 -0
213 lines not on this page · raw message
Signature · 1 line
1.7.3.5
PATCH v3 2/2 Add monitor commands for fsfreeze support
In reply to [email protected]From: Jes Sorensen <[email protected]>
This patch adds the following monitor commands:
agent_fsfreeze:
- Freezes all local file systems in the guest. Command will print the number of file systems that were frozen.agent_fsthaw:
- Thaws all local file systems in the guest. Command will print the number of file systems that were thawed.agent_fsstatus:
- Prints the current status of file systems in the guest:
Thawed, frozen, thaw in progress, freeze in progress, error.
--- hmp-commands.hx | 48 +++++++++++ virtagent-common.h | 1 + virtagent.c | 235 ++++++++++++++++++++++++++++++++++++++++++++++++++++ virtagent.h | 9 ++ 4 files changed, 293 insertions(+), 0 deletions(-)
hmp-commands.hx +48 -0
@@ -1310,6 +1310,54 @@ STEXI Fetch and re-negotiate guest agent capabilties ETEXI + { + .name = "agent_fsfreeze", + .args_type = "", + .params = "", + .help = "Freeze all local file systems mounted in the guest", + .user_print = do_agent_fsfreeze_print, + .mhandler.cmd_async = do_agent_fsfreeze, + .flags = MONITOR_CMD_ASYNC, + }, + +STEXI +@item agent_fsfreeze +@findex agent_fsfreeze +Freeze all local mounted file systems in guest +ETEXI + + { + .name = "agent_fsthaw", + .args_type = "", + .params = "", + .help = "Thaw all local file systems mounted in the guest", + .user_print = do_agent_fsthaw_print, + .mhandler.cmd_async = do_agent_fsthaw, + .flags = MONITOR_CMD_ASYNC, + }, + +STEXI +@item agent_fsthaw +@findex agent_fsthaw +Thaw all local mounted file systems in guest +ETEXI + + { + .name = "agent_fsstatus", + .args_type = "", + .params = "", + .help = "Display status of file system freeze progress in guest", + .user_print = do_agent_fsstatus_print, + .mhandler.cmd_async = do_agent_fsstatus, + .flags = MONITOR_CMD_ASYNC, + }, + +STEXI +@item agent_fsstatus +@findex agent_fsstatus +Get status of file system freeze in guest +ETEXI + STEXI @end table ETEXI
virtagent-common.h +1 -0
@@ -24,6 +24,7 @@#include "monitor.h" #include "virtagent-server.h" #include "virtagent.h" +#include "qint.h" #define DEBUG_VA
virtagent.c +235 -0
238 lines not on this page · raw message
virtagent.h +9 -0
@@ -46,5 +46,14 @@ int do_agent_capabilities(Monitor *mon, const QDict *mon_params, MonitorCompletion cb, void *opaque);int va_client_init_capabilities (void );int va_send_hello (void ); +void do_agent_fsfreeze_print (Monitor *mon,const QObject *qobject); +int do_agent_fsfreeze (Monitor *mon,const QDict *mon_params, +MonitorCompletion cb,void *opaque); +void do_agent_fsthaw_print (Monitor *mon,const QObject *qobject); +int do_agent_fsthaw (Monitor *mon,const QDict *mon_params, +MonitorCompletion cb,void *opaque); +void do_agent_fsstatus_print (Monitor *mon,const QObject *qobject); +int do_agent_fsstatus (Monitor *mon,const QDict *mon_params, +MonitorCompletion cb,void *opaque);#endif /* VIRTAGENT_H */
Signature · 1 line
1.7.3.5