From: "Denis V. Lunev" <den@odin.com>
To: Eric Blake <eblake@redhat.com>, Michael Roth <mdroth@linux.vnet.ibm.com>
Cc: Olga Krishtal <okrishtal@parallels.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3 0/6] qemu: guest agent: implement guest-exec command
Date: Mon, 15 Jun 2015 10:07:04 +0300 [thread overview]
Message-ID: <557E7998.9000203@odin.com> (raw)
In-Reply-To: <5575396B.8010603@openvz.org>
On 08/06/15 09:42, Denis V. Lunev wrote:
> On 21/05/15 08:49, Denis V. Lunev wrote:
>> These patches for guest-agent add the functionality to execute
>> commands on
>> a guest UNIX machine.
>>
>> These patches add the following interfaces:
>>
>> guest-pipe-open
>> guest-exec
>> guest-exec-status
>>
>> With these interfaces it's possible to:
>>
>> * Open an anonymous pipe and work with it as with a file using already
>> implemented interfaces guest-file-{read,write,flush,close}.
>>
>> * Execute a binary or a script on a guest machine.
>> We can pass arbitrary arguments and environment to a new child process.
>>
>> * Pass redirected IO from/to stdin, stdout, stderr from a child
>> process to a
>> local file or an anonymous pipe.
>>
>> * Check the status of a child process, get its exit status if it
>> exited or get
>> signal number if it was killed.
>>
>> We plan to add support for Windows in the near future using the same
>> interfaces
>> we introduce here.
>>
>> Example of usage:
>>
>> {"execute": "guest-pipe-open", "arguments":{"mode": "r"}}
>> {'return': 1000}
>>
>> {"execute":"guest-exec", "arguments":{ "path": "id", "params": ["user"],
>> "env": ["MYENV=myvalue"], "handle_stdout": 1000 }}'
>> {"return": 2636}
>>
>> {"execute": "guest-exec-status", "arguments": {"pid": 2636}}
>> {"return":{"exit":0,"handle_stderr":-1,"handle_stdin":-1,"handle_stdout":1000,"signal":-1}}
>>
>>
>> {"execute": "guest-file-read", "arguments": {"handle": 1000,
>> "count":128}}
>> {"return":{"count":58,"buf-b64":"dWlk...","eof":true}}
>>
>> {"execute": "guest-file-close", "arguments": {"handle": 1000}}
>> {"return":{}}
>>
>>
>> These patches are based on the patches proposed by Michael Roth in 2011:
>> http://lists.gnu.org/archive/html/qemu-devel/2011-12/msg00722.html
>>
>> We made several modifications to the interfaces proposed by Michael
>> to simplify
>> their usage and we also added several new functions:
>>
>> * Arguments to an executable file are passed as an array of strings.
>>
>> Before that we had to pass parameters like this:
>> 'params': [ {'param': '-b'}, {'param': '-n1'} ]
>>
>> Now we may pass them just as an array of strings:
>> 'params': [ '-b', '-n1' ]
>>
>> * Environment can be passed to a child process.
>>
>> "env": ["MYENV=myvalue"]
>>
>> * Removed "detach" argument from "guest-exec" - it never waits for a
>> child
>> process to signal. With this change it's possible to return just PID
>> from
>> "guest-exec", a user must call "guest-exec-status" to get the status
>> of a child.
>>
>> * Removed "wait" argument from "guest-exec-status" - waiting for a
>> child process
>> to signal is dangerous, because it may block the whole qemu-ga.
>> Instead, the
>> command polls just once a status of a child.
>>
>> * "guest-exec-status" returns exit status of a child process or a
>> signal number,
>> in case a process was killed.
>>
>> * Simplified the command "guest-pipe-open" - the way how it stores
>> the pipe
>> fd's. No additional logic is needed about which end of pipe should
>> be closed
>> with "guest-file-close". This way we avoid modifying the interface
>> of the
>> existing "guest-file-close".
>>
>> In the conversation about the original patches there was a suggestion
>> to merge
>> "path" and "params" into one single list. But we didn't do so,
>> because having
>> separate "path" is similar to exec*() family functions in UNIX. That
>> way it
>> looks more consistent.
>>
>> Changes from v2:
>> - return code of commands changed to dictionary
>> - ported to current HEAD
>> - new way for moving pipe to non-blocking state (universal)
>>
>> Changes from v1:
>> - Windows version of the patchset is added
>> - SIGPIPE processing is added for Unix version of the patchset
>> - added guest_exec_file_busy() to prevent GuestFileHandle* object
>> from being
>> deleted in case it's used in guest-exec command.
>>
>> Signed-off-by: Olga Krishtal <okrishtal@parallels.com>
>> Signed-off-by: Denis V. Lunev <den@openvz.org>
>>
>> P.S. Michael, this is a working version and could we consider it for
>> merging
>> into 2.4? If you still want to use universal GLIB code, we could
>> re-write this later using standard refactoring way.
>>
> PING, 1 week till soft freeze.
>
> Eric, Michael, can you pls consider these patches? We have
> really small amount of time left.
>
> Regards,
> Den
_PING_
next prev parent reply other threads:[~2015-06-15 7:08 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-21 5:49 [Qemu-devel] [PATCH v3 0/6] qemu: guest agent: implement guest-exec command Denis V. Lunev
2015-05-21 5:49 ` [Qemu-devel] [PATCH 1/6] util, qga: drop guest_file_toggle_flags Denis V. Lunev
2015-05-21 5:49 ` [Qemu-devel] [PATCH 2/6] qga: implement guest-pipe-open command Denis V. Lunev
2015-05-21 5:49 ` [Qemu-devel] [PATCH 3/6] qga: guest exec functionality for Unix guests Denis V. Lunev
2015-05-21 5:49 ` [Qemu-devel] [PATCH 4/6] qga: handle possible SIGPIPE in guest-file-write Denis V. Lunev
2015-05-21 5:49 ` [Qemu-devel] [PATCH 5/6] qga: guest-pipe-open for Windows guest Denis V. Lunev
2015-05-21 5:49 ` [Qemu-devel] [PATCH 6/6] qga: guest exec functionality for Windows guests Denis V. Lunev
2015-05-27 7:08 ` [Qemu-devel] [PATCH v3 0/6] qemu: guest agent: implement guest-exec command Denis V. Lunev
2015-06-08 6:42 ` Denis V. Lunev
2015-06-15 7:07 ` Denis V. Lunev [this message]
2015-09-15 8:02 ` Vasiliy Tolstov
2015-09-15 8:15 ` Denis V. Lunev
2015-09-15 8:27 ` Vasiliy Tolstov
2015-10-01 7:43 ` Denis V. Lunev
2015-10-01 7:47 ` Vasiliy Tolstov
2015-10-01 7:50 ` Vasiliy Tolstov
2015-10-01 8:00 ` Denis V. Lunev
2015-10-01 8:17 ` Vasiliy Tolstov
2015-10-01 21:42 ` Michael Roth
2015-10-02 15:39 ` Vasiliy Tolstov
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=557E7998.9000203@odin.com \
--to=den@odin.com \
--cc=eblake@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=okrishtal@parallels.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).