From: Yuri Pudgorodskiy <yur@virtuozzo.com>
To: Michael Roth <mdroth@linux.vnet.ibm.com>,
"Denis V. Lunev" <den@openvz.org>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH for 2.5 1/1] qga: added another non-interactive gspawn() helper file.
Date: Thu, 26 Nov 2015 20:31:32 +0300 [thread overview]
Message-ID: <565741F4.6040707@virtuozzo.com> (raw)
In-Reply-To: <20151125222124.6284.52883@loki>
On 11/26/2015 1:21 AM, Michael Roth wrote:
> Quoting Denis V. Lunev (2015-11-25 13:02:26)
>> From: Yuri Pudgorodskiy <yur@virtuozzo.com>
>>
>> With previous commit we added gspawn-win64-helper-console.exe,
>> required for gspawn() mingw implementation.
>> Unfortunatly when running as a service without interactive
>> desktop, gspawn() also requires another helper app.
>>
>> Added gspawn-win64-helper.exe and gspawn-win32-helper.exe
>> for corresponding architectures.
>>
>> Signed-off-by: Yuri Pudgorodskiy <yur@virtuozzo.com>
>> Signed-off-by: Denis V. Lunev <den@openvz.org>
>> CC: Michael Roth <mdroth@linux.vnet.ibm.com>
> Thanks, applied to qga tree with minor whitespace fixup:
>
> https://github.com/mdroth/qemu/commits/qga
>
> I noticed something testing this though: if we run qemu-ga
> from a console, then exec something like ipconfig with
> capture-output: true, qemu-ga returns that output via
> guest-exec-status.
>
> If we run it as a service however, there's no output.
>
> # with qemu-ga started via console
> {'execute':'guest-exec','arguments':{'path':'/Windows/System32/ipconfig.exe',
> 'capture-output':true}}
> {"return": {"pid": 1644}}
> {'execute':'guest-exec-status','arguments':{'pid':1644}}
> {"return": {"exitcode": 0, "out-data":
> "DQpXaW5kb3dzIElQIENvbmZpZ3VyYXRpb24NCg0KDQpFdGhlcm5ldCBhZGFwdGVyIExvY2FsIEFyZWEgQ29ubmVjdGlvbiAyOg0KDQogICBDb25uZWN0aW9uLXNwZWNpZmljIEROUyBTdWZmaXggIC4gOiANCiAgIExpbmstbG9jYWwgSVB2NiBBZGRyZXNzIC4gLiAuIC4gLiA6IGZlODA6OjMwMDU6NmRjOjNjNmE6NTQ2NCUxNA0KICAgSVB2NCBBZGRyZXNzLiAuIC4gLiAuIC4gLiAuIC4gLiAuIDogMTkyLjE2OC4xMjIuMTQNCiAgIFN1Ym5ldCBNYXNrIC4gLiAuIC4gLiAuIC4gLiAuIC4gLiA6IDI1NS4yNTUuMjU1LjANCiAgIERlZmF1bHQgR2F0ZXdheSAuIC4gLiAuIC4gLiAuIC4gLiA6IDE5Mi4xNjguMTIyLjENCg0KVHVubmVsIGFkYXB0ZXIgaXNhdGFwLns3Q0Q3OTAwQy05NThCLTRBRUMtQkUwRC0yMTNERjM1NjQ2MEZ9Og0KDQogICBNZWRpYSBTdGF0ZSAuIC4gLiAuIC4gLiAuIC4gLiAuIC4gOiBNZWRpYSBkaXNjb25uZWN0ZWQNCiAgIENvbm5lY3Rpb24tc3BlY2lmaWMgRE5TIFN1ZmZpeCAgLiA6IA0KDQpUdW5uZWwgYWRhcHRlciBMb2NhbCBBcmVhIENvbm5lY3Rpb24qIDExOg0KDQogICBNZWRpYSBTdGF0ZSAuIC4gLiAuIC4gLiAuIC4gLiAuIC4gOiBNZWRpYSBkaXNjb25uZWN0ZWQNCiAgIENvbm5lY3Rpb24tc3BlY2lmaWMgRE5TIFN1ZmZpeCAgLiA6IA0K",
> "exited": true}}
>
> # wtih qemu-ga started via windows service
> {'execute':'guest-exec','arguments':{'path':'/Windows/System32/ipconfig.exe',
> 'capture-output':true}}
> {"return": {"pid": 1176}}
> {'execute':'guest-exec-status','arguments':{'pid':1176}}
> {"return": {"exitcode": 0, "exited": true}}
>
> Is this expected?
>
No, we want to fix it somehow - but not now, because the whole picture
is not clear yet.
Looks like when running gspawn() from a win32 service, some win32
processes open
its own console and write stdout to it instead of parent's fd inherited
from gspawn-helper.
Not sure whether it can be corrected without patching gspawn() and
gspawn-helper code or not.
If so, we may consider implementing platform-specific version of
guest-exec using win32 api.
Right now the best what can be suggested, it is a workaround: usage of
redirection on guest side.
Executing 3 commands in a row do a trick
cmd /c ipconfig >out.txt
cmd /c type out.txt
cmd /c del out.txt
but looks ugly and error-prone.
One more pity notice, it seems that gspawn-helper does incorrect quoting:
cmd /c echo "hello"
produces \"hello\" output instead of expected "hello".
Again, quoting issue may be another point for implementing better
win32-specific guest-exec.
I'll share my visions on this problem later after some experiments.
next prev parent reply other threads:[~2015-11-26 17:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-25 19:02 [Qemu-devel] [PATCH for 2.5 1/1] qga: added another non-interactive gspawn() helper file Denis V. Lunev
2015-11-25 22:21 ` Michael Roth
2015-11-26 17:31 ` Yuri Pudgorodskiy [this message]
2015-11-27 10:10 ` Denis V. Lunev
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=565741F4.6040707@virtuozzo.com \
--to=yur@virtuozzo.com \
--cc=den@openvz.org \
--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 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).