qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 59e35c: qga/commands-posix: Use getifaddrs wh


From: Richard Henderson
Subject: [Qemu-commits] [qemu/qemu] 59e35c: qga/commands-posix: Use getifaddrs when available
Date: Wed, 04 May 2022 08:07:41 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 59e35c7b659dc5b02c3525f9a2fd422fbc4b1364
      
https://github.com/qemu/qemu/commit/59e35c7b659dc5b02c3525f9a2fd422fbc4b1364
  Author: Andrew Deason <adeason@sinenomine.net>
  Date:   2022-05-04 (Wed, 04 May 2022)

  Changed paths:
    M meson.build
    M qga/commands-posix.c

  Log Message:
  -----------
  qga/commands-posix: Use getifaddrs when available

Currently, commands-posix.c assumes that getifaddrs() is only
available on Linux, and so the related guest agent command
guest-network-get-interfaces is only implemented for #ifdef __linux__.
This function does exist on other platforms, though, such as Solaris.
So, add a meson check for getifaddrs(), and move the code for
guest-network-get-interfaces to be built whenever getifaddrs() is
available.

The implementation for guest-network-get-interfaces still has some
Linux-specific code, which is not fixed in this commit. This commit
moves the relevant big chunks of code around without changing them, so
a future commit can change the code in place.

Signed-off-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Message-Id: <20220426195526.7699-2-adeason@sinenomine.net>


  Commit: aec0730ea9a150f23a5a2bbb87903a2900e5e72f
      
https://github.com/qemu/qemu/commit/aec0730ea9a150f23a5a2bbb87903a2900e5e72f
  Author: Andrew Deason <adeason@sinenomine.net>
  Date:   2022-05-04 (Wed, 04 May 2022)

  Changed paths:
    M qga/commands-posix.c

  Log Message:
  -----------
  qga/commands-posix: Fix iface hw address detection

Since its introduction in commit 3424fc9f16a1 ("qemu-ga: add
guest-network-get-interfaces command"), guest-network-get-interfaces
seems to check if a given interface has a hardware address by checking
'ifa->ifa_flags & SIOCGIFHWADDR'. But ifa_flags is a field for IFF_*
flags (IFF_UP, IFF_LOOPBACK, etc), and comparing it to an ioctl like
SIOCGIFHWADDR doesn't make sense.

On Linux, this isn't a big deal, since SIOCGIFHWADDR has so many bits
set (0x8927), 'ifa->ifa_flags & SIOCGIFHWADDR' will usually have a
nonzero result for any 'normal'-looking interfaces: anything with
IFF_UP (0x1) or IFF_BROADCAST (0x2) set, as well as several
less-common flags. This means we'll try to get the hardware address
for most/all interfaces, even those that don't really have one (like
the loopback device). For those interfaces, Linux just returns a
hardware address of all zeroes.

On Solaris, however, trying to get the hardware address for a loopback
device returns an EADDRNOTAVAIL error. This causes us to return an
error and the entire guest-network-get-interfaces call fails.

Change this logic to always try to get the hardware address for each
interface, and don't return an error if we fail to get it. Instead,
just don't include the 'hardware-address' field in the result if we
can't get the hardware address.

Signed-off-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Message-Id: <20220426195526.7699-3-adeason@sinenomine.net>


  Commit: 70335c4644f3c05456c72020ae54b1dbeba905d7
      
https://github.com/qemu/qemu/commit/70335c4644f3c05456c72020ae54b1dbeba905d7
  Author: Andrew Deason <adeason@sinenomine.net>
  Date:   2022-05-04 (Wed, 04 May 2022)

  Changed paths:
    M qga/commands-posix.c

  Log Message:
  -----------
  qga/commands-posix: Fix listing ifaces for Solaris

The code for guest-network-get-interfaces needs a couple of small
adjustments for Solaris:

