[libvirt] [PATCH v2 2/4] conf: Parse virtio-crypto in the domain XML

Martin Kletzander mkletzan at redhat.com
Tue Feb 7 12:15:18 UTC 2017


On Wed, Jan 11, 2017 at 04:28:24PM +0800, Longpeng(Mike) wrote:
>This patch parse the domain XML with virtio-crypto
>support, the virtio-crypto XML looks like this:
>
>  <crypto model='virtio'>
>    <backend type='builtin' queues='1'/>
>  </crypto>
>
>Signed-off-by: Longpeng(Mike) <longpeng2 at huawei.com>
>---
> src/conf/domain_conf.c         | 213 ++++++++++++++++++++++++++++++++++++++++-
> src/conf/domain_conf.h         |  32 +++++++
> src/libvirt_private.syms       |   2 +
> src/qemu/qemu_domain.c         |   2 +
> src/qemu/qemu_domain_address.c |   1 +
> src/qemu/qemu_driver.c         |   6 ++
> src/qemu/qemu_hotplug.c        |   1 +
> 7 files changed, 256 insertions(+), 1 deletion(-)
>
>diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
>index 52aee2b..ef44930 100644
>--- a/src/conf/domain_conf.c
>+++ b/src/conf/domain_conf.c
>@@ -18967,6 +19096,25 @@ virDomainRNGDefCheckABIStability(virDomainRNGDefPtr src,
>
>
> static bool
>+virDomainCryptoDefCheckABIStability(virDomainCryptoDefPtr src,
>+                                    virDomainCryptoDefPtr dst)
>+{
>+    if (src->model != dst->model) {
>+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
>+                       _("Target Crypto model '%s' does not match source '%s'"),
>+                       virDomainCryptoModelTypeToString(dst->model),
>+                       virDomainCryptoModelTypeToString(src->model));
>+        return false;
>+    }
>+

The number of queues is not part of ABI?  That'd make sense, I'm just
making sure.

>diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
>index 4d16620..cceb576 100644
>--- a/src/libvirt_private.syms
>+++ b/src/libvirt_private.syms
>@@ -228,6 +228,8 @@ virDomainControllerRemove;
> virDomainControllerTypeToString;
> virDomainCpuPlacementModeTypeFromString;
> virDomainCpuPlacementModeTypeToString;
>+virDomainCryptoBackendTypeFromString;
>+virDomainCryptoModelTypeFromString;

You're missing the other variants (ToString).  That will be apparent
when you will implement FormatXML of the device as well.  One xml2xml
test case and it would be caught.

>diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
>index d2f7953..e17476a 100644
>--- a/src/qemu/qemu_domain_address.c
>+++ b/src/qemu/qemu_domain_address.c
>@@ -784,6 +784,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
>     case VIR_DOMAIN_DEVICE_LEASE:
>     case VIR_DOMAIN_DEVICE_GRAPHICS:
>     case VIR_DOMAIN_DEVICE_IOMMU:
>+    case VIR_DOMAIN_DEVICE_CRYPTO:

Why are you adding this to the list of devices that don't hae DeviceInfo
when this device clearly has one?  You need to ensure proper allocation

>     case VIR_DOMAIN_DEVICE_LAST:
>     case VIR_DOMAIN_DEVICE_NONE:
>         return 0;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170207/86eb678b/attachment-0001.sig>


More information about the libvir-list mailing list