Skip to contentSkip to conversation

qemu-ga patches

GIT PULL Applied Konstantin Kostiuk 2 participants 6 messages May 25, 2022

lore
Share & tools
lore
#0 lore raw

The following changes since commit 0cac736e73723850a99e5142e35d14d8f8efb232:

Merge tag 'pull-riscv-to-apply-20220525' of github.com:alistair23/qemu into staging (2022-05-24 15:55:12 -0700)

are available in the Git repository at:

[email protected]:kostyanf14/qemu.git tags/qga-win32-pull-2022-05-25

for you to fetch changes up to b9a002609fd887447eca8ee10777690d691f91d4:

qga-win32: Add support for NVME bus type (2022-05-25 12:12:02 +0300)

----------------------------------------------------------------
qga-win32-pull-2022-05-25

v2:
- fix Fedora cross-compilation

----------------------------------------------------------------
Konstantin Kostiuk (3):
trivial: qga: Log version on start
tests: Bump Fedora image version for cross-compilation
qga-win32: Add support for NVME bus type

luzhipeng (1):
qga: add guest-get-diskstats command for Linux guests

 qga/commands-posix.c                               | 123 +++++++++++++++++++++
 qga/commands-win32.c                               |  11 ++
 qga/main.c                                         |   2 +
 qga/qapi-schema.json                               |  86 ++++++++++++++
 tests/docker/dockerfiles/fedora-win32-cross.docker |   2 +-
 tests/docker/dockerfiles/fedora-win64-cross.docker |   2 +-
 6 files changed, 224 insertions(+), 2 deletions(-)

--
2.25.1

#1 lore raw

[PULL v2 1/4] qga: add guest-get-diskstats command for Linux guests

From: luzhipeng <[email protected]>

Add a new 'guest-get-diskstats' command for report disk io statistics for Linux guests. This can be useful for getting io flow or handling IO fault, no need to enter guests.

Message-Id: <[email protected]>

---
 qga/commands-posix.c | 123 +++++++++++++++++++++++++++++++++++++++++++
 qga/commands-win32.c |   6 +++
 qga/qapi-schema.json |  86 ++++++++++++++++++++++++++++++
 3 files changed, 215 insertions(+)
qga/commands-posix.c +123 -0
index 69f209af87..12b50b7124 100644
@@ -2783,6 +2783,122 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_info(Error **errp)
     return info;
 }
 
