mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 07:42:56 +00:00
qemu: pass virConnectPtr into Domain{Attach,Detach}*
The qemu RBD driver needs access to the conn in order to get the secret needed for connecting to the ceph cluster. Signed-off-by: Sage Weil <sage@newdream.net>
This commit is contained in:
parent
381de90375
commit
243f185742
@ -1497,7 +1497,8 @@ qemuSafeSerialParamValue(const char *value)
|
||||
|
||||
|
||||
char *
|
||||
qemuBuildDriveStr(virDomainDiskDefPtr disk,
|
||||
qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virDomainDiskDefPtr disk,
|
||||
bool bootable,
|
||||
virBitmapPtr qemuCaps)
|
||||
{
|
||||
@ -3912,7 +3913,7 @@ qemuBuildCommandLine(virConnectPtr conn,
|
||||
deviceFlagMasked = true;
|
||||
}
|
||||
}
|
||||
optstr = qemuBuildDriveStr(disk,
|
||||
optstr = qemuBuildDriveStr(conn, disk,
|
||||
emitBootindex ? false : !!bootindex,
|
||||
qemuCaps);
|
||||
if (deviceFlagMasked)
|
||||
|
@ -75,7 +75,8 @@ char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk,
|
||||
virBitmapPtr qemuCaps);
|
||||
|
||||
/* Both legacy & current support */
|
||||
char *qemuBuildDriveStr(virDomainDiskDefPtr disk,
|
||||
char *qemuBuildDriveStr(virConnectPtr conn,
|
||||
virDomainDiskDefPtr disk,
|
||||
bool bootable,
|
||||
virBitmapPtr qemuCaps);
|
||||
char *qemuBuildFSStr(virDomainFSDefPtr fs,
|
||||
|
@ -5046,7 +5046,8 @@ qemudDomainUndefine(virDomainPtr dom)
|
||||
}
|
||||
|
||||
static int
|
||||
qemuDomainAttachDeviceDiskLive(struct qemud_driver *driver,
|
||||
qemuDomainAttachDeviceDiskLive(virConnectPtr conn,
|
||||
struct qemud_driver *driver,
|
||||
virDomainObjPtr vm,
|
||||
virDomainDeviceDefPtr dev)
|
||||
{
|
||||
@ -5078,12 +5079,12 @@ qemuDomainAttachDeviceDiskLive(struct qemud_driver *driver,
|
||||
break;
|
||||
case VIR_DOMAIN_DISK_DEVICE_DISK:
|
||||
if (disk->bus == VIR_DOMAIN_DISK_BUS_USB)
|
||||
ret = qemuDomainAttachUsbMassstorageDevice(driver, vm,
|
||||
ret = qemuDomainAttachUsbMassstorageDevice(conn, driver, vm,
|
||||
disk);
|
||||
else if (disk->bus == VIR_DOMAIN_DISK_BUS_VIRTIO)
|
||||
ret = qemuDomainAttachPciDiskDevice(driver, vm, disk);
|
||||
ret = qemuDomainAttachPciDiskDevice(conn, driver, vm, disk);
|
||||
else if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI)
|
||||
ret = qemuDomainAttachSCSIDisk(driver, vm, disk);
|
||||
ret = qemuDomainAttachSCSIDisk(conn, driver, vm, disk);
|
||||
else
|
||||
qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("disk bus '%s' cannot be hotplugged."),
|
||||
@ -5139,7 +5140,7 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm,
|
||||
switch (dev->type) {
|
||||
case VIR_DOMAIN_DEVICE_DISK:
|
||||
qemuDomainObjCheckDiskTaint(driver, vm, dev->data.disk, -1);
|
||||
ret = qemuDomainAttachDeviceDiskLive(driver, vm, dev);
|
||||
ret = qemuDomainAttachDeviceDiskLive(dom->conn, driver, vm, dev);
|
||||
if (!ret)
|
||||
dev->data.disk = NULL;
|
||||
break;
|
||||
|
@ -185,7 +185,8 @@ cleanup:
|
||||
}
|
||||
|
||||
|
||||
int qemuDomainAttachPciDiskDevice(struct qemud_driver *driver,
|
||||
int qemuDomainAttachPciDiskDevice(virConnectPtr conn,
|
||||
struct qemud_driver *driver,
|
||||
virDomainObjPtr vm,
|
||||
virDomainDiskDefPtr disk)
|
||||
{
|
||||
@ -221,7 +222,7 @@ int qemuDomainAttachPciDiskDevice(struct qemud_driver *driver,
|
||||
if (qemuAssignDeviceDiskAlias(disk, priv->qemuCaps) < 0)
|
||||
goto error;
|
||||
|
||||
if (!(drivestr = qemuBuildDriveStr(disk, false, priv->qemuCaps)))
|
||||
if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->qemuCaps)))
|
||||
goto error;
|
||||
|
||||
if (!(devstr = qemuBuildDriveDevStr(disk, 0, priv->qemuCaps)))
|
||||
@ -414,7 +415,8 @@ qemuDomainFindOrCreateSCSIDiskController(struct qemud_driver *driver,
|
||||
}
|
||||
|
||||
|
||||
int qemuDomainAttachSCSIDisk(struct qemud_driver *driver,
|
||||
int qemuDomainAttachSCSIDisk(virConnectPtr conn,
|
||||
struct qemud_driver *driver,
|
||||
virDomainObjPtr vm,
|
||||
virDomainDiskDefPtr disk)
|
||||
{
|
||||
@ -458,7 +460,7 @@ int qemuDomainAttachSCSIDisk(struct qemud_driver *driver,
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!(drivestr = qemuBuildDriveStr(disk, false, priv->qemuCaps)))
|
||||
if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->qemuCaps)))
|
||||
goto error;
|
||||
|
||||
for (i = 0 ; i <= disk->info.addr.drive.controller ; i++) {
|
||||
@ -538,7 +540,8 @@ error:
|
||||
}
|
||||
|
||||
|
||||
int qemuDomainAttachUsbMassstorageDevice(struct qemud_driver *driver,
|
||||
int qemuDomainAttachUsbMassstorageDevice(virConnectPtr conn,
|
||||
struct qemud_driver *driver,
|
||||
virDomainObjPtr vm,
|
||||
virDomainDiskDefPtr disk)
|
||||
{
|
||||
@ -575,7 +578,7 @@ int qemuDomainAttachUsbMassstorageDevice(struct qemud_driver *driver,
|
||||
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuAssignDeviceDiskAlias(disk, priv->qemuCaps) < 0)
|
||||
goto error;
|
||||
if (!(drivestr = qemuBuildDriveStr(disk, false, priv->qemuCaps)))
|
||||
if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->qemuCaps)))
|
||||
goto error;
|
||||
if (!(devstr = qemuBuildDriveDevStr(disk, 0, priv->qemuCaps)))
|
||||
goto error;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* qemu_hotplug.h: QEMU device hotplug management
|
||||
*
|
||||
* Copyright (C) 2006-2007, 2009-2010 Red Hat, Inc.
|
||||
* Copyright (C) 2006-2007, 2009-2011 Red Hat, Inc.
|
||||
* Copyright (C) 2006 Daniel P. Berrange
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
@ -33,16 +33,19 @@ int qemuDomainChangeEjectableMedia(struct qemud_driver *driver,
|
||||
bool force);
|
||||
int qemuDomainCheckEjectableMedia(struct qemud_driver *driver,
|
||||
virDomainObjPtr vm);
|
||||
int qemuDomainAttachPciDiskDevice(struct qemud_driver *driver,
|
||||
int qemuDomainAttachPciDiskDevice(virConnectPtr conn,
|
||||
struct qemud_driver *driver,
|
||||
virDomainObjPtr vm,
|
||||
virDomainDiskDefPtr disk);
|
||||
int qemuDomainAttachPciControllerDevice(struct qemud_driver *driver,
|
||||
virDomainObjPtr vm,
|
||||
virDomainControllerDefPtr controller);
|
||||
int qemuDomainAttachSCSIDisk(struct qemud_driver *driver,
|
||||
int qemuDomainAttachSCSIDisk(virConnectPtr conn,
|
||||
struct qemud_driver *driver,
|
||||
virDomainObjPtr vm,
|
||||
virDomainDiskDefPtr disk);
|
||||
int qemuDomainAttachUsbMassstorageDevice(struct qemud_driver *driver,
|
||||
int qemuDomainAttachUsbMassstorageDevice(virConnectPtr conn,
|
||||
struct qemud_driver *driver,
|
||||
virDomainObjPtr vm,
|
||||
virDomainDiskDefPtr disk);
|
||||
int qemuDomainAttachNetDevice(virConnectPtr conn,
|
||||
|
Loading…
x
Reference in New Issue
Block a user