提交 8943ca11 编写于 作者: M Michal Privoznik

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: NMichal Privoznik <mprivozn@redhat.com>
ACKed-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NCole Robinson <crobinso@redhat.com>
上级 d58facd7
......@@ -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,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册