Hi Alexander,

On Mon, 6 Mar 2023 at 07:30, Alexander Kanavin <alex.kana...@gmail.com> wrote:
>
> Can you please explain the use case? Who would want to enable the
> option, and what could they do when there's a running qemu?


Guest agent communication is useful to retrieve some information about
a running VM.

In my case, I use it to get the IP address of a VM configured using
macvtap which is not able to directly talk to the host over IP.

BR,
Clement

>
> This kind of information needs to go to the commit message, so we can
> document those things for the users.
>
> Alex
>
> On Sun, 5 Mar 2023 at 21:10, Clément Péron <peron.c...@gmail.com> wrote:
> >
> > Add support to the runqemu script for a new option, 'guestagent', that
> > enables the virtio serial port for host-to-guest communication.
> >
> > Signed-off-by: Brenda Streiff <brenda.stre...@ni.com>
> > Signed-off-by: Clément Péron <peron.c...@gmail.com>
> > ---
> >  scripts/runqemu | 14 ++++++++++++++
> >  1 file changed, 14 insertions(+)
> >
> > diff --git a/scripts/runqemu b/scripts/runqemu
> > index def11ea911..e71a1e8828 100755
> > --- a/scripts/runqemu
> > +++ b/scripts/runqemu
> > @@ -82,6 +82,7 @@ of the following environment variables (in any order):
> >      kvm-vhost - enable KVM with vhost when running x86/x86_64 (VT-capable 
> > CPU required)
> >      publicvnc - enable a VNC server open to all hosts
> >      audio - enable audio
> > +    guestagent - enable guest agent communication
> >      [*/]ovmf* - OVMF firmware file or base name for booting with UEFI
> >    tcpserial=<port> - specify tcp serial port number
> >    qemuparams=<xyz> - specify custom parameters to QEMU
> > @@ -216,6 +217,8 @@ class BaseConfig(object):
> >          self.cleaned = False
> >          # Files to cleanup after run
> >          self.cleanup_files = []
> > +        self.guest_agent = False
> > +        self.guest_agent_sockpath = '/tmp/qga.sock'
> >
> >      def acquire_taplock(self, error=True):
> >          logger.debug("Acquiring lockfile %s..." % self.taplock)
> > @@ -526,6 +529,10 @@ class BaseConfig(object):
> >              elif arg == 'publicvnc':
> >                  self.publicvnc = True
> >                  self.qemu_opt_script += ' -vnc :0'
> > +            elif arg == 'guestagent':
> > +                self.guest_agent = True
> > +            elif arg.startswith('guestagent-sockpath='):
> > +                self.guest_agent_sockpath = '%s' % 
> > arg[len('guestagent-sockpath='):]
> >              elif arg.startswith('tcpserial='):
> >                  self.tcpserial_portnum = '%s' % arg[len('tcpserial='):]
> >              elif arg.startswith('qemuparams='):
> > @@ -1366,6 +1373,12 @@ class BaseConfig(object):
> >              raise RunQemuError("Failed to boot, QB_SYSTEM_NAME is NULL!")
> >          self.qemu_system = qemu_system
> >
> > +    def setup_guest_agent(self):
> > +        if self.guest_agent == True:
> > +            self.qemu_opt += ' -chardev socket,path=' + 
> > self.guest_agent_sockpath + ',server,nowait,id=qga0 '
> > +            self.qemu_opt += ' -device virtio-serial '
> > +            self.qemu_opt += ' -device 
> > virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 '
> > +
> >      def setup_vga(self):
> >          if self.nographic == True:
> >              if self.sdl == True:
> > @@ -1496,6 +1509,7 @@ class BaseConfig(object):
> >          if self.snapshot:
> >              self.qemu_opt += " -snapshot"
> >
> > +        self.setup_guest_agent()
> >          self.setup_serial()
> >          self.setup_vga()
> >
> > --
> > 2.34.1
> >
> >
> > 
> >
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#178160): 
https://lists.openembedded.org/g/openembedded-core/message/178160
Mute This Topic: https://lists.openembedded.org/mt/97410707/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to