From: Tomoki Sekiyama <tomoki.sekiyama.qu@hitachi.com>
To: eblake@redhat.com
Cc: qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH 1/2] qemu-ga: execute script to quiesce the guest on fsfreeze-freeze/thaw
Date: Mon, 12 Nov 2012 13:10:17 +0900 [thread overview]
Message-ID: <50A076A9.50704@hitachi.com> (raw)
In-Reply-To: <509BFC36.80002@redhat.com>
Hi Eric, thanks for your review.
On 2012/11/09 3:38, Eric Blake wrote:
> On 11/08/2012 05:05 AM, Tomoki Sekiyama wrote:
>
> [Recoding to UTF-8, as ISO-2022-JP is not universally installed these
> days - you may want to reconsider your mailer's defaults]
Now this should be UTF-8, sorry.
>> To use the online disk snapshot for online-backup, application-level
>> consistency of the snapshot image is required. However, currently the
>> guest agent can provide only filesystem-level consistency, and the
>> snapshot may contain dirty data, for example, incomplete transactions.
>> This patch provides the opportunity to quiesce applications before
>> snapshot is taken.
>>
>> When the qemu-ga receives fsfreeze-freeze command, the script specified
>> in --fsfreeze-script option is executed with "freeze" argument before the
>> filesystem is frozen. For fsfreeze-thaw command, the script is executed
>> with "thaw" argument after the filesystem is thawed.
>>
>> Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama.qu@hitachi.com>
>> ---
>
>> @@ -396,6 +397,34 @@ GuestFsfreezeStatus qmp_guest_fsfreeze_status(Error **err)
>> return GUEST_FSFREEZE_STATUS_THAWED;
>> }
>>
>> +int execute_fsfreeze_script(const char *arg)
>> +{
>> + int ret = -1;
>> + const char *fsfreeze_script;
>> + char *cmdline;
>> + struct stat st;
>> +
>> + fsfreeze_script = ga_fsfreeze_script(ga_state);
>> + if (fsfreeze_script && stat(fsfreeze_script, &st) == 0) {
>> + if (S_ISREG(st.st_mode) && (st.st_mode & S_IXUSR)) {
>
> Is it any simpler to use access(fsfreeze_script, X_OK) to check if the
> script exists and is executable?
OK, I will use access() here.
<snip>
>> + ret = system(cmdline);
>
> ...system() is not required to be thread-safe, but we should assume that
> qemu-ga is multi-threaded, and therefore we should not use system.
> Besides executing things via an extra layer of shell opens doors for
> further problems; for example, if the user starts qemu-ga with
> --fsfreeze-script '/path/with spaces/script', your command line is
> horribly broken when passed through the shell. It would be much better
> to directly fork() and exec() the script ourselves instead of relying on
> system().
I will use fork()/exec() method instead of system(), as in shutdown,
so I can remove malloc/free.
>> + if (ret > 0) {
>> + g_warning("fsfreeze script failed with status=%d", ret);
>
> This is a potentially misleading message; you should be using macros
> such as WEXITSTATUS when interpreting the result of system(), since not
> all systems return exit status 1 in the same bit position.
OK. I will refine error messages.
> The idea of having the freeze and thaw actions hook out to
> user-specified actions for additional steps seems nice, but this patch
> series needs a lot more work.
Regards,
--
Tomoki Sekiyama <tomoki.sekiyama.qu@hitachi.com>
Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
next prev parent reply other threads:[~2012-11-12 4:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-08 12:05 [Qemu-devel] [PATCH 1/2] qemu-ga: execute script to quiesce the guest on fsfreeze-freeze/thaw Tomoki Sekiyama
2012-11-08 12:36 ` [Qemu-devel] [PATCH 2/2] qemu-ga: sample fsfreeze-script Tomoki Sekiyama
2012-11-08 18:25 ` Eric Blake
2012-11-12 4:10 ` Tomoki Sekiyama
2012-11-08 18:38 ` [Qemu-devel] [PATCH 1/2] qemu-ga: execute script to quiesce the guest on fsfreeze-freeze/thaw Eric Blake
2012-11-12 4:10 ` Tomoki Sekiyama [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-11-08 12:36 Tomoki Sekiyama
2012-11-09 3:05 ` Lei Li
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=50A076A9.50704@hitachi.com \
--to=tomoki.sekiyama.qu@hitachi.com \
--cc=eblake@redhat.com \
--cc=mdroth@linux.vnet.ibm.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.