mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-07-31 05:57:16 +00:00
qemu: store complete agent filesystem information
In an effort to avoid holding both an agent and normal job at the same time, we shouldn't access the vm definition from within qemu_agent.c (i.e. while the agent job is being held). In preparation, we need to store the full filesystem disk information in qemuAgentDiskInfo. In a following commit, we can pass this information back to the caller and the caller can search the vm definition to match the filsystem disk to an alias. Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
e888c0f667
commit
bdb8a800b4
@ -1853,6 +1853,11 @@ typedef qemuAgentDiskInfo *qemuAgentDiskInfoPtr;
|
|||||||
struct _qemuAgentDiskInfo {
|
struct _qemuAgentDiskInfo {
|
||||||
char *alias;
|
char *alias;
|
||||||
char *serial;
|
char *serial;
|
||||||
|
virPCIDeviceAddress pci_controller;
|
||||||
|
char *bus_type;
|
||||||
|
unsigned int bus;
|
||||||
|
unsigned int target;
|
||||||
|
unsigned int unit;
|
||||||
char *devnode;
|
char *devnode;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1876,6 +1881,7 @@ qemuAgentDiskInfoFree(qemuAgentDiskInfoPtr info)
|
|||||||
|
|
||||||
VIR_FREE(info->serial);
|
VIR_FREE(info->serial);
|
||||||
VIR_FREE(info->alias);
|
VIR_FREE(info->alias);
|
||||||
|
VIR_FREE(info->bus_type);
|
||||||
VIR_FREE(info->devnode);
|
VIR_FREE(info->devnode);
|
||||||
VIR_FREE(info);
|
VIR_FREE(info);
|
||||||
}
|
}
|
||||||
@ -1956,10 +1962,6 @@ qemuAgentGetFSInfoFillDisks(virJSONValuePtr jsondisks,
|
|||||||
qemuAgentDiskInfoPtr disk;
|
qemuAgentDiskInfoPtr disk;
|
||||||
virDomainDiskDefPtr diskDef;
|
virDomainDiskDefPtr diskDef;
|
||||||
const char *val;
|
const char *val;
|
||||||
unsigned int bus;
|
|
||||||
unsigned int target;
|
|
||||||
unsigned int unit;
|
|
||||||
virPCIDeviceAddress pci_address;
|
|
||||||
|
|
||||||
if (!jsondisk) {
|
if (!jsondisk) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -1973,6 +1975,9 @@ qemuAgentGetFSInfoFillDisks(virJSONValuePtr jsondisks,
|
|||||||
return -1;
|
return -1;
|
||||||
disk = fsinfo->disks[i];
|
disk = fsinfo->disks[i];
|
||||||
|
|
||||||
|
if ((val = virJSONValueObjectGetString(jsondisk, "bus-type")))
|
||||||
|
disk->bus_type = g_strdup(val);
|
||||||
|
|
||||||
if ((val = virJSONValueObjectGetString(jsondisk, "serial")))
|
if ((val = virJSONValueObjectGetString(jsondisk, "serial")))
|
||||||
disk->serial = g_strdup(val);
|
disk->serial = g_strdup(val);
|
||||||
|
|
||||||
@ -1989,9 +1994,9 @@ qemuAgentGetFSInfoFillDisks(virJSONValuePtr jsondisks,
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
GET_DISK_ADDR(jsondisk, &bus, "bus");
|
GET_DISK_ADDR(jsondisk, &disk->bus, "bus");
|
||||||
GET_DISK_ADDR(jsondisk, &target, "target");
|
GET_DISK_ADDR(jsondisk, &disk->target, "target");
|
||||||
GET_DISK_ADDR(jsondisk, &unit, "unit");
|
GET_DISK_ADDR(jsondisk, &disk->unit, "unit");
|
||||||
|
|
||||||
if (!(pci = virJSONValueObjectGet(jsondisk, "pci-controller"))) {
|
if (!(pci = virJSONValueObjectGet(jsondisk, "pci-controller"))) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
@ -2000,18 +2005,17 @@ qemuAgentGetFSInfoFillDisks(virJSONValuePtr jsondisks,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
GET_DISK_ADDR(pci, &pci_address.domain, "domain");
|
GET_DISK_ADDR(pci, &disk->pci_controller.domain, "domain");
|
||||||
GET_DISK_ADDR(pci, &pci_address.bus, "bus");
|
GET_DISK_ADDR(pci, &disk->pci_controller.bus, "bus");
|
||||||
GET_DISK_ADDR(pci, &pci_address.slot, "slot");
|
GET_DISK_ADDR(pci, &disk->pci_controller.slot, "slot");
|
||||||
GET_DISK_ADDR(pci, &pci_address.function, "function");
|
GET_DISK_ADDR(pci, &disk->pci_controller.function, "function");
|
||||||
|
|
||||||
#undef GET_DISK_ADDR
|
#undef GET_DISK_ADDR
|
||||||
|
|
||||||
if (!(diskDef = virDomainDiskByAddress(vmdef,
|
if (!(diskDef = virDomainDiskByAddress(vmdef,
|
||||||
&pci_address,
|
&disk->pci_controller,
|
||||||
bus,
|
disk->bus,
|
||||||
target,
|
disk->target,
|
||||||
unit)))
|
disk->unit)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
disk->alias = g_strdup(diskDef->dst);
|
disk->alias = g_strdup(diskDef->dst);
|
||||||
|
Loading…
Reference in New Issue
Block a user