diff mbox series

[v1,3/4] tests: add virtuqueue size checking to virtio_seg_max_adjust test

Message ID 20200129140702.5411-4-dplotnikov@virtuozzo.com (mailing list archive)
State New, archived
Headers show
Series Increase default virtqueue size to improve performance | expand

Commit Message

Denis Plotnikov Jan. 29, 2020, 2:07 p.m. UTC
This is due to the change in the default virtqueue_size in the
latest machine type to improve guest disks performance.

Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com>
---
 tests/acceptance/virtio_seg_max_adjust.py | 33 ++++++++++++++---------
 1 file changed, 21 insertions(+), 12 deletions(-)

Comments

Michael S. Tsirkin Jan. 30, 2020, 1:42 p.m. UTC | #1
On Wed, Jan 29, 2020 at 05:07:01PM +0300, Denis Plotnikov wrote:
> This is due to the change in the default virtqueue_size in the
> latest machine type to improve guest disks performance.
>

Sorry what is due to the change?
 
> Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com>
> ---
>  tests/acceptance/virtio_seg_max_adjust.py | 33 ++++++++++++++---------
>  1 file changed, 21 insertions(+), 12 deletions(-)
> 
> diff --git a/tests/acceptance/virtio_seg_max_adjust.py b/tests/acceptance/virtio_seg_max_adjust.py
> index 5458573138..645d69b313 100755
> --- a/tests/acceptance/virtio_seg_max_adjust.py
> +++ b/tests/acceptance/virtio_seg_max_adjust.py
> @@ -27,8 +27,10 @@ from qemu.machine import QEMUMachine
>  from avocado_qemu import Test
>  
>  #list of machine types and virtqueue properties to test
> -VIRTIO_SCSI_PROPS = {'seg_max_adjust': 'seg_max_adjust'}
> -VIRTIO_BLK_PROPS = {'seg_max_adjust': 'seg-max-adjust'}
> +VIRTIO_SCSI_PROPS = {'seg_max_adjust': 'seg_max_adjust',
> +                     'queue_size': 'virtqueue_size'}
> +VIRTIO_BLK_PROPS = {'seg_max_adjust': 'seg-max-adjust',
> +                    'queue_size': 'queue-size'}
>  
>  DEV_TYPES = {'virtio-scsi-pci': VIRTIO_SCSI_PROPS,
>               'virtio-blk-pci': VIRTIO_BLK_PROPS}
> @@ -40,7 +42,7 @@ VM_DEV_PARAMS = {'virtio-scsi-pci': ['-device', 'virtio-scsi-pci,id=scsi0'],
>                                      'driver=null-co,id=drive0,if=none']}
>  
>  
> -class VirtioMaxSegSettingsCheck(Test):
> +class VirtioPramsCheck(Test):
>      @staticmethod
>      def make_pattern(props):
>          pattern_items = ['{0} = \w+'.format(prop) for prop in props]
> @@ -72,20 +74,24 @@ class VirtioMaxSegSettingsCheck(Test):
>                  props[p[0]] = p[1]
>          return query_ok, props, error
>  
> -    def check_mt(self, mt, dev_type_name):
> +    def check_mt(self, mt, expected_props, dev_type_name):
>          with QEMUMachine(self.qemu_bin) as vm:
> -            vm.set_machine(mt["name"])
> +            vm.set_machine(mt)
>              for s in VM_DEV_PARAMS[dev_type_name]:
>                  vm.add_args(s)
>              vm.launch()
>              query_ok, props, error = self.query_virtqueue(vm, dev_type_name)
>  
>          if not query_ok:
> -            self.fail('machine type {0}: {1}'.format(mt['name'], error))
> +            self.fail('machine type {0}: {1}'.format(mt, error))
>  
>          for prop_name, prop_val in props.items():
> -            expected_val = mt[prop_name]
> -            self.assertEqual(expected_val, prop_val)
> +            expected_val = expected_props[prop_name]
> +            msg = 'Property value mismatch for (MT: {0}, '\
> +                  'property name: {1}): expected value: "{2}" '\
> +                  'actual value: "{3}"'\
> +                  .format(mt, prop_name, expected_val, prop_val)
> +            self.assertEqual(expected_val, prop_val, msg)


Looks like an unrelated change, no?