+#define MAX_NAME_LEN 128
+static GuestDiskStatsInfoList *guest_get_diskstats(Error **errp)
+{
+#ifdef CONFIG_LINUX
+    GuestDiskStatsInfoList *head = NULL, **tail = &head;
+    const char *diskstats = "/proc/diskstats";
+    FILE *fp;
+    size_t n;
+    char *line = NULL;
+
+    fp = fopen(diskstats, "r");
+    if (fp  == NULL) {
+        error_setg_errno(errp, errno, "open(\"%s\")", diskstats);
+        return NULL;
+    }
+
+    while (getline(&line, &n, fp) != -1) {
+        g_autofree GuestDiskStatsInfo *diskstatinfo = NULL;
+        g_autofree GuestDiskStats *diskstat = NULL;
+        char dev_name[MAX_NAME_LEN];
+        unsigned int ios_pgr, tot_ticks, rq_ticks, wr_ticks, dc_ticks, fl_ticks;
+        unsigned long rd_ios, rd_merges_or_rd_sec, rd_ticks_or_wr_sec, wr_ios;
+        unsigned long wr_merges, rd_sec_or_wr_ios, wr_sec;
+        unsigned long dc_ios, dc_merges, dc_sec, fl_ios;
+        unsigned int major, minor;
+        int i;
+
+        i = sscanf(line, "%u %u %s %lu %lu %lu"
+                   "%lu %lu %lu %lu %u %u %u %u"
+                   "%lu %lu %lu %u %lu %u",
+                   &major, &minor, dev_name,
+                   &rd_ios, &rd_merges_or_rd_sec, &rd_sec_or_wr_ios,
+                   &rd_ticks_or_wr_sec, &wr_ios, &wr_merges, &wr_sec,
+                   &wr_ticks, &ios_pgr, &tot_ticks, &rq_ticks,
+                   &dc_ios, &dc_merges, &dc_sec, &dc_ticks,
+                   &fl_ios, &fl_ticks);
+
+        if (i < 7) {
+            continue;
+        }
+
+        diskstatinfo = g_new0(GuestDiskStatsInfo, 1);
+        diskstatinfo->name = g_strdup(dev_name);
+        diskstatinfo->major = major;
+        diskstatinfo->minor = minor;
+
+        diskstat = g_new0(GuestDiskStats, 1);
+        if (i == 7) {
+            diskstat->has_read_ios = true;
+            diskstat->read_ios = rd_ios;
+            diskstat->has_read_sectors = true;
+            diskstat->read_sectors = rd_merges_or_rd_sec;
+            diskstat->has_write_ios = true;
+            diskstat->write_ios = rd_sec_or_wr_ios;
+            diskstat->has_write_sectors = true;
+            diskstat->write_sectors = rd_ticks_or_wr_sec;
+        }
+        if (i >= 14) {
+            diskstat->has_read_ios = true;
+            diskstat->read_ios = rd_ios;
+            diskstat->has_read_sectors = true;
+            diskstat->read_sectors = rd_sec_or_wr_ios;
+            diskstat->has_read_merges = true;
+            diskstat->read_merges = rd_merges_or_rd_sec;
+            diskstat->has_read_ticks = true;
+            diskstat->read_ticks = rd_ticks_or_wr_sec;
+            diskstat->has_write_ios = true;
+            diskstat->write_ios = wr_ios;
+            diskstat->has_write_sectors = true;
+            diskstat->write_sectors = wr_sec;
+            diskstat->has_write_merges = true;
+            diskstat->write_merges = wr_merges;
+            diskstat->has_write_ticks = true;
+            diskstat->write_ticks = wr_ticks;
+            diskstat->has_ios_pgr = true;
+            diskstat->ios_pgr = ios_pgr;
+            diskstat->has_total_ticks = true;
+            diskstat->total_ticks = tot_ticks;
+            diskstat->has_weight_ticks = true;
+            diskstat->weight_ticks = rq_ticks;
+        }
+        if (i >= 18) {
+            diskstat->has_discard_ios = true;
+            diskstat->discard_ios = dc_ios;
+            diskstat->has_discard_merges = true;
+            diskstat->discard_merges = dc_merges;
+            diskstat->has_discard_sectors = true;
+            diskstat->discard_sectors = dc_sec;
+            diskstat->has_discard_ticks = true;
+            diskstat->discard_ticks = dc_ticks;
+        }
+        if (i >= 20) {
+            diskstat->has_flush_ios = true;
+            diskstat->flush_ios = fl_ios;
+            diskstat->has_flush_ticks = true;
+            diskstat->flush_ticks = fl_ticks;
+        }
+
+        diskstatinfo->stats = g_steal_pointer(&diskstat);
+        QAPI_LIST_APPEND(tail, diskstatinfo);
+        diskstatinfo = NULL;
+    }
+    free(line);
+    fclose(fp);
+    return head;
+#else
+    g_debug("disk stats reporting available only for Linux");
+    return NULL;
+#endif
+}
+
+GuestDiskStatsInfoList *qmp_guest_get_diskstats(Error **errp)
+{
+    return guest_get_diskstats(errp);
+}
+
 #else /* defined(__linux__) */
 
 void qmp_guest_suspend_disk(Error **errp)
@@ -3131,6 +3247,13 @@ GuestDiskInfoList *qmp_guest_get_disks(Error **errp)
     return NULL;
 }
 
+GuestDiskStatsInfoList *qmp_guest_get_diskstats(Error **errp)
+{
+    error_setg(errp, QERR_UNSUPPORTED);
+    return NULL;
+}
+
+
 #endif /* CONFIG_FSFREEZE */
 
 #if !defined(CONFIG_FSTRIM)
qga/commands-win32.c +6 -0
index d56b5fd2a7..dcdeb76a68 100644
@@ -2532,3 +2532,9 @@ char *qga_get_host_name(Error **errp)
 
     return g_utf16_to_utf8(tmp, size, NULL, NULL, NULL);
 }
+
+GuestDiskStatsInfoList *qmp_guest_get_diskstats(Error **errp)
+{
+    error_setg(errp, QERR_UNSUPPORTED);
+    return NULL;
+}
qga/qapi-schema.json +86 -0

89 lines not on this page · raw message

Signature · 1 line
2.25.1
#2 lore raw

[PULL v2 3/4] tests: Bump Fedora image version for cross-compilation

In reply to Konstantin Kostiuk

There are 2 reason for the bump:
- Fedora 33 is not supported anymore
- Some changes in the guest agent required updates of mingw-headers

Message-Id: <[email protected]>