- The results from SIOCGIFHWADDR are documented as being in ifr_addr,
  not ifr_hwaddr (ifr_hwaddr doesn't exist on Solaris).

- The implementation of guest_get_network_stats is Linux-specific, so
  hide it under #ifdef CONFIG_LINUX. On non-Linux, we just won't
  provide network interface stats.

Signed-off-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Message-Id: <20220426195526.7699-4-adeason@sinenomine.net>


  Commit: a539dc8a2c76dc8f04585a265e07af6ebaa4b86a
      
https://github.com/qemu/qemu/commit/a539dc8a2c76dc8f04585a265e07af6ebaa4b86a
  Author: Andrew Deason <adeason@sinenomine.net>
  Date:   2022-05-04 (Wed, 04 May 2022)

  Changed paths:
    M qga/commands-posix.c

  Log Message:
  -----------
  qga/commands-posix: Log all net stats failures

guest_get_network_stats can silently fail in a couple of ways. Add
debug messages to these cases, so we're never completely silent on
failure.

Signed-off-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220426195526.7699-5-adeason@sinenomine.net>


  Commit: c8ec041d0006ef3e930840f7c62869a1e44c5ced
      
https://github.com/qemu/qemu/commit/c8ec041d0006ef3e930840f7c62869a1e44c5ced
  Author: Andrew Deason <adeason@sinenomine.net>
  Date:   2022-05-04 (Wed, 04 May 2022)

  Changed paths:
    M qga/commands-posix.c

  Log Message:
  -----------
  qga/commands-posix: 'guest-shutdown' for Solaris

On Solaris, instead of the -P, -H, and -r flags, we need to provide
the target init state to the 'shutdown' command: state 5 is poweroff,
0 is halt, and 6 is reboot. We also need to pass -g0 to avoid the
default 60-second delay, and -y to avoid a confirmation prompt.

Implement this logic under an #ifdef CONFIG_SOLARIS, so the
'guest-shutdown' command works properly on Solaris.

Signed-off-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220426195526.7699-6-adeason@sinenomine.net>


  Commit: d48f61c8ea838ec8c232c54f043c855359774a7a
      
https://github.com/qemu/qemu/commit/d48f61c8ea838ec8c232c54f043c855359774a7a
  Author: zhenwei pi <pizhenwei@bytedance.com>
  Date:   2022-05-04 (Wed, 04 May 2022)

  Changed paths:
    M qga/commands-posix.c
    M qga/qapi-schema.json

  Log Message:
  -----------
  qga: Introduce NVMe disk bus type

Assigning a NVMe disk by VFIO or emulating a NVMe controller by QEMU,
a NVMe disk get exposed in guest side. Support NVMe disk bus type and
implement posix version.

Test PCI passthrough case:
~#virsh qemu-agent-command buster '{"execute":"guest-get-disks"}' | jq
  ...
    {
      "name": "/dev/nvme0n1",
      "dependencies": [],
      "partition": false,
      "address": {
        "serial": "SAMSUNG MZQL23T8HCLS-00A07_S64HNE0N500076",
        "bus-type": "nvme",
        "bus": 0,
        "unit": 0,
        "pci-controller": {
          "bus": 0,
          "slot": 22,
          "domain": 0,
          "function": 0
        },
        "dev": "/dev/nvme0n1",
        "target": 0
      }
  ...

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Message-Id: <20220420022610.418052-2-pizhenwei@bytedance.com>


  Commit: 22668881f3def13e9ffcf16840e5fde974a55b1e
      
https://github.com/qemu/qemu/commit/22668881f3def13e9ffcf16840e5fde974a55b1e
  Author: zhenwei pi <pizhenwei@bytedance.com>
  Date:   2022-05-04 (Wed, 04 May 2022)

  Changed paths:
    M qga/commands-posix.c
    M qga/qapi-schema.json

  Log Message:
  -----------
  qga: Introduce disk smart

After assigning a NVMe/SCSI controller to guest by VFIO, we lose
everything on the host side. A guest uses these devices exclusively,
we usually don't care the actions on these devices. But there is a
low probability that hitting physical hardware warning, we need a
chance to get the basic smart log info.

Introduce disk smart, and implement NVMe smart on linux.

Thanks to Keith and Marc-André.

CC: Keith Busch <kbusch@kernel.org>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Message-Id: <20220420022610.418052-3-pizhenwei@bytedance.com>


  Commit: 9cf289af47bcfae5c75de37d8e5d6fd23705322c
      
https://github.com/qemu/qemu/commit/9cf289af47bcfae5c75de37d8e5d6fd23705322c
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-05-04 (Wed, 04 May 2022)

  Changed paths:
    M meson.build
    M qga/commands-posix.c
    M qga/qapi-schema.json

  Log Message:
  -----------
  Merge tag 'qga-pull-request' of gitlab.com:marcandre.lureau/qemu into staging

QGA Pull request

# -----BEGIN PGP SIGNATURE-----
#
# iQJQBAABCAA6FiEEh6m9kz+HxgbSdvYt2ujhCXWWnOUFAmJyToAcHG1hcmNhbmRy
# ZS5sdXJlYXVAcmVkaGF0LmNvbQAKCRDa6OEJdZac5e0tD/4y6+wWkn+ZjdNknpwB
# LzbCtpohTvdRVJ9f22i/niFhKfAS25aB7CeQIuDrsC0Bc7+4NV49DeGPh4pnH05B
# fNYJH+6/xYuc0cYML8FSqntbe1ElaIUP9vUPjIv3S4+IPMSkAyNI0xWkCiPsW8H4
# rHpMMmtBJQNiS1KxE0ahj1WOkwnNsDWxL80fh5RBwb3g2ZHrIjilOrs6MnCDRM8r
# vYHK8cfGg+Lp/4hXB0mqTHw6oEmtCSiOZqE2rnIiHEI2kbW0DFu7yxtEX6aBjM6a
# s6NkzYSkBzUjV3HOU/aWCTJOz6jL+nzsdAe413ll0VWv8UUVAgDnOfG7BewIW7jn
# LFpIjsTen7VqVp6n96k8lPkoInnszyKVrJ/4AnS3PDrdfgg7B0RIx/exjrd249YX
# XsZjcW/vF4gRuu0YyNZESgeR0/y/7HRN6X9dCtF5vsjeqswEWoqH0vSkca8fbZCR
# yjE9z/dUuWwCBwq03UmtAy6POPhEw8QMld7SPGFl5n6Z7569hhWErYnu6ey/Xwwb
# W6W2EdFRCWF3cR4nxDFCoJVFjFybYIl2qNLu01tJ1kqsaIJMxfyt1fP09Jd4tifk
# CrAS1zpZSgDYRbzA5UGZ8Xir10uy+GyjFxIYnDYpqRy6nTDuG7wP2Ua+w182/2fd
# RwbzF98vV/AMoEqSAiHVQ56KMw==
# =Fm6Z
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 04 May 2022 02:59:28 AM PDT
# gpg:                using RSA key 87A9BD933F87C606D276F62DDAE8E10975969CE5
# gpg:                issuer "marcandre.lureau@redhat.com"
# gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" 
[full]
# gpg:                 aka "Marc-André Lureau <marcandre.lureau@gmail.com>" 
[full]

* tag 'qga-pull-request' of gitlab.com:marcandre.lureau/qemu:
  qga: Introduce disk smart
  qga: Introduce NVMe disk bus type
  qga/commands-posix: 'guest-shutdown' for Solaris
  qga/commands-posix: Log all net stats failures
  qga/commands-posix: Fix listing ifaces for Solaris
  qga/commands-posix: Fix iface hw address detection
  qga/commands-posix: Use getifaddrs when available

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


Compare: https://github.com/qemu/qemu/compare/2e3408b3cc7d...9cf289af47bc



reply via email to

[Prev in Thread] Current Thread [Next in Thread]