[Kimchi-devel] [PATCH] [Kimchi] Validate passthrough inside the task

Socorro socorro at linux.vnet.ibm.com
Thu Jul 28 18:54:27 UTC 2016


JFYI....in testing the UI PCI patch from before, I had also encountered 
the Unknown Parameter error when clicking on the Filter dropdown.


On 07/28/2016 11:41 AM, Daniel Henrique Barboza wrote:
> I'll send my feedback here but consider that it belongs to all
> the 3 passthrough related patches you've sent.
>
> Testing in my TP, with your patches, I had one extra error
> when switching to the 'To Add' filter. In current master I have
> the following error:
>
>
>
> With your patch:
>
>
>
> There's an extra error 'Node device undefined not found'.
>
> Ideally you could get rid of all the errors in this window but at the
> very least we can't increase them.
>
>
> On 07/27/2016 11:00 PM, Jose Ricardo Ziviani wrote:
>>   - In order to validade if a given PCI is ok to be attached, a heavy
>>     verification has to be done. This commit add such verification
>>     in the task. This will give a faster response to the UI,
>>     improving the user experience.
>>
>> Signed-off-by: Jose Ricardo Ziviani<joserz at linux.vnet.ibm.com>
>> ---
>>   model/vmhostdevs.py                 | 22 ++++++++++++++++-
>>   ui/js/src/kimchi.guest_edit_main.js | 47 ++++++++++++++++++++-----------------
>>   2 files changed, 47 insertions(+), 22 deletions(-)
>>
>> diff --git a/model/vmhostdevs.py b/model/vmhostdevs.py
>> index 15b5bec..ef39de3 100644
>> --- a/model/vmhostdevs.py
>> +++ b/model/vmhostdevs.py
>> @@ -89,7 +89,6 @@ class VMHostDevsModel(object):
>>
>>       def create(self, vmid, params):
>>           dev_name = params['name']
>> -        self._passthrough_device_validate(dev_name)
>>           dev_info = self.dev_model.lookup(dev_name)
>>
>>           if dev_info['device_type'] == 'pci':
>> @@ -216,6 +215,13 @@ class VMHostDevsModel(object):
>>           dev_info = params['dev_info']
>>           lock = params['lock']
>>
>> +        try:
>> +            self._passthrough_device_validate(dev_info['name'])
>> +
>> +        except InvalidParameter as e:
>> +            cb(e.message, False)
>> +            raise
>> +
>>           with lock:
>>               try:
>>                   self._validate_pci_passthrough_env()
>> @@ -455,6 +461,13 @@ class VMHostDevsModel(object):
>>           dev_info = params['dev_info']
>>           lock = params['lock']
>>
>> +        try:
>> +            self._passthrough_device_validate(dev_info['name'])
>> +
>> +        except InvalidParameter as e:
>> +            cb(e.message, False)
>> +            raise
>> +
>>           with lock:
>>               dom = VMModel.get_vm(vmid, self.conn)
>>
>> @@ -501,6 +514,13 @@ class VMHostDevsModel(object):
>>           dom = VMModel.get_vm(vmid, self.conn)
>>           lock = params['lock']
>>
>> +        try:
>> +            self._passthrough_device_validate(dev_info['name'])
>> +
>> +        except InvalidParameter as e:
>> +            cb(e.message, False)
>> +            raise
>> +
>>           with lock:
>>               with RollbackContext() as rollback:
>>                   xmlstr = self._get_usb_device_xml(dev_info)
>> diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js
>> index 507ae75..5d91b14 100644
>> --- a/ui/js/src/kimchi.guest_edit_main.js
>> +++ b/ui/js/src/kimchi.guest_edit_main.js
>> @@ -546,9 +546,11 @@ kimchi.guest_edit_main = function() {
>>                       wok.message.error(err.responseJSON.reason, '#alert-modal-container');
>>                   });
>>               } else {
>> +                $('html').addClass('in-progress');
>> +                $('#form-guest-edit-pci > .wok-mask').show();
>> +                var haveCompanions = false;
>> +                var pciTitle = i18n['KCHVMED6007M'] + '\n';
>>                   kimchi.getPCIDeviceCompanions(id, function(infoData) {
>> -                    var pciTitle = i18n['KCHVMED6007M'] + '\n';
>> -                    var haveCompanions = false;
>>                       for (var p = 0; p < infoData.length; p++) {
>>                           if (infoData[p].device_type === 'net') {
>>                               haveCompanions = true;
>> @@ -564,24 +566,19 @@ kimchi.guest_edit_main = function() {
>>                               pciTitle += ', ' + i18n['KCHVMED6006M'] + ' ' + infoData[p].model + '\n';
>>                           }
>>                       }
>> -                    var settings = {
>> -                        title: i18n['KCHVMED6012M'],
>> -                        content: pciTitle,
>> -                        confirm: i18n['KCHAPI6002M'],
>> -                        cancel: i18n['KCHAPI6003M']
>> -                    };
>> +                });
>> +                $('#form-guest-edit-pci > .wok-mask').fadeOut(300, function() {});
>> +                $('html').removeClass('in-progress');
>>
>> -                    if (haveCompanions) {
>> -                        wok.confirm(settings, function() {
>> -                            kimchi.addVMPCIDevice(kimchi.selectedGuest, {
>> -                                name: id
>> -                            }, function(task) {
>> -                                getOngoingAttachingDevices(task);
>> -                            }, function(err) {
>> -                                wok.message.error(err.responseJSON.reason, '#alert-modal-container');
>> -                            });
>> -                        });
>> -                    } else {
>> +                var settings = {
>> +                    title: i18n['KCHVMED6012M'],
>> +                    content: pciTitle,
>> +                    confirm: i18n['KCHAPI6002M'],
>> +                    cancel: i18n['KCHAPI6003M']
>> +                };
>> +
>> +                if (haveCompanions) {
>> +                    wok.confirm(settings, function() {
>>                           kimchi.addVMPCIDevice(kimchi.selectedGuest, {
>>                               name: id
>>                           }, function(task) {
>> @@ -589,8 +586,16 @@ kimchi.guest_edit_main = function() {
>>                           }, function(err) {
>>                               wok.message.error(err.responseJSON.reason, '#alert-modal-container');
>>                           });
>> -                    }
>> -                });
>> +                    });
>> +                } else {
>> +                    kimchi.addVMPCIDevice(kimchi.selectedGuest, {
>> +                        name: id
>> +                    }, function(task) {
>> +                        getOngoingAttachingDevices(task);
>> +                    }, function(err) {
>> +                        wok.message.error(err.responseJSON.reason, '#alert-modal-container');
>> +                    });
>> +                }
>>               }
>>           });
>>       };
>
>
>
> _______________________________________________
> Kimchi-devel mailing list
> Kimchi-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/kimchi-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/kimchi-devel/attachments/20160728/f57f2091/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 6762 bytes
Desc: not available
URL: <http://lists.ovirt.org/pipermail/kimchi-devel/attachments/20160728/f57f2091/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 10440 bytes
Desc: not available
URL: <http://lists.ovirt.org/pipermail/kimchi-devel/attachments/20160728/f57f2091/attachment-0001.png>


More information about the Kimchi-devel mailing list