---
 tests/docker/dockerfiles/fedora-win32-cross.docker | 2 +-
 tests/docker/dockerfiles/fedora-win64-cross.docker | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tests/docker/dockerfiles/fedora-win32-cross.docker +1 -1
index 84a8f5524d..a06bd29e8e 100644
@@ -1,4 +1,4 @@
-FROM registry.fedoraproject.org/fedora:33
+FROM registry.fedoraproject.org/fedora:35
 
 # Please keep this list sorted alphabetically
 ENV PACKAGES \
tests/docker/dockerfiles/fedora-win64-cross.docker +1 -1
index d7ed8eb1cf..b71624330f 100644
@@ -1,4 +1,4 @@
-FROM registry.fedoraproject.org/fedora:33
+FROM registry.fedoraproject.org/fedora:35
 
 # Please keep this list sorted alphabetically
 ENV PACKAGES \
Signature · 1 line
2.25.1
#3 lore raw

[PULL v2 4/4] qga-win32: Add support for NVME bus type

In reply to Konstantin Kostiuk

Bus type spaces (Indicates a storage spaces bus) is not supported, so return it as unknown.

Message-Id: <[email protected]>

---
 qga/commands-win32.c | 5 +++++
 1 file changed, 5 insertions(+)
qga/commands-win32.c +5 -0
index dcdeb76a68..36f94c0f9c 100644
@@ -490,6 +490,11 @@ static GuestDiskBusType win2qemu[] = {
 #if (_WIN32_WINNT >= 0x0601)
     [BusTypeVirtual] = GUEST_DISK_BUS_TYPE_VIRTUAL,
     [BusTypeFileBackedVirtual] = GUEST_DISK_BUS_TYPE_FILE_BACKED_VIRTUAL,
+    /*
+     * BusTypeSpaces currently is not suported
+     */
+    [BusTypeSpaces] = GUEST_DISK_BUS_TYPE_UNKNOWN,
+    [BusTypeNvme] = GUEST_DISK_BUS_TYPE_NVME,
 #endif
 };
 
Signature · 1 line
2.25.1
#4 lore raw

[PULL v2 2/4] trivial: qga: Log version on start

In reply to Konstantin Kostiuk

Message-Id: <[email protected]>

---
 qga/main.c | 2 ++
 1 file changed, 2 insertions(+)
qga/main.c +2 -0
index 3b9546c185..c373fec3ee 100644
@@ -1271,6 +1271,8 @@ static GAState *initialize_agent(GAConfig *config, int socket_activation)
     g_log_set_fatal_mask(NULL, G_LOG_LEVEL_ERROR);
     ga_enable_logging(s);
 
+    g_debug("Guest agent version %s started", QEMU_FULL_VERSION);
+
 #ifdef _WIN32
     /* On win32 the state directory is application specific (be it the default
      * or a user override). We got past the command line parsing; let's create
Signature · 1 line
2.25.1
#5 lore raw
In reply to Konstantin Kostiuk
Quoted 10 lines · Konstantin Kostiuk

The following changes since commit 0cac736e73723850a99e5142e35d14d8f8efb232:

   Merge tag 'pull-riscv-to-apply-20220525' of github.com:alistair23/qemu into staging (2022-05-24 15:55:12 -0700)

are available in the Git repository at:

   [email protected]:kostyanf14/qemu.git tags/qga-win32-pull-2022-05-25

for you to fetch changes up to b9a002609fd887447eca8ee10777690d691f91d4:

Quoted 7 lines

qga-win32: Add support for NVME bus type (2022-05-25 12:12:02 +0300)

----------------------------------------------------------------
qga-win32-pull-2022-05-25

v2:
- fix Fedora cross-compilation

Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/7.1 as appropriate.

r~

Quoted 22 lines

----------------------------------------------------------------
Konstantin Kostiuk (3):
trivial: qga: Log version on start
tests: Bump Fedora image version for cross-compilation
qga-win32: Add support for NVME bus type

luzhipeng (1):
qga: add guest-get-diskstats command for Linux guests

  qga/commands-posix.c                               | 123 +++++++++++++++++++++
  qga/commands-win32.c                               |  11 ++
  qga/main.c                                         |   2 +
  qga/qapi-schema.json                               |  86 ++++++++++++++
  tests/docker/dockerfiles/fedora-win32-cross.docker |   2 +-
  tests/docker/dockerfiles/fedora-win64-cross.docker |   2 +-
  6 files changed, 224 insertions(+), 2 deletions(-)

--
2.25.1