>      @staticmethod
>      def seg_max_adjust_enabled(mt):
> @@ -120,15 +126,18 @@ class VirtioMaxSegSettingsCheck(Test):
>  
>          for dev_type in DEV_TYPES:
>              # create the list of machine types and their parameters.
> -            mtypes = list()
> +            mtypes = dict()
>              for m in machines:
>                  if self.seg_max_adjust_enabled(m):
>                      enabled = 'true'
> +                    queue_size = '256'
>                  else:
>                      enabled = 'false'
> -                mtypes.append({'name': m,
> -                               DEV_TYPES[dev_type]['seg_max_adjust']: enabled})
> +                    queue_size = '128'
> +                mtypes[m] = {
> +                    DEV_TYPES[dev_type]['seg_max_adjust']: enabled,
> +                    DEV_TYPES[dev_type]['queue_size']: queue_size }
>  
>              # test each machine type for a device type
>              for mt in mtypes:
> -                self.check_mt(mt, dev_type)
> +                self.check_mt(mt, mtypes[mt], dev_type)
> -- 
> 2.17.0
Denis Plotnikov Feb. 3, 2020, 12:21 p.m. UTC | #2
On 30.01.2020 16:42, Michael S. Tsirkin wrote:
> On Wed, Jan 29, 2020 at 05:07:01PM +0300, Denis Plotnikov wrote:
>> This is due to the change in the default virtqueue_size in the
>> latest machine type to improve guest disks performance.
>>
> Sorry what is due to the change?
>   
>> Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com>
>> ---
>>   tests/acceptance/virtio_seg_max_adjust.py | 33 ++++++++++++++---------
>>   1 file changed, 21 insertions(+), 12 deletions(-)
>>
>> diff --git a/tests/acceptance/virtio_seg_max_adjust.py b/tests/acceptance/virtio_seg_max_adjust.py
>> index 5458573138..645d69b313 100755
>> --- a/tests/acceptance/virtio_seg_max_adjust.py
>> +++ b/tests/acceptance/virtio_seg_max_adjust.py
>> @@ -27,8 +27,10 @@ from qemu.machine import QEMUMachine
>>   from avocado_qemu import Test
>>   
>>   #list of machine types and virtqueue properties to test
>> -VIRTIO_SCSI_PROPS = {'seg_max_adjust': 'seg_max_adjust'}
>> -VIRTIO_BLK_PROPS = {'seg_max_adjust': 'seg-max-adjust'}
>> +VIRTIO_SCSI_PROPS = {'seg_max_adjust': 'seg_max_adjust',
>> +                     'queue_size': 'virtqueue_size'}
>> +VIRTIO_BLK_PROPS = {'seg_max_adjust': 'seg-max-adjust',
>> +                    'queue_size': 'queue-size'}
>>   
>>   DEV_TYPES = {'virtio-scsi-pci': VIRTIO_SCSI_PROPS,
>>                'virtio-blk-pci': VIRTIO_BLK_PROPS}
>> @@ -40,7 +42,7 @@ VM_DEV_PARAMS = {'virtio-scsi-pci': ['-device', 'virtio-scsi-pci,id=scsi0'],
>>                                       'driver=null-co,id=drive0,if=none']}
>>   
>>   
>> -class VirtioMaxSegSettingsCheck(Test):
>> +class VirtioPramsCheck(Test):
>>       @staticmethod
>>       def make_pattern(props):
>>           pattern_items = ['{0} = \w+'.format(prop) for prop in props]
>> @@ -72,20 +74,24 @@ class VirtioMaxSegSettingsCheck(Test):
>>                   props[p[0]] = p[1]
>>           return query_ok, props, error
>>   
>> -    def check_mt(self, mt, dev_type_name):
>> +    def check_mt(self, mt, expected_props, dev_type_name):
>>           with QEMUMachine(self.qemu_bin) as vm:
>> -            vm.set_machine(mt["name"])
>> +            vm.set_machine(mt)
>>               for s in VM_DEV_PARAMS[dev_type_name]:
>>                   vm.add_args(s)
>>               vm.launch()
>>               query_ok, props, error = self.query_virtqueue(vm, dev_type_name)
>>   
>>           if not query_ok:
>> -            self.fail('machine type {0}: {1}'.format(mt['name'], error))
>> +            self.fail('machine type {0}: {1}'.format(mt, error))
>>   
>>           for prop_name, prop_val in props.items():
>> -            expected_val = mt[prop_name]
>> -            self.assertEqual(expected_val, prop_val)
>> +            expected_val = expected_props[prop_name]
>> +            msg = 'Property value mismatch for (MT: {0}, '\
>> +                  'property name: {1}): expected value: "{2}" '\
>> +                  'actual value: "{3}"'\
>> +                  .format(mt, prop_name, expected_val, prop_val)
>> +            self.assertEqual(expected_val, prop_val, msg)
>
> Looks like an unrelated change, no?
Yep, I'd better split the patches and add the test improvements in the 
separate one.

