From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40487) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCPfl-0001mP-FT for qemu-devel@nongnu.org; Tue, 07 Jul 2015 06:00:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZCPff-0001WL-CG for qemu-devel@nongnu.org; Tue, 07 Jul 2015 06:00:17 -0400 Received: from relay.parallels.com ([195.214.232.42]:59635) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCPff-0001Vw-4x for qemu-devel@nongnu.org; Tue, 07 Jul 2015 06:00:11 -0400 Message-ID: <559BA31B.3090907@openvz.org> Date: Tue, 7 Jul 2015 12:59:55 +0300 From: "Denis V. Lunev" MIME-Version: 1.0 References: <1435659923-2211-1-git-send-email-den@openvz.org> <1435659923-2211-7-git-send-email-den@openvz.org> <20150707013127.17393.82688@loki> <559B8870.30704@openvz.org> <559B97E2.804@parallels.com> In-Reply-To: <559B97E2.804@parallels.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 06/10] qga: guest exec functionality for Windows guests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Olga Krishtal , Michael Roth Cc: Olga Krishtal , qemu-devel@nongnu.org On 07/07/15 12:12, Olga Krishtal wrote: > On 07/07/15 11:06, Denis V. Lunev wrote: >> On 07/07/15 04:31, Michael Roth wrote: >>> Quoting Denis V. Lunev (2015-06-30 05:25:19) >>>> From: Olga Krishtal >>>> >>>> Child process' stdin/stdout/stderr can be associated >>>> with handles for communication via read/write interfaces. >>>> >>>> The workflow should be something like this: >>>> * Open an anonymous pipe through guest-pipe-open >>>> * Execute a binary or a script in the guest. Arbitrary arguments and >>>> environment to a new child process could be passed through options >>>> * Read/pass information from/to executed process using >>>> guest-file-read/write >>>> * Collect the status of a child process >>> Have you seen anything like this in your testing? >>> >>> {'execute':'guest-exec','arguments':{'path':'/Windows/System32/ipconfig.exe', >>> >>> 'timeout':5000}} >>> {"return": {"pid": 588}} >>> {'execute':'guest-exec-status','arguments':{'pid':588}} >>> {"return": {"exit": 0, "handle-stdout": -1, "handle-stderr": -1, >>> "handle-stdin": -1, "signal": -1}} >>> {'execute':'guest-exec-status','arguments':{'pid':588}} >>> {"error": {"class": "GenericError", "desc": "Invalid parameter 'pid'"}} >>> >>> {'execute':'guest-exec','arguments':{'path':'/Windows/System32/ipconfig.exe', >>> >>> 'timeout':5000}} >>> {"error": {"class": "GenericError", "desc": "CreateProcessW() failed: >>> The parameter is incorrect. (error: 57)"}} >>> {'execute':'guest-exec','arguments':{'path':'/Windows/System32/ipconfig.exe', >>> >>> 'timeout':5000}} >>> {"error": {"class": "GenericError", "desc": "CreateProcessW() failed: >>> The parameter is incorrect. (error: 57)"}} > First if all what version of Windows are you using? > Secondly, you do need to specify environmental variable: > sudo virsh qemu-agent-command w2k12r2 > '{"execute":"guest-exec","arguments":{"path":"/Windows/System32/ipconfig.exe", > "timeout": 5000, "env":["MyEnv=00"]}' : Argh.... I have missed this fact during internal discussion and review. For sure this should be passed to the client. I think that it would be better to add this automatically to the environment variables passed to the exec arguments. > For Windows Server 2003 we do not have to pass "env" at all, but if we > are working with Server 2008 and older we have to pass "env" = "00" if > we do not want to use it. > https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/ > 59450592-aa52-4170-9742-63c84bff0010/unexpected-errorinvalidparameter > -returned-by-createprocess-too-bad?forum=windowsgeneraldevelopmentissues > This comment where included in first version of patches and I may have > forgotten it. Try to specify env and call exec several times. It > should work fine. > I will look closer at guest-exec-status double call. > >