|
|
fbe740 |
From 668555bc90e36fd571ff3ac5aa798e951a84ee19 Mon Sep 17 00:00:00 2001
|
|
|
fbe740 |
Message-Id: <668555bc90e36fd571ff3ac5aa798e951a84ee19@dist-git>
|
|
|
fbe740 |
From: Jonathon Jongsma <jjongsma@redhat.com>
|
|
|
fbe740 |
Date: Thu, 20 Feb 2020 10:52:24 -0600
|
|
|
fbe740 |
Subject: [PATCH] qemu: store complete agent filesystem information
|
|
|
fbe740 |
MIME-Version: 1.0
|
|
|
fbe740 |
Content-Type: text/plain; charset=UTF-8
|
|
|
fbe740 |
Content-Transfer-Encoding: 8bit
|
|
|
fbe740 |
|
|
|
fbe740 |
In an effort to avoid holding both an agent and normal job at the same
|
|
|
fbe740 |
time, we shouldn't access the vm definition from within qemu_agent.c
|
|
|
fbe740 |
(i.e. while the agent job is being held). In preparation, we need to
|
|
|
fbe740 |
store the full filesystem disk information in qemuAgentDiskInfo. In a
|
|
|
fbe740 |
following commit, we can pass this information back to the caller and
|
|
|
fbe740 |
the caller can search the vm definition to match the filsystem disk to
|
|
|
fbe740 |
an alias.
|
|
|
fbe740 |
|
|
|
fbe740 |
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
fbe740 |
(cherry picked from commit bdb8a800b4920cf9184fd2fd117b17c67ba74dfb)
|
|
|
fbe740 |
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
|
|
|
fbe740 |
https://bugzilla.redhat.com/show_bug.cgi?id=1759566
|
|
|
fbe740 |
Message-Id: <20200220165227.11491-3-jjongsma@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
fbe740 |
---
|
|
|
fbe740 |
src/qemu/qemu_agent.c | 36 ++++++++++++++++++++----------------
|
|
|
fbe740 |
1 file changed, 20 insertions(+), 16 deletions(-)
|
|
|
fbe740 |
|
|
|
fbe740 |
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
|
|
|
fbe740 |
index 0f099f3b2a..077b5538de 100644
|
|
|
fbe740 |
--- a/src/qemu/qemu_agent.c
|
|
|
fbe740 |
+++ b/src/qemu/qemu_agent.c
|
|
|
fbe740 |
@@ -1849,6 +1849,11 @@ typedef qemuAgentDiskInfo *qemuAgentDiskInfoPtr;
|
|
|
fbe740 |
struct _qemuAgentDiskInfo {
|
|
|
fbe740 |
char *alias;
|
|
|
fbe740 |
char *serial;
|
|
|
fbe740 |
+ virPCIDeviceAddress pci_controller;
|
|
|
fbe740 |
+ char *bus_type;
|
|
|
fbe740 |
+ unsigned int bus;
|
|
|
fbe740 |
+ unsigned int target;
|
|
|
fbe740 |
+ unsigned int unit;
|
|
|
fbe740 |
char *devnode;
|
|
|
fbe740 |
};
|
|
|
fbe740 |
|
|
|
fbe740 |
@@ -1872,6 +1877,7 @@ qemuAgentDiskInfoFree(qemuAgentDiskInfoPtr info)
|
|
|
fbe740 |
|
|
|
fbe740 |
VIR_FREE(info->serial);
|
|
|
fbe740 |
VIR_FREE(info->alias);
|
|
|
fbe740 |
+ VIR_FREE(info->bus_type);
|
|
|
fbe740 |
VIR_FREE(info->devnode);
|
|
|
fbe740 |
VIR_FREE(info);
|
|
|
fbe740 |
}
|
|
|
fbe740 |
@@ -1952,10 +1958,6 @@ qemuAgentGetFSInfoFillDisks(virJSONValuePtr jsondisks,
|
|
|
fbe740 |
qemuAgentDiskInfoPtr disk;
|
|
|
fbe740 |
virDomainDiskDefPtr diskDef;
|
|
|
fbe740 |
const char *val;
|
|
|
fbe740 |
- unsigned int bus;
|
|
|
fbe740 |
- unsigned int target;
|
|
|
fbe740 |
- unsigned int unit;
|
|
|
fbe740 |
- virPCIDeviceAddress pci_address;
|
|
|
fbe740 |
|
|
|
fbe740 |
if (!jsondisk) {
|
|
|
fbe740 |
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
fbe740 |
@@ -1969,6 +1971,9 @@ qemuAgentGetFSInfoFillDisks(virJSONValuePtr jsondisks,
|
|
|
fbe740 |
return -1;
|
|
|
fbe740 |
disk = fsinfo->disks[i];
|
|
|
fbe740 |
|
|
|
fbe740 |
+ if ((val = virJSONValueObjectGetString(jsondisk, "bus-type")))
|
|
|
fbe740 |
+ disk->bus_type = g_strdup(val);
|
|
|
fbe740 |
+
|
|
|
fbe740 |
if ((val = virJSONValueObjectGetString(jsondisk, "serial")))
|
|
|
fbe740 |
disk->serial = g_strdup(val);
|
|
|
fbe740 |
|
|
|
fbe740 |
@@ -1985,9 +1990,9 @@ qemuAgentGetFSInfoFillDisks(virJSONValuePtr jsondisks,
|
|
|
fbe740 |
} \
|
|
|
fbe740 |
} while (0)
|
|
|
fbe740 |
|
|
|
fbe740 |
- GET_DISK_ADDR(jsondisk, &bus, "bus");
|
|
|
fbe740 |
- GET_DISK_ADDR(jsondisk, &target, "target");
|
|
|
fbe740 |
- GET_DISK_ADDR(jsondisk, &unit, "unit");
|
|
|
fbe740 |
+ GET_DISK_ADDR(jsondisk, &disk->bus, "bus");
|
|
|
fbe740 |
+ GET_DISK_ADDR(jsondisk, &disk->target, "target");
|
|
|
fbe740 |
+ GET_DISK_ADDR(jsondisk, &disk->unit, "unit");
|
|
|
fbe740 |
|
|
|
fbe740 |
if (!(pci = virJSONValueObjectGet(jsondisk, "pci-controller"))) {
|
|
|
fbe740 |
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
|
|
fbe740 |
@@ -1996,18 +2001,17 @@ qemuAgentGetFSInfoFillDisks(virJSONValuePtr jsondisks,
|
|
|
fbe740 |
return -1;
|
|
|
fbe740 |
}
|
|
|
fbe740 |
|
|
|
fbe740 |
- GET_DISK_ADDR(pci, &pci_address.domain, "domain");
|
|
|
fbe740 |
- GET_DISK_ADDR(pci, &pci_address.bus, "bus");
|
|
|
fbe740 |
- GET_DISK_ADDR(pci, &pci_address.slot, "slot");
|
|
|
fbe740 |
- GET_DISK_ADDR(pci, &pci_address.function, "function");
|
|
|
fbe740 |
+ GET_DISK_ADDR(pci, &disk->pci_controller.domain, "domain");
|
|
|
fbe740 |
+ GET_DISK_ADDR(pci, &disk->pci_controller.bus, "bus");
|
|
|
fbe740 |
+ GET_DISK_ADDR(pci, &disk->pci_controller.slot, "slot");
|
|
|
fbe740 |
+ GET_DISK_ADDR(pci, &disk->pci_controller.function, "function");
|
|
|
fbe740 |
|
|
|
fbe740 |
#undef GET_DISK_ADDR
|
|
|
fbe740 |
-
|
|
|
fbe740 |
if (!(diskDef = virDomainDiskByAddress(vmdef,
|
|
|
fbe740 |
- &pci_address,
|
|
|
fbe740 |
- bus,
|
|
|
fbe740 |
- target,
|
|
|
fbe740 |
- unit)))
|
|
|
fbe740 |
+ &disk->pci_controller,
|
|
|
fbe740 |
+ disk->bus,
|
|
|
fbe740 |
+ disk->target,
|
|
|
fbe740 |
+ disk->unit)))
|
|
|
fbe740 |
continue;
|
|
|
fbe740 |
|
|
|
fbe740 |
disk->alias = g_strdup(diskDef->dst);
|
|
|
fbe740 |
--
|
|
|
fbe740 |
2.25.0
|
|
|
fbe740 |
|