Received: from eggs.gnu.org ([2001:4830:134:3::10]:54605) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIjs4-0004Cu-Q0 for qemu-devel@nongnu.org; Tue, 03 Feb 2015 15:14:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YIjs0-0002VI-DZ for qemu-devel@nongnu.org; Tue, 03 Feb 2015 15:14:52 -0500 Received: from mail-qc0-x22e.google.com ([2607:f8b0:400d:c01::22e]:50358) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIjs0-0002V8-9x for qemu-devel@nongnu.org; Tue, 03 Feb 2015 15:14:48 -0500 Received: by mail-qc0-f174.google.com with SMTP id s11so37356377qcv.5 for ; Tue, 03 Feb 2015 12:14:48 -0800 (PST) Date: Tue, 3 Feb 2015 15:14:45 -0500 From: "Gabriel L. Somlo" Message-ID: <20150203201444.GS3354@HEDWIG.INI.CMU.EDU> References: <20150203190921.GR3354@HEDWIG.INI.CMU.EDU> <54D11DFB.906@parallels.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54D11DFB.906@parallels.com> Subject: Re: [Qemu-devel] RFC: Proposal to add QEMU "Guest Environment Variables" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Denis V. Lunev" Cc: qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com Hi Denis, On Tue, Feb 03, 2015 at 10:14:03PM +0300, Denis V. Lunev wrote: > On 03/02/15 22:09, Gabriel L. Somlo wrote: >> >>I'm interested in adding a way for a host to pass environment variables >>into a qemu guest VM -- analogous to setting environment variables for >>a process to access via getenv() and friends. >> >>The QEMU Guest Agent (QGA) does not appear to quite fit the bill, at >>least not in its current form: The agent must have been successfully >>started on the guest before the host would have to connect to it (in >>a separate act from just starting the guest in the first place), and >>get it to execute any hypothetical commands to configure or otherwise >>influence the guest. >> >>For this functionality to really resemble the way environment variables >>are used, environment information should be provided as part of the QEMU >>command line, without the requirement to make a separate/subsequent >>connection to the guest agent. For example: >> >> qemu-system-x86_64 -guest-env="VAR1=value1;VAR2=value 2" -hda image.qcow2 >> >>Once the guest is started, it should be possible to query the guest >>environment with something like: >> >> $ qemu-guest-env get VAR1 >> value1 >> >> $ qemu-guest-env get VAR2 >> value 2 >> [...] > > I think that you can do this through guest write/guest exec commands. > You can configure service start to perform it is a proper way through > guest read/guest write and after that restart the agent. Are these supposed to be commands issued from the qemu monitor prompt (or qmp) ? My Google-fu didn't help too much either :) The main idea is to be able to provide environment data to a guest at start time (on the qemu command line), and not have to worry about connecting back to it (via monitor prompt, qmp, if/when it starts the guest agent, etc) to pass more information to it later on. I'm probably misunderstanding what you said, though, so please clarify... Thanks much, --Gabriel