test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH] framework: add crypto option support
@ 2019-03-07 23:47 Xinfeng Zhao
  2019-03-14  8:57 ` Tu, Lijuan
  0 siblings, 1 reply; 2+ messages in thread
From: Xinfeng Zhao @ 2019-03-07 23:47 UTC (permalink / raw)
  To: dts; +Cc: Xinfeng Zhao

Signed-off-by: Xinfeng Zhao <xinfengx.zhao@intel.com>
---
 framework/qemu_kvm.py | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/framework/qemu_kvm.py b/framework/qemu_kvm.py
index 279b73d..c3e8f37 100644
--- a/framework/qemu_kvm.py
+++ b/framework/qemu_kvm.py
@@ -1165,6 +1165,30 @@ class QEMUKvm(VirtBase):
             cmd = options['cmd']
         self.__add_boot_line(cmd)
 
+    def add_vm_crypto(self, **options):
+        """
+        Add VM crypto options
+        """
+        separator = ' '
+
+        if 'enable' in options.keys() and options['enable'] == 'yes':
+            if 'opt_num' in options.keys():
+                opt_num = int(options['opt_num'])
+            else:
+                opt_num = 1
+
+            for id in range(opt_num):
+                cryptodev_id = '%(vm_name)s_crypto%(id)s' % {'vm_name': self.vm_name, 'id': id}
+                cryptodev_soch_path = '/tmp/%(vm_name)s_crypto%(id)s.sock' % {'vm_name': self.vm_name, 'id': id}
+
+                crypto_boot_block = '-chardev socket,path=%(SOCK_PATH)s,id=%(ID)s' + separator +\
+                                    '-object cryptodev-vhost-user,id=cryptodev%(id)s,chardev=%(ID)s' + separator +\
+                                    '-device virtio-crypto-pci,id=crypto%(id)s,cryptodev=cryptodev%(id)s'
+                crypto_boot_line = crypto_boot_block % {'SOCK_PATH': cryptodev_soch_path,
+                                                        'ID': cryptodev_id,
+                                                        'id': id}
+                self.__add_boot_line(crypto_boot_line)
+
     def _check_vm_status(self):
         """
         Check and restart QGA if not ready, wait for network ready
-- 
2.7.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dts] [PATCH] framework: add crypto option support
  2019-03-07 23:47 [dts] [PATCH] framework: add crypto option support Xinfeng Zhao
@ 2019-03-14  8:57 ` Tu, Lijuan
  0 siblings, 0 replies; 2+ messages in thread
From: Tu, Lijuan @ 2019-03-14  8:57 UTC (permalink / raw)
  To: Zhao, XinfengX, dts; +Cc: Zhao, XinfengX

Applied, thanks

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Xinfeng Zhao
> Sent: Friday, March 8, 2019 7:48 AM
> To: dts@dpdk.org
> Cc: Zhao, XinfengX <xinfengx.zhao@intel.com>
> Subject: [dts] [PATCH] framework: add crypto option support
> 
> Signed-off-by: Xinfeng Zhao <xinfengx.zhao@intel.com>
> ---
>  framework/qemu_kvm.py | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/framework/qemu_kvm.py b/framework/qemu_kvm.py index
> 279b73d..c3e8f37 100644
> --- a/framework/qemu_kvm.py
> +++ b/framework/qemu_kvm.py
> @@ -1165,6 +1165,30 @@ class QEMUKvm(VirtBase):
>              cmd = options['cmd']
>          self.__add_boot_line(cmd)
> 
> +    def add_vm_crypto(self, **options):
> +        """
> +        Add VM crypto options
> +        """
> +        separator = ' '
> +
> +        if 'enable' in options.keys() and options['enable'] == 'yes':
> +            if 'opt_num' in options.keys():
> +                opt_num = int(options['opt_num'])
> +            else:
> +                opt_num = 1
> +
> +            for id in range(opt_num):
> +                cryptodev_id = '%(vm_name)s_crypto%(id)s' % {'vm_name':
> self.vm_name, 'id': id}
> +                cryptodev_soch_path =
> + '/tmp/%(vm_name)s_crypto%(id)s.sock' % {'vm_name': self.vm_name, 'id':
> + id}
> +
> +                crypto_boot_block = '-chardev
> socket,path=%(SOCK_PATH)s,id=%(ID)s' + separator +\
> +                                    '-object cryptodev-vhost-
> user,id=cryptodev%(id)s,chardev=%(ID)s' + separator +\
> +                                    '-device virtio-crypto-
> pci,id=crypto%(id)s,cryptodev=cryptodev%(id)s'
> +                crypto_boot_line = crypto_boot_block % {'SOCK_PATH':
> cryptodev_soch_path,
> +                                                        'ID': cryptodev_id,
> +                                                        'id': id}
> +                self.__add_boot_line(crypto_boot_line)
> +
>      def _check_vm_status(self):
>          """
>          Check and restart QGA if not ready, wait for network ready
> --
> 2.7.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-14  8:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-07 23:47 [dts] [PATCH] framework: add crypto option support Xinfeng Zhao
2019-03-14  8:57 ` Tu, Lijuan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).