[libvirt] [PATCH 1/7] qemu: Introduce qemuIsSharedHostdev
John Ferlan
jferlan at redhat.com
Wed Jun 24 14:41:31 UTC 2015
On 06/16/2015 03:51 PM, John Ferlan wrote:
> Add a single boolean function to handle whether the hostdev is shared or not
>
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
> src/qemu/qemu_conf.c | 23 +++++++++++++++--------
> 1 file changed, 15 insertions(+), 8 deletions(-)
>
Given Jan's comments about the overall series, I'd like to propose
squashing in the attached patch into this patch. Essentially it's
making the same check and returning 0 if the shared bit wasn't set. The
current code checks for shared hostdev *and* sgio is set, then fail;
otherwise, return 0. This patch will check shared hostdev, return 0 if
not.. then check sgio singularly and fail; otherwise return 0.
John
> diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
> index 16ae6ab..8e9da0d 100644
> --- a/src/qemu/qemu_conf.c
> +++ b/src/qemu/qemu_conf.c
> @@ -1196,6 +1196,19 @@ qemuAddSharedDisk(virQEMUDriverPtr driver,
> }
>
>
> +static bool
> +qemuIsSharedHostdev(virDomainHostdevDefPtr hostdev)
> +{
> + if (hostdev->shareable &&
> + (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
> + hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI &&
> + hostdev->source.subsys.u.scsi.protocol !=
> + VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI))
> + return true;
> + return false;
> +}
> +
> +
> static char *
> qemuGetSharedHostdevKey(virDomainHostdevDefPtr hostdev)
> {
> @@ -1233,10 +1246,7 @@ qemuAddSharedHostdev(virQEMUDriverPtr driver,
> char *key = NULL;
> int ret = -1;
>
> - if (!hostdev->shareable ||
> - !(hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
> - hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI &&
> - hostdev->source.subsys.u.scsi.protocol != VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI))
> + if (!qemuIsSharedHostdev(hostdev))
> return 0;
>
> if (!(key = qemuGetSharedHostdevKey(hostdev)))
> @@ -1337,10 +1347,7 @@ qemuRemoveSharedHostdev(virQEMUDriverPtr driver,
> char *key = NULL;
> int ret;
>
> - if (!hostdev->shareable ||
> - !(hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
> - hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI &&
> - hostdev->source.subsys.u.scsi.protocol != VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI))
> + if (!qemuIsSharedHostdev(hostdev))
> return 0;
>
> if (!(key = qemuGetSharedHostdevKey(hostdev)))
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Merge-into-patch-1.patch
Type: text/x-patch
Size: 1157 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150624/062c722b/attachment-0001.bin>
More information about the libvir-list
mailing list