mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 15:52:55 +00:00
qemu: prepare NVMe devices too
The qemu driver has its own wrappers around virHostdev module (so that some arguments are filled in automatically). Extend these to include NVMe devices too. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> ACKed-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
d58facd781
commit
8943ca11b2
@ -96,13 +96,28 @@ qemuHostdevUpdateActiveMediatedDevices(virQEMUDriverPtr driver,
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuHostdevUpdateActiveNVMeDisks(virQEMUDriverPtr driver,
|
||||
virDomainDefPtr def)
|
||||
{
|
||||
return virHostdevUpdateActiveNVMeDevices(driver->hostdevMgr,
|
||||
QEMU_DRIVER_NAME,
|
||||
def->name,
|
||||
def->disks,
|
||||
def->ndisks);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuHostdevUpdateActiveDomainDevices(virQEMUDriverPtr driver,
|
||||
virDomainDefPtr def)
|
||||
{
|
||||
if (!def->nhostdevs)
|
||||
if (!def->nhostdevs && !def->ndisks)
|
||||
return 0;
|
||||
|
||||
if (qemuHostdevUpdateActiveNVMeDisks(driver, def) < 0)
|
||||
return -1;
|
||||
|
||||
if (qemuHostdevUpdateActivePCIDevices(driver, def) < 0)
|
||||
return -1;
|
||||
|
||||
@ -197,6 +212,17 @@ qemuHostdevPreparePCIDevicesCheckSupport(virDomainHostdevDefPtr *hostdevs,
|
||||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
qemuHostdevPrepareNVMeDisks(virQEMUDriverPtr driver,
|
||||
const char *name,
|
||||
virDomainDiskDefPtr *disks,
|
||||
size_t ndisks)
|
||||
{
|
||||
return virHostdevPrepareNVMeDevices(driver->hostdevMgr,
|
||||
QEMU_DRIVER_NAME,
|
||||
name, disks, ndisks);
|
||||
}
|
||||
|
||||
int
|
||||
qemuHostdevPreparePCIDevices(virQEMUDriverPtr driver,
|
||||
const char *name,
|
||||
@ -313,9 +339,12 @@ qemuHostdevPrepareDomainDevices(virQEMUDriverPtr driver,
|
||||
virQEMUCapsPtr qemuCaps,
|
||||
unsigned int flags)
|
||||
{
|
||||
if (!def->nhostdevs)
|
||||
if (!def->nhostdevs && !def->ndisks)
|
||||
return 0;
|
||||
|
||||
if (qemuHostdevPrepareNVMeDisks(driver, def->name, def->disks, def->ndisks) < 0)
|
||||
return -1;
|
||||
|
||||
if (qemuHostdevPreparePCIDevices(driver, def->name, def->uuid,
|
||||
def->hostdevs, def->nhostdevs,
|
||||
qemuCaps, flags) < 0)
|
||||
@ -340,6 +369,17 @@ qemuHostdevPrepareDomainDevices(virQEMUDriverPtr driver,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
qemuHostdevReAttachNVMeDisks(virQEMUDriverPtr driver,
|
||||
const char *name,
|
||||
virDomainDiskDefPtr *disks,
|
||||
size_t ndisks)
|
||||
{
|
||||
virHostdevReAttachNVMeDevices(driver->hostdevMgr,
|
||||
QEMU_DRIVER_NAME,
|
||||
name, disks, ndisks);
|
||||
}
|
||||
|
||||
void
|
||||
qemuHostdevReAttachPCIDevices(virQEMUDriverPtr driver,
|
||||
const char *name,
|
||||
@ -419,9 +459,12 @@ void
|
||||
qemuHostdevReAttachDomainDevices(virQEMUDriverPtr driver,
|
||||
virDomainDefPtr def)
|
||||
{
|
||||
if (!def->nhostdevs)
|
||||
if (!def->nhostdevs && !def->ndisks)
|
||||
return;
|
||||
|
||||
qemuHostdevReAttachNVMeDisks(driver, def->name, def->disks,
|
||||
def->ndisks);
|
||||
|
||||
qemuHostdevReAttachPCIDevices(driver, def->name, def->hostdevs,
|
||||
def->nhostdevs);
|
||||
|
||||
|
@ -28,6 +28,8 @@ bool qemuHostdevNeedsVFIO(const virDomainHostdevDef *hostdev);
|
||||
|
||||
bool qemuHostdevHostSupportsPassthroughVFIO(void);
|
||||
|
||||
int qemuHostdevUpdateActiveNVMeDisks(virQEMUDriverPtr driver,
|
||||
virDomainDefPtr def);
|
||||
int qemuHostdevUpdateActiveMediatedDevices(virQEMUDriverPtr driver,
|
||||
virDomainDefPtr def);
|
||||
int qemuHostdevUpdateActivePCIDevices(virQEMUDriverPtr driver,
|
||||
@ -39,6 +41,10 @@ int qemuHostdevUpdateActiveSCSIDevices(virQEMUDriverPtr driver,
|
||||
int qemuHostdevUpdateActiveDomainDevices(virQEMUDriverPtr driver,
|
||||
virDomainDefPtr def);
|
||||
|
||||
int qemuHostdevPrepareNVMeDisks(virQEMUDriverPtr driver,
|
||||
const char *name,
|
||||
virDomainDiskDefPtr *disks,
|
||||
size_t ndisks);
|
||||
int qemuHostdevPreparePCIDevices(virQEMUDriverPtr driver,
|
||||
const char *name,
|
||||
const unsigned char *uuid,
|
||||
@ -68,6 +74,10 @@ int qemuHostdevPrepareDomainDevices(virQEMUDriverPtr driver,
|
||||
virQEMUCapsPtr qemuCaps,
|
||||
unsigned int flags);
|
||||
|
||||
void qemuHostdevReAttachNVMeDisks(virQEMUDriverPtr driver,
|
||||
const char *name,
|
||||
virDomainDiskDefPtr *disks,
|
||||
size_t ndisks);
|
||||
void qemuHostdevReAttachPCIDevices(virQEMUDriverPtr driver,
|
||||
const char *name,
|
||||
virDomainHostdevDefPtr *hostdevs,
|
||||
|
Loading…
x
Reference in New Issue
Block a user