mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-26 14:35:18 +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
|
int
|
||||||
qemuHostdevUpdateActiveDomainDevices(virQEMUDriverPtr driver,
|
qemuHostdevUpdateActiveDomainDevices(virQEMUDriverPtr driver,
|
||||||
virDomainDefPtr def)
|
virDomainDefPtr def)
|
||||||
{
|
{
|
||||||
if (!def->nhostdevs)
|
if (!def->nhostdevs && !def->ndisks)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (qemuHostdevUpdateActiveNVMeDisks(driver, def) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (qemuHostdevUpdateActivePCIDevices(driver, def) < 0)
|
if (qemuHostdevUpdateActivePCIDevices(driver, def) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -197,6 +212,17 @@ qemuHostdevPreparePCIDevicesCheckSupport(virDomainHostdevDefPtr *hostdevs,
|
|||||||
return true;
|
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
|
int
|
||||||
qemuHostdevPreparePCIDevices(virQEMUDriverPtr driver,
|
qemuHostdevPreparePCIDevices(virQEMUDriverPtr driver,
|
||||||
const char *name,
|
const char *name,
|
||||||
@ -313,9 +339,12 @@ qemuHostdevPrepareDomainDevices(virQEMUDriverPtr driver,
|
|||||||
virQEMUCapsPtr qemuCaps,
|
virQEMUCapsPtr qemuCaps,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
if (!def->nhostdevs)
|
if (!def->nhostdevs && !def->ndisks)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (qemuHostdevPrepareNVMeDisks(driver, def->name, def->disks, def->ndisks) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (qemuHostdevPreparePCIDevices(driver, def->name, def->uuid,
|
if (qemuHostdevPreparePCIDevices(driver, def->name, def->uuid,
|
||||||
def->hostdevs, def->nhostdevs,
|
def->hostdevs, def->nhostdevs,
|
||||||
qemuCaps, flags) < 0)
|
qemuCaps, flags) < 0)
|
||||||
@ -340,6 +369,17 @@ qemuHostdevPrepareDomainDevices(virQEMUDriverPtr driver,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
qemuHostdevReAttachNVMeDisks(virQEMUDriverPtr driver,
|
||||||
|
const char *name,
|
||||||
|
virDomainDiskDefPtr *disks,
|
||||||
|
size_t ndisks)
|
||||||
|
{
|
||||||
|
virHostdevReAttachNVMeDevices(driver->hostdevMgr,
|
||||||
|
QEMU_DRIVER_NAME,
|
||||||
|
name, disks, ndisks);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
qemuHostdevReAttachPCIDevices(virQEMUDriverPtr driver,
|
qemuHostdevReAttachPCIDevices(virQEMUDriverPtr driver,
|
||||||
const char *name,
|
const char *name,
|
||||||
@ -419,9 +459,12 @@ void
|
|||||||
qemuHostdevReAttachDomainDevices(virQEMUDriverPtr driver,
|
qemuHostdevReAttachDomainDevices(virQEMUDriverPtr driver,
|
||||||
virDomainDefPtr def)
|
virDomainDefPtr def)
|
||||||
{
|
{
|
||||||
if (!def->nhostdevs)
|
if (!def->nhostdevs && !def->ndisks)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
qemuHostdevReAttachNVMeDisks(driver, def->name, def->disks,
|
||||||
|
def->ndisks);
|
||||||
|
|
||||||
qemuHostdevReAttachPCIDevices(driver, def->name, def->hostdevs,
|
qemuHostdevReAttachPCIDevices(driver, def->name, def->hostdevs,
|
||||||
def->nhostdevs);
|
def->nhostdevs);
|
||||||
|
|
||||||
|
@ -28,6 +28,8 @@ bool qemuHostdevNeedsVFIO(const virDomainHostdevDef *hostdev);
|
|||||||
|
|
||||||
bool qemuHostdevHostSupportsPassthroughVFIO(void);
|
bool qemuHostdevHostSupportsPassthroughVFIO(void);
|
||||||
|
|
||||||
|
int qemuHostdevUpdateActiveNVMeDisks(virQEMUDriverPtr driver,
|
||||||
|
virDomainDefPtr def);
|
||||||
int qemuHostdevUpdateActiveMediatedDevices(virQEMUDriverPtr driver,
|
int qemuHostdevUpdateActiveMediatedDevices(virQEMUDriverPtr driver,
|
||||||
virDomainDefPtr def);
|
virDomainDefPtr def);
|
||||||
int qemuHostdevUpdateActivePCIDevices(virQEMUDriverPtr driver,
|
int qemuHostdevUpdateActivePCIDevices(virQEMUDriverPtr driver,
|
||||||
@ -39,6 +41,10 @@ int qemuHostdevUpdateActiveSCSIDevices(virQEMUDriverPtr driver,
|
|||||||
int qemuHostdevUpdateActiveDomainDevices(virQEMUDriverPtr driver,
|
int qemuHostdevUpdateActiveDomainDevices(virQEMUDriverPtr driver,
|
||||||
virDomainDefPtr def);
|
virDomainDefPtr def);
|
||||||
|
|
||||||
|
int qemuHostdevPrepareNVMeDisks(virQEMUDriverPtr driver,
|
||||||
|
const char *name,
|
||||||
|
virDomainDiskDefPtr *disks,
|
||||||
|
size_t ndisks);
|
||||||
int qemuHostdevPreparePCIDevices(virQEMUDriverPtr driver,
|
int qemuHostdevPreparePCIDevices(virQEMUDriverPtr driver,
|
||||||
const char *name,
|
const char *name,
|
||||||
const unsigned char *uuid,
|
const unsigned char *uuid,
|
||||||
@ -68,6 +74,10 @@ int qemuHostdevPrepareDomainDevices(virQEMUDriverPtr driver,
|
|||||||
virQEMUCapsPtr qemuCaps,
|
virQEMUCapsPtr qemuCaps,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
|
||||||
|
void qemuHostdevReAttachNVMeDisks(virQEMUDriverPtr driver,
|
||||||
|
const char *name,
|
||||||
|
virDomainDiskDefPtr *disks,
|
||||||
|
size_t ndisks);
|
||||||
void qemuHostdevReAttachPCIDevices(virQEMUDriverPtr driver,
|
void qemuHostdevReAttachPCIDevices(virQEMUDriverPtr driver,
|
||||||
const char *name,
|
const char *name,
|
||||||
virDomainHostdevDefPtr *hostdevs,
|
virDomainHostdevDefPtr *hostdevs,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user