Denis
>
>>       @staticmethod
>>       def seg_max_adjust_enabled(mt):
>> @@ -120,15 +126,18 @@ class VirtioMaxSegSettingsCheck(Test):
>>   
>>           for dev_type in DEV_TYPES:
>>               # create the list of machine types and their parameters.
>> -            mtypes = list()
>> +            mtypes = dict()
>>               for m in machines:
>>                   if self.seg_max_adjust_enabled(m):
>>                       enabled = 'true'
>> +                    queue_size = '256'
>>                   else:
>>                       enabled = 'false'
>> -                mtypes.append({'name': m,
>> -                               DEV_TYPES[dev_type]['seg_max_adjust']: enabled})
>> +                    queue_size = '128'
>> +                mtypes[m] = {
>> +                    DEV_TYPES[dev_type]['seg_max_adjust']: enabled,
>> +                    DEV_TYPES[dev_type]['queue_size']: queue_size }
>>   
>>               # test each machine type for a device type
>>               for mt in mtypes:
>> -                self.check_mt(mt, dev_type)
>> +                self.check_mt(mt, mtypes[mt], dev_type)
>> -- 
>> 2.17.0
diff mbox series

Patch

diff --git a/tests/acceptance/virtio_seg_max_adjust.py b/tests/acceptance/virtio_seg_max_adjust.py
index 5458573138..645d69b313 100755
--- a/tests/acceptance/virtio_seg_max_adjust.py
+++ b/tests/acceptance/virtio_seg_max_adjust.py
@@ -27,8 +27,10 @@  from qemu.machine import QEMUMachine
 from avocado_qemu import Test
 
 #list of machine types and virtqueue properties to test
-VIRTIO_SCSI_PROPS = {'seg_max_adjust': 'seg_max_adjust'}
-VIRTIO_BLK_PROPS = {'seg_max_adjust': 'seg-max-adjust'}
+VIRTIO_SCSI_PROPS = {'seg_max_adjust': 'seg_max_adjust',
+                     'queue_size': 'virtqueue_size'}
+VIRTIO_BLK_PROPS = {'seg_max_adjust': 'seg-max-adjust',
+                    'queue_size': 'queue-size'}
 
 DEV_TYPES = {'virtio-scsi-pci': VIRTIO_SCSI_PROPS,
              'virtio-blk-pci': VIRTIO_BLK_PROPS}
@@ -40,7 +42,7 @@  VM_DEV_PARAMS = {'virtio-scsi-pci': ['-device', 'virtio-scsi-pci,id=scsi0'],
                                     'driver=null-co,id=drive0,if=none']}
 
 
-class VirtioMaxSegSettingsCheck(Test):
+class VirtioPramsCheck(Test):
     @staticmethod
     def make_pattern(props):
         pattern_items = ['{0} = \w+'.format(prop) for prop in props]
@@ -72,20 +74,24 @@  class VirtioMaxSegSettingsCheck(Test):
                 props[p[0]] = p[1]
         return query_ok, props, error
 
-    def check_mt(self, mt, dev_type_name):
+    def check_mt(self, mt, expected_props, dev_type_name):
         with QEMUMachine(self.qemu_bin) as vm:
-            vm.set_machine(mt["name"])
+            vm.set_machine(mt)
             for s in VM_DEV_PARAMS[dev_type_name]:
                 vm.add_args(s)
             vm.launch()
             query_ok, props, error = self.query_virtqueue(vm, dev_type_name)
 
         if not query_ok:
-            self.fail('machine type {0}: {1}'.format(mt['name'], error))
+            self.fail('machine type {0}: {1}'.format(mt, error))
 
         for prop_name, prop_val in props.items():
-            expected_val = mt[prop_name]
-            self.assertEqual(expected_val, prop_val)
+            expected_val = expected_props[prop_name]
+            msg = 'Property value mismatch for (MT: {0}, '\
+                  'property name: {1}): expected value: "{2}" '\
+                  'actual value: "{3}"'\
+                  .format(mt, prop_name, expected_val, prop_val)
+            self.assertEqual(expected_val, prop_val, msg)
 
     @staticmethod
     def seg_max_adjust_enabled(mt):
@@ -120,15 +126,18 @@  class VirtioMaxSegSettingsCheck(Test):
 
         for dev_type in DEV_TYPES:
             # create the list of machine types and their parameters.
-            mtypes = list()
+            mtypes = dict()
             for m in machines:
                 if self.seg_max_adjust_enabled(m):
                     enabled = 'true'
+                    queue_size = '256'
                 else:
                     enabled = 'false'
-                mtypes.append({'name': m,
-                               DEV_TYPES[dev_type]['seg_max_adjust']: enabled})
+                    queue_size = '128'
+                mtypes[m] = {
+                    DEV_TYPES[dev_type]['seg_max_adjust']: enabled,
+                    DEV_TYPES[dev_type]['queue_size']: queue_size }
 
             # test each machine type for a device type
             for mt in mtypes:
-                self.check_mt(mt, dev_type)
+                self.check_mt(mt, mtypes[mt], dev_type)