[PATCH v2] [Kimchi] Issue #956: Unable to assign pci passthrough devices through kimchi

From: Samuel Guimarães <sguimaraes943@gmail.com> This commit fixes an issue with PCI passthrough devices through Kimchi. It also addresses an enhancement to display success messages when some actions doesn't require the Save button and there's no UI feedback to the user (Issue #975). v2 - Added error callbacks for kimchi.addVMPCIDevice() and kimchi.removeVMPCIDevice() to display error messages before if starts to track ongoing tasks. Samuel Guimarães (1): Issue #956: Unable to assign pci passthrough devices through kimchi model/vmhostdevs.py | 2 +- ui/css/kimchi.css | 5 + ui/css/src/modules/_edit-guests.scss | 4 + ui/js/src/kimchi.guest_edit_main.js | 236 +++++++++++++++++++++++------------ ui/js/src/kimchi.guest_main.js | 10 +- ui/pages/guest-edit.html.tmpl | 20 ++- ui/pages/i18n.json.tmpl | 2 + 7 files changed, 180 insertions(+), 99 deletions(-) -- 1.9.3

From: Samuel Guimarães <sguimaraes943@gmail.com> This commit fixes an issue with PCI passthrough devices through Kimchi. It also addresses an enhancement to display success messages when some actions doesn't require the Save button and there's no UI feedback to the user (Issue #975). Signed-off-by: Samuel Guimarães <sguimaraes943@gmail.com> --- model/vmhostdevs.py | 2 +- ui/css/kimchi.css | 5 + ui/css/src/modules/_edit-guests.scss | 4 + ui/js/src/kimchi.guest_edit_main.js | 236 +++++++++++++++++++++++------------ ui/js/src/kimchi.guest_main.js | 10 +- ui/pages/guest-edit.html.tmpl | 20 ++- ui/pages/i18n.json.tmpl | 2 + 7 files changed, 180 insertions(+), 99 deletions(-) diff --git a/model/vmhostdevs.py b/model/vmhostdevs.py index 2130ac4..b57cbf0 100644 --- a/model/vmhostdevs.py +++ b/model/vmhostdevs.py @@ -510,7 +510,7 @@ class VMHostDevModel(object): return self.task.lookup(taskid) def _detach_device(self, cb, params): - cb('Detaching device.') + cb('Detaching device') vmid = params['vmid'] dev_name = params['dev_name'] dom = params['dom'] diff --git a/ui/css/kimchi.css b/ui/css/kimchi.css index 34347c2..59d96e1 100644 --- a/ui/css/kimchi.css +++ b/ui/css/kimchi.css @@ -1039,6 +1039,11 @@ body.wok-gallery { width: 22%; } +#guest-edit-window #form-guest-edit-pci .wok-mask { + top: 0 !important; + z-index: 2 !important; +} + #guest-edit-window #form-guest-edit-pci .column-actions { width: 4.47%; } diff --git a/ui/css/src/modules/_edit-guests.scss b/ui/css/src/modules/_edit-guests.scss index 6196ed9..b7e6941 100644 --- a/ui/css/src/modules/_edit-guests.scss +++ b/ui/css/src/modules/_edit-guests.scss @@ -62,6 +62,10 @@ } } #form-guest-edit-pci { + .wok-mask { + top: 0 !important; + z-index: 2 !important; + } .column-actions { width: 4.47%; } diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js index fc67d82..d1d6335 100644 --- a/ui/js/src/kimchi.guest_edit_main.js +++ b/ui/js/src/kimchi.guest_edit_main.js @@ -425,16 +425,16 @@ kimchi.guest_edit_main = function() { var filterPCINodes = function(group, text) { text = text.trim().split(" "); var rows = $('.body', '#form-guest-edit-pci').find('div'); - if(text === ""){ + if (text === "") { rows.show(); return; } rows.hide(); - rows.filter(function(index, value){ + rows.filter(function(index, value) { var $span = $(this); var $itemGroup = $('button i', this); - for (var i = 0; i < text.length; ++i){ + for (var i = 0; i < text.length; ++i) { if ($span.is(":containsNC('" + text[i] + "')")) { if (group === 'all') { return true; @@ -448,87 +448,26 @@ kimchi.guest_edit_main = function() { return false; }).show(); }; - var setupPCIDevice = function() { - kimchi.getAvailableHostPCIDevices(function(hostPCIs) { - kimchi.getVMPCIDevices(kimchi.selectedGuest, function(vmPCIs) { - setupNode(hostPCIs, 'fa-power-off'); - setupNode(vmPCIs, 'fa-ban'); - }); - }); - $('select', '#form-guest-edit-pci').change(function() { - filterPCINodes($(this).val(), $('input#guest-edit-pci-filter', '#form-guest-edit-pci').val()); - }); - $('select', '#form-guest-edit-pci').selectpicker(); - $('input#guest-edit-pci-filter', '#form-guest-edit-pci').on('keyup', function() { - filterPCINodes($('select', '#form-guest-edit-pci').val(), $(this).val()); - }); - }; - var setupNode = function(arrPCIDevices, iconClass) { + + var _generatePciDeviceHtml = function(devices, pciType) { var pciEnabled = kimchi.capabilities.kernel_vfio; - var pciDeviceName, pciDeviceProduct, pciDeviceProductDesc, pciDeviceVendor, pciDeviceVendorDesc, pciDeviceStatus; - for (var i = 0; i < arrPCIDevices.length; i++) { - pciDeviceName = arrPCIDevices[i].name; - pciDeviceProduct = arrPCIDevices[i].product; - pciDeviceVendor = arrPCIDevices[i].vendor; - pciDeviceStatus = (iconClass === 'fa-ban') ? 'enabled' : 'disabled'; - if (pciDeviceProduct !== null) { - pciDeviceProductDesc = pciDeviceProduct.description; - } - if (pciDeviceVendor !== null) { - pciDeviceVendorDesc = pciDeviceVendor.description; - } - var itemNode = $.parseHTML(wok.substitute($('#pci-tmpl').html(), { - status: pciDeviceStatus, - name: pciDeviceName, - product: pciDeviceProductDesc, - vendor: pciDeviceVendorDesc + var deviceHTml = devices.map(function(device, index) { + device.iconClass = (pciType === 'hostPCIs' ? 'fa-power-off' : (pciType === 'vmPCIs' ? 'fa-ban' : 'fa-power-off')); + device.status = (pciType === 'vmPCIs' ? 'enabled' : 'disabled'); + device.product = (device.product !== null ? device.product.description : ''); + device.vendor = (device.vendor !== null ? device.vendor.description : ''); + deviceHtml = $.parseHTML(wok.substitute($('#pci-tmpl').html(), { + status: device.status, + name: device.name, + product: device.product, + vendor: device.vendor })); - $('.body', '#form-guest-edit-pci').append(itemNode); - pciEnabled || $('button', itemNode).remove(); - $('button i', itemNode).addClass(iconClass); - if (kimchi.thisVMState === "running" && arrPCIDevices[i].vga3d) { - $('button', itemNode).prop("disabled", true); + pciEnabled || $('button', deviceHtml).remove(); + $('button > i', deviceHtml).addClass(device.iconClass); + if (kimchi.thisVMState === "running" && device.vga3d) { + $('button', deviceHtml).prop("disabled", true); } - $('button', itemNode).on('click', function(event) { - event.preventDefault(); - var obj = $(this); - var objIcon = obj.find('i'); - var id = obj.parent().parent().attr('id'); - if (objIcon.hasClass('fa-ban')) { - kimchi.removeVMPCIDevice(kimchi.selectedGuest, id, function() { - kimchi.getAvailableHostPCIDevices(function(arrPCIDevices) { - kimchi.getVMPCIDevices(kimchi.selectedGuest, function(vmPCIs) { - for (var k = 0; k < arrPCIDevices.length; k++) { - $('#' + arrPCIDevices[k].name + '.item').removeClass('enabled').addClass('disabled'); - $('#' + arrPCIDevices[k].name + ' .action-area button i').removeClass('fa-ban').addClass('fa-power-off'); - } - for (var k = 0; k < vmPCIs.length; k++) { - $('#' + arrPCIDevices[k].name + '.item').removeClass('disabled').addClass('enabled'); - $('#' + arrPCIDevices[k].name + ' .action-area button i').removeClass('fa-power-off').addClass('fa-ban'); - } - }); - }); - //id is for the object that is being added back to the available PCI devices - filterPCINodes($('select', '#form-guest-edit-pci').val(), $('input#guest-edit-pci-filter', '#form-guest-edit-pci').val()); - }, null); - } else { - kimchi.addVMPCIDevice(kimchi.selectedGuest, { - name: id - }, function() { - kimchi.getAvailableHostPCIDevices(function(arrPCIDevices) { - kimchi.getVMPCIDevices(kimchi.selectedGuest, function(vmPCIs) { - for (var k = 0; k < vmPCIs.length; k++) { - $('#' + vmPCIs[k].name + '.item').removeClass('disabled').addClass('enabled'); - $('#' + vmPCIs[k].name + ' .action-area button i').removeClass('fa-power-off').addClass('fa-ban'); - } - }); - }); - //id is for the object that is being removed from the available PCI devices - filterPCINodes($('select', '#form-guest-edit-pci').val(), $('input#guest-edit-pci-filter', '#form-guest-edit-pci').val()); - }, null); - } - }); - kimchi.getPCIDeviceCompanions(pciDeviceName, function(infoData) { + kimchi.getPCIDeviceCompanions(device.name, function(infoData) { var pciTitle = i18n['KCHVMED6007M'] + '\n'; var haveCompanions = false; for (var p = 0; p < infoData.length; p++) { @@ -552,9 +491,142 @@ kimchi.guest_edit_main = function() { haveCompanions && $('.vendor', '#' + infoData[q].parent).attr('title', pciTitle); } }); - } + device = deviceHtml[0].outerHTML; + $('.body', '#form-guest-edit-pci').append(device); + }); + }; + var getOngoingAttachingDevices = function() { + var result = {}; + var devices = 'status=running&target_uri=' + encodeURIComponent('^/plugins/kimchi/vms/' + kimchi.selectedGuest + '/hostdevs'); + kimchi.getTasksByFilter(devices, function(tasks) { + for (var i = 0; i < tasks.length; i++) { + if (tasks[i].message === 'Attaching PCI device') { + var selectedVm = tasks[i].target_uri.split('/'); + selectedVm = selectedVm[4]; + result[selectedVm] = tasks[i]; + + if (kimchi.trackingTasks.indexOf(tasks[i].id) >= 0) { + continue; + } + + kimchi.trackTask(tasks[i].id, function(result) { + kimchi.getAvailableHostPCIDevices(function(arrPCIDevices) { + kimchi.getVMPCIDevices(kimchi.selectedGuest, function(vmPCIs) { + for (var k = 0; k < vmPCIs.length; k++) { + $('#' + vmPCIs[k].name + '.item').removeClass('disabled').addClass('enabled'); + $('#' + vmPCIs[k].name + ' .action-area button i').removeClass('fa-power-off').addClass('fa-ban'); + } + }); + }); + $('#form-guest-edit-pci > .wok-mask').fadeOut(300, function() {}); + wok.message.success(i18n['KCHVMED6010M'], '#alert-modal-container'); + filterPCINodes($('select', '#form-guest-edit-pci').val(), $('input#guest-edit-pci-filter', '#form-guest-edit-pci').val()); + }, function(result) { + if (result['message']) { + var errText = result['message']; + } else { + var errText = result['responseJSON']['reason']; + } + $('#form-guest-edit-pci > .wok-mask').fadeOut(300, function() {}); + filterPCINodes($('select', '#form-guest-edit-pci').val(), $('input#guest-edit-pci-filter', '#form-guest-edit-pci').val()); + result && wok.message.error(errText, '#alert-modal-container'); + }, function(result) { + $('#form-guest-edit-pci > .wok-mask').show(); + }); + } + } + }, null, true); + }; + var getOngoingDetachingDevices = function() { + var result = {}; + var devices = 'status=running&target_uri=' + encodeURIComponent('^/plugins/kimchi/vms/' + kimchi.selectedGuest + '/hostdevs'); + kimchi.getTasksByFilter(devices, function(tasks) { + for (var i = 0; i < tasks.length; i++) { + if (tasks[i].message === 'Detaching device') { + var selectedVm = tasks[i].target_uri.split('/'); + selectedVm = selectedVm[4]; + result[selectedVm] = tasks[i]; + + if (kimchi.trackingTasks.indexOf(tasks[i].id) >= 0) { + continue; + } + + kimchi.trackTask(tasks[i].id, function(result) { + kimchi.getAvailableHostPCIDevices(function(arrPCIDevices) { + kimchi.getVMPCIDevices(kimchi.selectedGuest, function(vmPCIs) { + for (var k = 0; k < arrPCIDevices.length; k++) { + $('#' + arrPCIDevices[k].name + '.item').removeClass('enabled').addClass('disabled'); + $('#' + arrPCIDevices[k].name + ' .action-area button i').removeClass('fa-ban').addClass('fa-power-off'); + } + for (var k = 0; k < vmPCIs.length; k++) { + $('#' + arrPCIDevices[k].name + '.item').removeClass('disabled').addClass('enabled'); + $('#' + arrPCIDevices[k].name + ' .action-area button i').removeClass('fa-power-off').addClass('fa-ban'); + } + }); + }); + $('#form-guest-edit-pci > .wok-mask').fadeOut(300, function() {}); + wok.message.success(i18n['KCHVMED6011M'], '#alert-modal-container'); + //id is for the object that is being added back to the available PCI devices + filterPCINodes($('select', '#form-guest-edit-pci').val(), $('input#guest-edit-pci-filter', '#form-guest-edit-pci').val()); + }, function(result) { + if (result['message']) { + var errText = result['message']; + } else { + var errText = result['responseJSON']['reason']; + } + $('#form-guest-edit-pci > .wok-mask').fadeOut(300, function() {}); + filterPCINodes($('select', '#form-guest-edit-pci').val(), $('input#guest-edit-pci-filter', '#form-guest-edit-pci').val()); + result && wok.message.error(errText, '#alert-modal-container'); + }, function(result) { + $('#form-guest-edit-pci > .wok-mask').show(); + }); + } + } + }, null, true); + }; + var pciDeviceButtonHandler = function() { + $('button', '#form-guest-edit-pci').on('click', function(event) { + event.preventDefault(); + var obj = $(this); + var objIcon = obj.find('i'); + var id = obj.parent().parent().attr('id'); + if (objIcon.hasClass('fa-ban')) { + kimchi.removeVMPCIDevice(kimchi.selectedGuest, id, function() { + getOngoingDetachingDevices(); + }, function(err) { + wok.message.error(err.responseJSON.reason, '#alert-modal-container'); + }); + } else { + kimchi.addVMPCIDevice(kimchi.selectedGuest, { + name: id + }, function() { + getOngoingAttachingDevices(); + }, function(err) { + wok.message.error(err.responseJSON.reason, '#alert-modal-container'); + }); + } + }); }; + var setupPCIDevice = function() { + kimchi.getAvailableHostPCIDevices(function(hostPCIs) { + kimchi.getVMPCIDevices(kimchi.selectedGuest, function(vmPCIs) { + _generatePciDeviceHtml(hostPCIs, 'hostPCIs'); + _generatePciDeviceHtml(vmPCIs, 'vmPCIs'); + pciDeviceButtonHandler(); + $('#form-guest-edit-pci > .wok-mask').fadeOut(300, function() {}); + }); + }); + $('select', '#form-guest-edit-pci').change(function() { + filterPCINodes($(this).val(), $('input#guest-edit-pci-filter', '#form-guest-edit-pci').val()); + }); + $('select', '#form-guest-edit-pci').selectpicker(); + $('input#guest-edit-pci-filter', '#form-guest-edit-pci').on('keyup', function() { + filterPCINodes($('select', '#form-guest-edit-pci').val(), $(this).val()); + }); + }; + + var setupSnapshot = function() { var currentSnapshot; var setCurrentSnapshot = function(aSnapshot) { diff --git a/ui/js/src/kimchi.guest_main.js b/ui/js/src/kimchi.guest_main.js index 0e11aa1..605cd2d 100644 --- a/ui/js/src/kimchi.guest_main.js +++ b/ui/js/src/kimchi.guest_main.js @@ -315,7 +315,7 @@ kimchi.initClone = function() { kimchi.listVmsAuto = function() { - $('.wok-mask').removeClass('hidden'); + $('#guests-root-container > .wok-mask').removeClass('hidden'); //Check if the actions button is opened or not, //if opended stop the reload of the itens until closed var $isDropdownOpened = $('[name="guest-actions"] ul.dropdown-menu').is(":visible"); @@ -431,13 +431,13 @@ kimchi.listVmsAuto = function() { }); }); } - $('.wok-mask').fadeOut(300, function() { + $('#guests-root-container > .wok-mask').fadeOut(300, function() { }); } else { $('.grid-control').addClass('hidden'); $('#guestListField').hide(); $('#noGuests').show(); - $('.wok-mask').fadeOut(300, function() {}); + $('#guests-root-container > .wok-mask').fadeOut(300, function() {}); } } @@ -446,8 +446,8 @@ kimchi.listVmsAuto = function() { function(errorResponse, textStatus, errorThrown) { if (errorResponse.responseJSON && errorResponse.responseJSON.reason) { wok.message.error(errorResponse.responseJSON.reason); - $('.wok-mask').fadeOut(300, function() { - $('.wok-mask').addClass('hidden'); + $('#guests-root-container > .wok-mask').fadeOut(300, function() { + $('#guests-root-container > .wok-mask').addClass('hidden'); }); } kimchi.vmTimeout = window.setTimeout("kimchi.listVmsAuto();", 5000); diff --git a/ui/pages/guest-edit.html.tmpl b/ui/pages/guest-edit.html.tmpl index f18d42c..a9a468e 100644 --- a/ui/pages/guest-edit.html.tmpl +++ b/ui/pages/guest-edit.html.tmpl @@ -160,6 +160,14 @@ </div> <div class="body"></div> </div> + <div class="wok-mask" role="presentation" class="hidden"> + <div class="wok-mask-loader-container"> + <div class="wok-mask-loading"> + <div class="wok-mask-loading-icon"></div> + <div class="wok-mask-loading-text">$_("Loading")...</div> + </div> + </div> + </div> </form> <form role="tabpanel" id="form-guest-edit-snapshot" class="guest-edit-snapshot tab-pane"> <div class="btn-group"> @@ -273,17 +281,7 @@ <label>{val}</label> </div> </script> -<script id="pci-tmpl" type="text/html"> -<div class="item {status}" id="{name}"> - <span class="cell status column-pci-status"> - <i class="fa fa-power-off"></i> - </span> - <span class="cell name column-pci-name" title="{name}">{name}</span> - <span class="cell product column-product" title="{product}">{product}</span> - <span class="cell vendor column-vendor" title="{vendor}">{vendor}</span> - <span class="cell column-actions action-area"><button class="btn btn-link"><i class="fa"></i></button></span> -</div> -</script> +<script id="pci-tmpl" type="text/html"><div class="item {status}" id="{name}"><span class="cell status column-pci-status"><i class="fa fa-power-off"></i></span><span class="cell name column-pci-name" title="{name}">{name}</span><span class="cell product column-product" title="{product}">{product}</span><span class="cell vendor column-vendor" title="{vendor}">{vendor}</span><span class="cell column-actions action-area"><button class="btn btn-link"><i class="fa"></i></button></span></div></script> <script id="snapshot-tmpl" type="text/html"> <div class="item" id="{name}"> <span class="cell column-sel"> diff --git a/ui/pages/i18n.json.tmpl b/ui/pages/i18n.json.tmpl index 4efc1ec..610debc 100644 --- a/ui/pages/i18n.json.tmpl +++ b/ui/pages/i18n.json.tmpl @@ -84,6 +84,8 @@ "KCHVMED6007M": "$_("Affected devices:")", "KCHVMED6008M": "$_("More")", "KCHVMED6009M": "$_("Less")", + "KCHVMED6010M": "$_("Successfully attached device to VM")", + "KCHVMED6011M": "$_("Successfully detached device from VM")", "KCHNET6001M": "$_("unavailable")", "KCHNET6002M": "$_("This action will interrupt network connectivity for any virtual machine that depend on this network.")", -- 1.9.3

Hello Samuel, I found something that can help, please read my comments below Thank you On Thu, Jul 21, 2016 at 05:49:35PM -0300, sguimaraes943@gmail.com wrote:
From: Samuel Guimarães <sguimaraes943@gmail.com>
This commit fixes an issue with PCI passthrough devices through Kimchi. It also addresses an enhancement to display success messages when some actions doesn't require the Save button and there's no UI feedback to the user (Issue #975).
Signed-off-by: Samuel Guimarães <sguimaraes943@gmail.com> --- model/vmhostdevs.py | 2 +- ui/css/kimchi.css | 5 + ui/css/src/modules/_edit-guests.scss | 4 + ui/js/src/kimchi.guest_edit_main.js | 236 +++++++++++++++++++++++------------ ui/js/src/kimchi.guest_main.js | 10 +- ui/pages/guest-edit.html.tmpl | 20 ++- ui/pages/i18n.json.tmpl | 2 + 7 files changed, 180 insertions(+), 99 deletions(-)
diff --git a/model/vmhostdevs.py b/model/vmhostdevs.py index 2130ac4..b57cbf0 100644 --- a/model/vmhostdevs.py +++ b/model/vmhostdevs.py @@ -510,7 +510,7 @@ class VMHostDevModel(object): return self.task.lookup(taskid)
def _detach_device(self, cb, params): - cb('Detaching device.') + cb('Detaching device') vmid = params['vmid'] dev_name = params['dev_name'] dom = params['dom'] diff --git a/ui/css/kimchi.css b/ui/css/kimchi.css index 34347c2..59d96e1 100644 --- a/ui/css/kimchi.css +++ b/ui/css/kimchi.css @@ -1039,6 +1039,11 @@ body.wok-gallery { width: 22%; }
+#guest-edit-window #form-guest-edit-pci .wok-mask { + top: 0 !important; + z-index: 2 !important; +} + #guest-edit-window #form-guest-edit-pci .column-actions { width: 4.47%; } diff --git a/ui/css/src/modules/_edit-guests.scss b/ui/css/src/modules/_edit-guests.scss index 6196ed9..b7e6941 100644 --- a/ui/css/src/modules/_edit-guests.scss +++ b/ui/css/src/modules/_edit-guests.scss @@ -62,6 +62,10 @@ } } #form-guest-edit-pci { + .wok-mask { + top: 0 !important; + z-index: 2 !important; + } .column-actions { width: 4.47%; } diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js index fc67d82..d1d6335 100644 --- a/ui/js/src/kimchi.guest_edit_main.js +++ b/ui/js/src/kimchi.guest_edit_main.js @@ -425,16 +425,16 @@ kimchi.guest_edit_main = function() { var filterPCINodes = function(group, text) { text = text.trim().split(" "); var rows = $('.body', '#form-guest-edit-pci').find('div'); - if(text === ""){ + if (text === "") { rows.show(); return; } rows.hide();
- rows.filter(function(index, value){ + rows.filter(function(index, value) { var $span = $(this); var $itemGroup = $('button i', this); - for (var i = 0; i < text.length; ++i){ + for (var i = 0; i < text.length; ++i) { if ($span.is(":containsNC('" + text[i] + "')")) { if (group === 'all') { return true; @@ -448,87 +448,26 @@ kimchi.guest_edit_main = function() { return false; }).show(); }; - var setupPCIDevice = function() { - kimchi.getAvailableHostPCIDevices(function(hostPCIs) { - kimchi.getVMPCIDevices(kimchi.selectedGuest, function(vmPCIs) { - setupNode(hostPCIs, 'fa-power-off'); - setupNode(vmPCIs, 'fa-ban'); - }); - }); - $('select', '#form-guest-edit-pci').change(function() { - filterPCINodes($(this).val(), $('input#guest-edit-pci-filter', '#form-guest-edit-pci').val()); - }); - $('select', '#form-guest-edit-pci').selectpicker(); - $('input#guest-edit-pci-filter', '#form-guest-edit-pci').on('keyup', function() { - filterPCINodes($('select', '#form-guest-edit-pci').val(), $(this).val()); - }); - }; - var setupNode = function(arrPCIDevices, iconClass) { + + var _generatePciDeviceHtml = function(devices, pciType) { var pciEnabled = kimchi.capabilities.kernel_vfio; - var pciDeviceName, pciDeviceProduct, pciDeviceProductDesc, pciDeviceVendor, pciDeviceVendorDesc, pciDeviceStatus; - for (var i = 0; i < arrPCIDevices.length; i++) { - pciDeviceName = arrPCIDevices[i].name; - pciDeviceProduct = arrPCIDevices[i].product; - pciDeviceVendor = arrPCIDevices[i].vendor; - pciDeviceStatus = (iconClass === 'fa-ban') ? 'enabled' : 'disabled'; - if (pciDeviceProduct !== null) { - pciDeviceProductDesc = pciDeviceProduct.description; - } - if (pciDeviceVendor !== null) { - pciDeviceVendorDesc = pciDeviceVendor.description; - } - var itemNode = $.parseHTML(wok.substitute($('#pci-tmpl').html(), { - status: pciDeviceStatus, - name: pciDeviceName, - product: pciDeviceProductDesc, - vendor: pciDeviceVendorDesc + var deviceHTml = devices.map(function(device, index) { + device.iconClass = (pciType === 'hostPCIs' ? 'fa-power-off' : (pciType === 'vmPCIs' ? 'fa-ban' : 'fa-power-off')); + device.status = (pciType === 'vmPCIs' ? 'enabled' : 'disabled'); + device.product = (device.product !== null ? device.product.description : ''); + device.vendor = (device.vendor !== null ? device.vendor.description : ''); + deviceHtml = $.parseHTML(wok.substitute($('#pci-tmpl').html(), { + status: device.status, + name: device.name, + product: device.product, + vendor: device.vendor })); - $('.body', '#form-guest-edit-pci').append(itemNode); - pciEnabled || $('button', itemNode).remove(); - $('button i', itemNode).addClass(iconClass); - if (kimchi.thisVMState === "running" && arrPCIDevices[i].vga3d) { - $('button', itemNode).prop("disabled", true); + pciEnabled || $('button', deviceHtml).remove(); + $('button > i', deviceHtml).addClass(device.iconClass); + if (kimchi.thisVMState === "running" && device.vga3d) { + $('button', deviceHtml).prop("disabled", true); } - $('button', itemNode).on('click', function(event) { - event.preventDefault(); - var obj = $(this); - var objIcon = obj.find('i'); - var id = obj.parent().parent().attr('id'); - if (objIcon.hasClass('fa-ban')) { - kimchi.removeVMPCIDevice(kimchi.selectedGuest, id, function() { - kimchi.getAvailableHostPCIDevices(function(arrPCIDevices) { - kimchi.getVMPCIDevices(kimchi.selectedGuest, function(vmPCIs) { - for (var k = 0; k < arrPCIDevices.length; k++) { - $('#' + arrPCIDevices[k].name + '.item').removeClass('enabled').addClass('disabled'); - $('#' + arrPCIDevices[k].name + ' .action-area button i').removeClass('fa-ban').addClass('fa-power-off'); - } - for (var k = 0; k < vmPCIs.length; k++) { - $('#' + arrPCIDevices[k].name + '.item').removeClass('disabled').addClass('enabled'); - $('#' + arrPCIDevices[k].name + ' .action-area button i').removeClass('fa-power-off').addClass('fa-ban'); - } - }); - }); - //id is for the object that is being added back to the available PCI devices - filterPCINodes($('select', '#form-guest-edit-pci').val(), $('input#guest-edit-pci-filter', '#form-guest-edit-pci').val()); - }, null); - } else { - kimchi.addVMPCIDevice(kimchi.selectedGuest, { - name: id - }, function() { - kimchi.getAvailableHostPCIDevices(function(arrPCIDevices) { - kimchi.getVMPCIDevices(kimchi.selectedGuest, function(vmPCIs) { - for (var k = 0; k < vmPCIs.length; k++) { - $('#' + vmPCIs[k].name + '.item').removeClass('disabled').addClass('enabled'); - $('#' + vmPCIs[k].name + ' .action-area button i').removeClass('fa-power-off').addClass('fa-ban'); - } - }); - }); - //id is for the object that is being removed from the available PCI devices - filterPCINodes($('select', '#form-guest-edit-pci').val(), $('input#guest-edit-pci-filter', '#form-guest-edit-pci').val()); - }, null); - } - }); - kimchi.getPCIDeviceCompanions(pciDeviceName, function(infoData) { + kimchi.getPCIDeviceCompanions(device.name, function(infoData) { var pciTitle = i18n['KCHVMED6007M'] + '\n'; var haveCompanions = false; for (var p = 0; p < infoData.length; p++) { @@ -552,9 +491,142 @@ kimchi.guest_edit_main = function() { haveCompanions && $('.vendor', '#' + infoData[q].parent).attr('title', pciTitle); } }); - } + device = deviceHtml[0].outerHTML; + $('.body', '#form-guest-edit-pci').append(device); + }); + };
You can receive the task as parameter here like 'var getOngoingAttachingDevices = function(task) {
+ var getOngoingAttachingDevices = function() { + var result = {}; + var devices = 'status=running&target_uri=' + encodeURIComponent('^/plugins/kimchi/vms/' + kimchi.selectedGuest + '/hostdevs'); + kimchi.getTasksByFilter(devices, function(tasks) { + for (var i = 0; i < tasks.length; i++) { + if (tasks[i].message === 'Attaching PCI device') { + var selectedVm = tasks[i].target_uri.split('/'); + selectedVm = selectedVm[4]; + result[selectedVm] = tasks[i]; + + if (kimchi.trackingTasks.indexOf(tasks[i].id) >= 0) { + continue; + } +
I think this code above can be removed since we can get the task id from the function argument. Suppose we call the argument 'task', we can simply pass task.id
+ kimchi.trackTask(tasks[i].id, function(result) { + kimchi.getAvailableHostPCIDevices(function(arrPCIDevices) { + kimchi.getVMPCIDevices(kimchi.selectedGuest, function(vmPCIs) { + for (var k = 0; k < vmPCIs.length; k++) { + $('#' + vmPCIs[k].name + '.item').removeClass('disabled').addClass('enabled'); + $('#' + vmPCIs[k].name + ' .action-area button i').removeClass('fa-power-off').addClass('fa-ban'); + } + }); + }); + $('#form-guest-edit-pci > .wok-mask').fadeOut(300, function() {}); + wok.message.success(i18n['KCHVMED6010M'], '#alert-modal-container'); + filterPCINodes($('select', '#form-guest-edit-pci').val(), $('input#guest-edit-pci-filter', '#form-guest-edit-pci').val()); + }, function(result) { + if (result['message']) { + var errText = result['message']; + } else { + var errText = result['responseJSON']['reason']; + } + $('#form-guest-edit-pci > .wok-mask').fadeOut(300, function() {}); + filterPCINodes($('select', '#form-guest-edit-pci').val(), $('input#guest-edit-pci-filter', '#form-guest-edit-pci').val()); + result && wok.message.error(errText, '#alert-modal-container'); + }, function(result) { + $('#form-guest-edit-pci > .wok-mask').show(); + }); + } + } + }, null, true); + }; + var getOngoingDetachingDevices = function() {
the same
+ var result = {}; + var devices = 'status=running&target_uri=' + encodeURIComponent('^/plugins/kimchi/vms/' + kimchi.selectedGuest + '/hostdevs'); + kimchi.getTasksByFilter(devices, function(tasks) { + for (var i = 0; i < tasks.length; i++) { + if (tasks[i].message === 'Detaching device') { + var selectedVm = tasks[i].target_uri.split('/'); + selectedVm = selectedVm[4]; + result[selectedVm] = tasks[i]; + + if (kimchi.trackingTasks.indexOf(tasks[i].id) >= 0) { + continue; + } + + kimchi.trackTask(tasks[i].id, function(result) { + kimchi.getAvailableHostPCIDevices(function(arrPCIDevices) { + kimchi.getVMPCIDevices(kimchi.selectedGuest, function(vmPCIs) { + for (var k = 0; k < arrPCIDevices.length; k++) { + $('#' + arrPCIDevices[k].name + '.item').removeClass('enabled').addClass('disabled'); + $('#' + arrPCIDevices[k].name + ' .action-area button i').removeClass('fa-ban').addClass('fa-power-off'); + } + for (var k = 0; k < vmPCIs.length; k++) { + $('#' + arrPCIDevices[k].name + '.item').removeClass('disabled').addClass('enabled'); + $('#' + arrPCIDevices[k].name + ' .action-area button i').removeClass('fa-power-off').addClass('fa-ban'); + } + }); + }); + $('#form-guest-edit-pci > .wok-mask').fadeOut(300, function() {}); + wok.message.success(i18n['KCHVMED6011M'], '#alert-modal-container'); + //id is for the object that is being added back to the available PCI devices + filterPCINodes($('select', '#form-guest-edit-pci').val(), $('input#guest-edit-pci-filter', '#form-guest-edit-pci').val()); + }, function(result) { + if (result['message']) { + var errText = result['message']; + } else { + var errText = result['responseJSON']['reason']; + } + $('#form-guest-edit-pci > .wok-mask').fadeOut(300, function() {}); + filterPCINodes($('select', '#form-guest-edit-pci').val(), $('input#guest-edit-pci-filter', '#form-guest-edit-pci').val()); + result && wok.message.error(errText, '#alert-modal-container'); + }, function(result) { + $('#form-guest-edit-pci > .wok-mask').show(); + }); + } + } + }, null, true); + }; + var pciDeviceButtonHandler = function() { + $('button', '#form-guest-edit-pci').on('click', function(event) { + event.preventDefault(); + var obj = $(this); + var objIcon = obj.find('i'); + var id = obj.parent().parent().attr('id'); + if (objIcon.hasClass('fa-ban')) { + kimchi.removeVMPCIDevice(kimchi.selectedGuest, id, function() {
Here you can pass the task returned by remove device, like kimchi.removeVMPCIDevice(kimchi.selectedGuest, id, function(task) { getOngoingDetachingDevices(task);
+ getOngoingDetachingDevices(); + }, function(err) { + wok.message.error(err.responseJSON.reason, '#alert-modal-container'); + }); + } else { + kimchi.addVMPCIDevice(kimchi.selectedGuest, { + name: id + }, function() {
like I said above: }, function(task) { getOngoingAttachingDevices(task); }
+ getOngoingAttachingDevices(); + }, function(err) { + wok.message.error(err.responseJSON.reason, '#alert-modal-container'); + }); + } + }); };
+ var setupPCIDevice = function() { + kimchi.getAvailableHostPCIDevices(function(hostPCIs) { + kimchi.getVMPCIDevices(kimchi.selectedGuest, function(vmPCIs) { + _generatePciDeviceHtml(hostPCIs, 'hostPCIs'); + _generatePciDeviceHtml(vmPCIs, 'vmPCIs'); + pciDeviceButtonHandler(); + $('#form-guest-edit-pci > .wok-mask').fadeOut(300, function() {}); + }); + }); + $('select', '#form-guest-edit-pci').change(function() { + filterPCINodes($(this).val(), $('input#guest-edit-pci-filter', '#form-guest-edit-pci').val()); + }); + $('select', '#form-guest-edit-pci').selectpicker(); + $('input#guest-edit-pci-filter', '#form-guest-edit-pci').on('keyup', function() { + filterPCINodes($('select', '#form-guest-edit-pci').val(), $(this).val()); + }); + }; + + var setupSnapshot = function() { var currentSnapshot; var setCurrentSnapshot = function(aSnapshot) { diff --git a/ui/js/src/kimchi.guest_main.js b/ui/js/src/kimchi.guest_main.js index 0e11aa1..605cd2d 100644 --- a/ui/js/src/kimchi.guest_main.js +++ b/ui/js/src/kimchi.guest_main.js @@ -315,7 +315,7 @@ kimchi.initClone = function() {
kimchi.listVmsAuto = function() { - $('.wok-mask').removeClass('hidden'); + $('#guests-root-container > .wok-mask').removeClass('hidden'); //Check if the actions button is opened or not, //if opended stop the reload of the itens until closed var $isDropdownOpened = $('[name="guest-actions"] ul.dropdown-menu').is(":visible"); @@ -431,13 +431,13 @@ kimchi.listVmsAuto = function() { }); }); } - $('.wok-mask').fadeOut(300, function() { + $('#guests-root-container > .wok-mask').fadeOut(300, function() { }); } else { $('.grid-control').addClass('hidden'); $('#guestListField').hide(); $('#noGuests').show(); - $('.wok-mask').fadeOut(300, function() {}); + $('#guests-root-container > .wok-mask').fadeOut(300, function() {}); } }
@@ -446,8 +446,8 @@ kimchi.listVmsAuto = function() { function(errorResponse, textStatus, errorThrown) { if (errorResponse.responseJSON && errorResponse.responseJSON.reason) { wok.message.error(errorResponse.responseJSON.reason); - $('.wok-mask').fadeOut(300, function() { - $('.wok-mask').addClass('hidden'); + $('#guests-root-container > .wok-mask').fadeOut(300, function() { + $('#guests-root-container > .wok-mask').addClass('hidden'); }); } kimchi.vmTimeout = window.setTimeout("kimchi.listVmsAuto();", 5000); diff --git a/ui/pages/guest-edit.html.tmpl b/ui/pages/guest-edit.html.tmpl index f18d42c..a9a468e 100644 --- a/ui/pages/guest-edit.html.tmpl +++ b/ui/pages/guest-edit.html.tmpl @@ -160,6 +160,14 @@ </div> <div class="body"></div> </div> + <div class="wok-mask" role="presentation" class="hidden"> + <div class="wok-mask-loader-container"> + <div class="wok-mask-loading"> + <div class="wok-mask-loading-icon"></div> + <div class="wok-mask-loading-text">$_("Loading")...</div> + </div> + </div> + </div> </form> <form role="tabpanel" id="form-guest-edit-snapshot" class="guest-edit-snapshot tab-pane"> <div class="btn-group"> @@ -273,17 +281,7 @@ <label>{val}</label> </div> </script> -<script id="pci-tmpl" type="text/html"> -<div class="item {status}" id="{name}"> - <span class="cell status column-pci-status"> - <i class="fa fa-power-off"></i> - </span> - <span class="cell name column-pci-name" title="{name}">{name}</span> - <span class="cell product column-product" title="{product}">{product}</span> - <span class="cell vendor column-vendor" title="{vendor}">{vendor}</span> - <span class="cell column-actions action-area"><button class="btn btn-link"><i class="fa"></i></button></span> -</div> -</script> +<script id="pci-tmpl" type="text/html"><div class="item {status}" id="{name}"><span class="cell status column-pci-status"><i class="fa fa-power-off"></i></span><span class="cell name column-pci-name" title="{name}">{name}</span><span class="cell product column-product" title="{product}">{product}</span><span class="cell vendor column-vendor" title="{vendor}">{vendor}</span><span class="cell column-actions action-area"><button class="btn btn-link"><i class="fa"></i></button></span></div></script> <script id="snapshot-tmpl" type="text/html"> <div class="item" id="{name}"> <span class="cell column-sel"> diff --git a/ui/pages/i18n.json.tmpl b/ui/pages/i18n.json.tmpl index 4efc1ec..610debc 100644 --- a/ui/pages/i18n.json.tmpl +++ b/ui/pages/i18n.json.tmpl @@ -84,6 +84,8 @@ "KCHVMED6007M": "$_("Affected devices:")", "KCHVMED6008M": "$_("More")", "KCHVMED6009M": "$_("Less")", + "KCHVMED6010M": "$_("Successfully attached device to VM")", + "KCHVMED6011M": "$_("Successfully detached device from VM")",
"KCHNET6001M": "$_("unavailable")", "KCHNET6002M": "$_("This action will interrupt network connectivity for any virtual machine that depend on this network.")", -- 1.9.3
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel

Almost there! =) I noticed the following: 1. Tried to attach a device 2. Task was created but it failed [alinefm@alinefm-TP440 wok]$ curl -H "Content-Type: application/json" -H "Accept: application/json" -k https://localhost:8001/plugins/kimchi/tasks/2 { "status":"failed", "message":"KCHVMHDEV0003E: No IOMMU groups found. Host PCI pass through needs IOMMU group to function correctly. Please enable Intel VT-d or AMD IOMMU in your BIOS, then verify the Kernel is compiled with IOMMU support. For Intel CPU, add 'intel_iommu=on' to GRUB_CMDLINE_LINUX parameter in /etc/default/grub file. For AMD CPU, add 'iommu=pt iommu=1'.", "id":"2", "target_uri":"/plugins/kimchi/vms/opensuse42.1/hostdevs/" }[ 3. I could see a request on /tasks?target_uri=status=running&target_uri=/plugins/kimchi/vms/*name*/hostdevs The problem is the task status is failed. So it is running nothing and no error is shown. On 07/21/2016 05:49 PM, sguimaraes943@gmail.com wrote:
From: Samuel Guimarães <sguimaraes943@gmail.com>
This commit fixes an issue with PCI passthrough devices through Kimchi. It also addresses an enhancement to display success messages when some actions doesn't require the Save button and there's no UI feedback to the user (Issue #975).
v2 - Added error callbacks for kimchi.addVMPCIDevice() and kimchi.removeVMPCIDevice() to display error messages before if starts to track ongoing tasks.
Samuel Guimarães (1): Issue #956: Unable to assign pci passthrough devices through kimchi
model/vmhostdevs.py | 2 +- ui/css/kimchi.css | 5 + ui/css/src/modules/_edit-guests.scss | 4 + ui/js/src/kimchi.guest_edit_main.js | 236 +++++++++++++++++++++++------------ ui/js/src/kimchi.guest_main.js | 10 +- ui/pages/guest-edit.html.tmpl | 20 ++- ui/pages/i18n.json.tmpl | 2 + 7 files changed, 180 insertions(+), 99 deletions(-)

I think there's a timeout issue when attaching a PCI device. The same doesn't happen when you try to detach it. The first time I try to attach the device, the browser network console shows that the 'kimchi/vms/*vm*/hostdevs' request is not finished, so for this I'll have to show the "loading" backdrop before the "process" callback starts. The problem is that by the time it runs the function getOngoingAttachingDevices() it doesn't show any result because the task already failed. Samuel -----Original Message----- From: kimchi-devel-bounces@ovirt.org [mailto:kimchi-devel-bounces@ovirt.org] On Behalf Of Aline Manera Sent: quinta-feira, 21 de julho de 2016 18:12 To: sguimaraes943@gmail.com; Kimchi Devel <kimchi-devel@ovirt.org> Subject: Re: [Kimchi-devel] [PATCH v2] [Kimchi] Issue #956: Unable to assign pci passthrough devices through kimchi Almost there! =) I noticed the following: 1. Tried to attach a device 2. Task was created but it failed [alinefm@alinefm-TP440 wok]$ curl -H "Content-Type: application/json" -H "Accept: application/json" -k https://localhost:8001/plugins/kimchi/tasks/2 { "status":"failed", "message":"KCHVMHDEV0003E: No IOMMU groups found. Host PCI pass through needs IOMMU group to function correctly. Please enable Intel VT-d or AMD IOMMU in your BIOS, then verify the Kernel is compiled with IOMMU support. For Intel CPU, add 'intel_iommu=on' to GRUB_CMDLINE_LINUX parameter in /etc/default/grub file. For AMD CPU, add 'iommu=pt iommu=1'.", "id":"2", "target_uri":"/plugins/kimchi/vms/opensuse42.1/hostdevs/" }[ 3. I could see a request on /tasks?target_uri=status=running&target_uri=/plugins/kimchi/vms/*name*/hostdevs The problem is the task status is failed. So it is running nothing and no error is shown. On 07/21/2016 05:49 PM, sguimaraes943@gmail.com wrote:
From: Samuel Guimarães <sguimaraes943@gmail.com>
This commit fixes an issue with PCI passthrough devices through Kimchi. It also addresses an enhancement to display success messages when some actions doesn't require the Save button and there's no UI feedback to the user (Issue #975).
v2 - Added error callbacks for kimchi.addVMPCIDevice() and kimchi.removeVMPCIDevice() to display error messages before if starts to track ongoing tasks.
Samuel Guimarães (1): Issue #956: Unable to assign pci passthrough devices through kimchi
model/vmhostdevs.py | 2 +- ui/css/kimchi.css | 5 + ui/css/src/modules/_edit-guests.scss | 4 + ui/js/src/kimchi.guest_edit_main.js | 236 +++++++++++++++++++++++------------ ui/js/src/kimchi.guest_main.js | 10 +- ui/pages/guest-edit.html.tmpl | 20 ++- ui/pages/i18n.json.tmpl | 2 + 7 files changed, 180 insertions(+), 99 deletions(-)
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel

When the reques tis completed, I receive some Ajax errors on the screenshots and the following output on Wok log: WOKOBJST0001E: Unable to find aedfc2e5-7cb2-4d48-9471-70d06d781e23 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find aedfc2e5-7cb2-4d48-9471-70d06d781e23 in datastore WOKOBJST0001E: Unable to find 29b4f639-ce59-4ae6-a0f1-667fddae3bb5 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 29b4f639-ce59-4ae6-a0f1-667fddae3bb5 in datastore WOKOBJST0001E: Unable to find 24b61c72-d0f8-48e7-802c-ce6aadbb05a5 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 24b61c72-d0f8-48e7-802c-ce6aadbb05a5 in datastore WOKOBJST0001E: Unable to find 3f59d60a-206c-4917-ba74-24edfc23cd36 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 3f59d60a-206c-4917-ba74-24edfc23cd36 in datastore WOKOBJST0001E: Unable to find 454edf01-8a0e-4ee4-abf7-21a49d7471f0 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 454edf01-8a0e-4ee4-abf7-21a49d7471f0 in datastore WOKOBJST0001E: Unable to find aeebc4a1-5815-423c-8a1f-a04882d81dae in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find aeebc4a1-5815-423c-8a1f-a04882d81dae in datastore WOKOBJST0001E: Unable to find 7bc8625c-8ec3-48e5-b7f7-7cf7956951b6 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 7bc8625c-8ec3-48e5-b7f7-7cf7956951b6 in datastore WOKOBJST0001E: Unable to find 2c2f4ef0-7ce0-4aad-b6c8-b891d21fbf40 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 2c2f4ef0-7ce0-4aad-b6c8-b891d21fbf40 in datastore I've added some console.log('') messages between the getOngoingAttachingDevices function to make sure that it is running and it does runs after the "/plugins/kimchi/vms/*guest*/hostdevs/" request is completed but it is too late to filter for failed devices. I can remove the filter for tasks that are running and always show the latest failure message but I don't think this should be the proper way to tackle this issue. -----Original Message----- From: kimchi-devel-bounces@ovirt.org [mailto:kimchi-devel-bounces@ovirt.org] On Behalf Of Samuel Henrique De Oliveira Guimaraes Sent: quinta-feira, 21 de julho de 2016 19:54 To: Aline Manera <alinefm@linux.vnet.ibm.com>; sguimaraes943@gmail.com; Kimchi Devel <kimchi-devel@ovirt.org> Subject: Re: [Kimchi-devel] [PATCH v2] [Kimchi] Issue #956: Unable to assign pci passthrough devices through kimchi I think there's a timeout issue when attaching a PCI device. The same doesn't happen when you try to detach it. The first time I try to attach the device, the browser network console shows that the 'kimchi/vms/*vm*/hostdevs' request is not finished, so for this I'll have to show the "loading" backdrop before the "process" callback starts. The problem is that by the time it runs the function getOngoingAttachingDevices() it doesn't show any result because the task already failed. Samuel -----Original Message----- From: kimchi-devel-bounces@ovirt.org [mailto:kimchi-devel-bounces@ovirt.org] On Behalf Of Aline Manera Sent: quinta-feira, 21 de julho de 2016 18:12 To: sguimaraes943@gmail.com; Kimchi Devel <kimchi-devel@ovirt.org> Subject: Re: [Kimchi-devel] [PATCH v2] [Kimchi] Issue #956: Unable to assign pci passthrough devices through kimchi Almost there! =) I noticed the following: 1. Tried to attach a device 2. Task was created but it failed [alinefm@alinefm-TP440 wok]$ curl -H "Content-Type: application/json" -H "Accept: application/json" -k https://localhost:8001/plugins/kimchi/tasks/2 { "status":"failed", "message":"KCHVMHDEV0003E: No IOMMU groups found. Host PCI pass through needs IOMMU group to function correctly. Please enable Intel VT-d or AMD IOMMU in your BIOS, then verify the Kernel is compiled with IOMMU support. For Intel CPU, add 'intel_iommu=on' to GRUB_CMDLINE_LINUX parameter in /etc/default/grub file. For AMD CPU, add 'iommu=pt iommu=1'.", "id":"2", "target_uri":"/plugins/kimchi/vms/opensuse42.1/hostdevs/" }[ 3. I could see a request on /tasks?target_uri=status=running&target_uri=/plugins/kimchi/vms/*name*/hostdevs The problem is the task status is failed. So it is running nothing and no error is shown. On 07/21/2016 05:49 PM, sguimaraes943@gmail.com wrote:
From: Samuel Guimarães <sguimaraes943@gmail.com>
This commit fixes an issue with PCI passthrough devices through Kimchi. It also addresses an enhancement to display success messages when some actions doesn't require the Save button and there's no UI feedback to the user (Issue #975).
v2 - Added error callbacks for kimchi.addVMPCIDevice() and kimchi.removeVMPCIDevice() to display error messages before if starts to track ongoing tasks.
Samuel Guimarães (1): Issue #956: Unable to assign pci passthrough devices through kimchi
model/vmhostdevs.py | 2 +- ui/css/kimchi.css | 5 + ui/css/src/modules/_edit-guests.scss | 4 + ui/js/src/kimchi.guest_edit_main.js | 236 +++++++++++++++++++++++------------ ui/js/src/kimchi.guest_main.js | 10 +- ui/pages/guest-edit.html.tmpl | 20 ++- ui/pages/i18n.json.tmpl | 2 + 7 files changed, 180 insertions(+), 99 deletions(-)
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel

Aline, Actually it'sa backend issue. Today we are raise exceptions but we need to call the task callback for failure instead. For example, if you do this in your _attach_pci_device() -> vmhostdevs.py: try: self._validate_pci_passthrough_env() except: cb('Failed', False) you should see the error. However, there's a number of issues that can happen in this process and we need a way to send those error to the front-end in order to be able able to display each of them accordingly. On Thu, Jul 21, 2016 at 11:21:14PM +0000, Samuel Henrique De Oliveira Guimaraes wrote:
When the reques tis completed, I receive some Ajax errors on the screenshots and the following output on Wok log:
WOKOBJST0001E: Unable to find aedfc2e5-7cb2-4d48-9471-70d06d781e23 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find aedfc2e5-7cb2-4d48-9471-70d06d781e23 in datastore WOKOBJST0001E: Unable to find 29b4f639-ce59-4ae6-a0f1-667fddae3bb5 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 29b4f639-ce59-4ae6-a0f1-667fddae3bb5 in datastore WOKOBJST0001E: Unable to find 24b61c72-d0f8-48e7-802c-ce6aadbb05a5 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 24b61c72-d0f8-48e7-802c-ce6aadbb05a5 in datastore WOKOBJST0001E: Unable to find 3f59d60a-206c-4917-ba74-24edfc23cd36 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 3f59d60a-206c-4917-ba74-24edfc23cd36 in datastore WOKOBJST0001E: Unable to find 454edf01-8a0e-4ee4-abf7-21a49d7471f0 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 454edf01-8a0e-4ee4-abf7-21a49d7471f0 in datastore WOKOBJST0001E: Unable to find aeebc4a1-5815-423c-8a1f-a04882d81dae in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find aeebc4a1-5815-423c-8a1f-a04882d81dae in datastore WOKOBJST0001E: Unable to find 7bc8625c-8ec3-48e5-b7f7-7cf7956951b6 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 7bc8625c-8ec3-48e5-b7f7-7cf7956951b6 in datastore WOKOBJST0001E: Unable to find 2c2f4ef0-7ce0-4aad-b6c8-b891d21fbf40 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 2c2f4ef0-7ce0-4aad-b6c8-b891d21fbf40 in datastore
I've added some console.log('') messages between the getOngoingAttachingDevices function to make sure that it is running and it does runs after the "/plugins/kimchi/vms/*guest*/hostdevs/" request is completed but it is too late to filter for failed devices. I can remove the filter for tasks that are running and always show the latest failure message but I don't think this should be the proper way to tackle this issue.
-----Original Message----- From: kimchi-devel-bounces@ovirt.org [mailto:kimchi-devel-bounces@ovirt.org] On Behalf Of Samuel Henrique De Oliveira Guimaraes Sent: quinta-feira, 21 de julho de 2016 19:54 To: Aline Manera <alinefm@linux.vnet.ibm.com>; sguimaraes943@gmail.com; Kimchi Devel <kimchi-devel@ovirt.org> Subject: Re: [Kimchi-devel] [PATCH v2] [Kimchi] Issue #956: Unable to assign pci passthrough devices through kimchi
I think there's a timeout issue when attaching a PCI device. The same doesn't happen when you try to detach it. The first time I try to attach the device, the browser network console shows that the 'kimchi/vms/*vm*/hostdevs' request is not finished, so for this I'll have to show the "loading" backdrop before the "process" callback starts. The problem is that by the time it runs the function getOngoingAttachingDevices() it doesn't show any result because the task already failed.
Samuel
-----Original Message----- From: kimchi-devel-bounces@ovirt.org [mailto:kimchi-devel-bounces@ovirt.org] On Behalf Of Aline Manera Sent: quinta-feira, 21 de julho de 2016 18:12 To: sguimaraes943@gmail.com; Kimchi Devel <kimchi-devel@ovirt.org> Subject: Re: [Kimchi-devel] [PATCH v2] [Kimchi] Issue #956: Unable to assign pci passthrough devices through kimchi
Almost there! =)
I noticed the following:
1. Tried to attach a device 2. Task was created but it failed
[alinefm@alinefm-TP440 wok]$ curl -H "Content-Type: application/json" -H "Accept: application/json" -k https://localhost:8001/plugins/kimchi/tasks/2 { "status":"failed", "message":"KCHVMHDEV0003E: No IOMMU groups found. Host PCI pass through needs IOMMU group to function correctly. Please enable Intel VT-d or AMD IOMMU in your BIOS, then verify the Kernel is compiled with IOMMU support. For Intel CPU, add 'intel_iommu=on' to GRUB_CMDLINE_LINUX parameter in /etc/default/grub file. For AMD CPU, add 'iommu=pt iommu=1'.", "id":"2", "target_uri":"/plugins/kimchi/vms/opensuse42.1/hostdevs/" }[
3. I could see a request on /tasks?target_uri=status=running&target_uri=/plugins/kimchi/vms/*name*/hostdevs
The problem is the task status is failed. So it is running nothing and no error is shown.
On 07/21/2016 05:49 PM, sguimaraes943@gmail.com wrote:
From: Samuel Guimarães <sguimaraes943@gmail.com>
This commit fixes an issue with PCI passthrough devices through Kimchi. It also addresses an enhancement to display success messages when some actions doesn't require the Save button and there's no UI feedback to the user (Issue #975).
v2 - Added error callbacks for kimchi.addVMPCIDevice() and kimchi.removeVMPCIDevice() to display error messages before if starts to track ongoing tasks.
Samuel Guimarães (1): Issue #956: Unable to assign pci passthrough devices through kimchi
model/vmhostdevs.py | 2 +- ui/css/kimchi.css | 5 + ui/css/src/modules/_edit-guests.scss | 4 + ui/js/src/kimchi.guest_edit_main.js | 236 +++++++++++++++++++++++------------ ui/js/src/kimchi.guest_main.js | 10 +- ui/pages/guest-edit.html.tmpl | 20 ++- ui/pages/i18n.json.tmpl | 2 + 7 files changed, 180 insertions(+), 99 deletions(-)
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel

On 07/22/2016 12:13 PM, joserz@linux.vnet.ibm.com wrote:
Aline,
Actually it'sa backend issue. Today we are raise exceptions but we need to call the task callback for failure instead.
For example, if you do this in your _attach_pci_device() -> vmhostdevs.py:
try: self._validate_pci_passthrough_env() except: cb('Failed', False)
you should see the error.
However, there's a number of issues that can happen in this process and we need a way to send those error to the front-end in order to be able able to display each of them accordingly.
Why do not _validate_pci_passthrough_env() receives cb as parameter and automatically updates the Task status?
On Thu, Jul 21, 2016 at 11:21:14PM +0000, Samuel Henrique De Oliveira Guimaraes wrote:
When the reques tis completed, I receive some Ajax errors on the screenshots and the following output on Wok log:
WOKOBJST0001E: Unable to find aedfc2e5-7cb2-4d48-9471-70d06d781e23 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find aedfc2e5-7cb2-4d48-9471-70d06d781e23 in datastore WOKOBJST0001E: Unable to find 29b4f639-ce59-4ae6-a0f1-667fddae3bb5 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 29b4f639-ce59-4ae6-a0f1-667fddae3bb5 in datastore WOKOBJST0001E: Unable to find 24b61c72-d0f8-48e7-802c-ce6aadbb05a5 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 24b61c72-d0f8-48e7-802c-ce6aadbb05a5 in datastore WOKOBJST0001E: Unable to find 3f59d60a-206c-4917-ba74-24edfc23cd36 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 3f59d60a-206c-4917-ba74-24edfc23cd36 in datastore WOKOBJST0001E: Unable to find 454edf01-8a0e-4ee4-abf7-21a49d7471f0 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 454edf01-8a0e-4ee4-abf7-21a49d7471f0 in datastore WOKOBJST0001E: Unable to find aeebc4a1-5815-423c-8a1f-a04882d81dae in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find aeebc4a1-5815-423c-8a1f-a04882d81dae in datastore WOKOBJST0001E: Unable to find 7bc8625c-8ec3-48e5-b7f7-7cf7956951b6 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 7bc8625c-8ec3-48e5-b7f7-7cf7956951b6 in datastore WOKOBJST0001E: Unable to find 2c2f4ef0-7ce0-4aad-b6c8-b891d21fbf40 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 2c2f4ef0-7ce0-4aad-b6c8-b891d21fbf40 in datastore
I've added some console.log('') messages between the getOngoingAttachingDevices function to make sure that it is running and it does runs after the "/plugins/kimchi/vms/*guest*/hostdevs/" request is completed but it is too late to filter for failed devices. I can remove the filter for tasks that are running and always show the latest failure message but I don't think this should be the proper way to tackle this issue.
-----Original Message----- From: kimchi-devel-bounces@ovirt.org [mailto:kimchi-devel-bounces@ovirt.org] On Behalf Of Samuel Henrique De Oliveira Guimaraes Sent: quinta-feira, 21 de julho de 2016 19:54 To: Aline Manera <alinefm@linux.vnet.ibm.com>; sguimaraes943@gmail.com; Kimchi Devel <kimchi-devel@ovirt.org> Subject: Re: [Kimchi-devel] [PATCH v2] [Kimchi] Issue #956: Unable to assign pci passthrough devices through kimchi
I think there's a timeout issue when attaching a PCI device. The same doesn't happen when you try to detach it. The first time I try to attach the device, the browser network console shows that the 'kimchi/vms/*vm*/hostdevs' request is not finished, so for this I'll have to show the "loading" backdrop before the "process" callback starts. The problem is that by the time it runs the function getOngoingAttachingDevices() it doesn't show any result because the task already failed.
Samuel
-----Original Message----- From: kimchi-devel-bounces@ovirt.org [mailto:kimchi-devel-bounces@ovirt.org] On Behalf Of Aline Manera Sent: quinta-feira, 21 de julho de 2016 18:12 To: sguimaraes943@gmail.com; Kimchi Devel <kimchi-devel@ovirt.org> Subject: Re: [Kimchi-devel] [PATCH v2] [Kimchi] Issue #956: Unable to assign pci passthrough devices through kimchi
Almost there! =)
I noticed the following:
1. Tried to attach a device 2. Task was created but it failed
[alinefm@alinefm-TP440 wok]$ curl -H "Content-Type: application/json" -H "Accept: application/json" -k https://localhost:8001/plugins/kimchi/tasks/2 { "status":"failed", "message":"KCHVMHDEV0003E: No IOMMU groups found. Host PCI pass through needs IOMMU group to function correctly. Please enable Intel VT-d or AMD IOMMU in your BIOS, then verify the Kernel is compiled with IOMMU support. For Intel CPU, add 'intel_iommu=on' to GRUB_CMDLINE_LINUX parameter in /etc/default/grub file. For AMD CPU, add 'iommu=pt iommu=1'.", "id":"2", "target_uri":"/plugins/kimchi/vms/opensuse42.1/hostdevs/" }[
3. I could see a request on /tasks?target_uri=status=running&target_uri=/plugins/kimchi/vms/*name*/hostdevs
The problem is the task status is failed. So it is running nothing and no error is shown.
On 07/21/2016 05:49 PM, sguimaraes943@gmail.com wrote:
From: Samuel Guimarães <sguimaraes943@gmail.com>
This commit fixes an issue with PCI passthrough devices through Kimchi. It also addresses an enhancement to display success messages when some actions doesn't require the Save button and there's no UI feedback to the user (Issue #975).
v2 - Added error callbacks for kimchi.addVMPCIDevice() and kimchi.removeVMPCIDevice() to display error messages before if starts to track ongoing tasks.
Samuel Guimarães (1): Issue #956: Unable to assign pci passthrough devices through kimchi
model/vmhostdevs.py | 2 +- ui/css/kimchi.css | 5 + ui/css/src/modules/_edit-guests.scss | 4 + ui/js/src/kimchi.guest_edit_main.js | 236 +++++++++++++++++++++++------------ ui/js/src/kimchi.guest_main.js | 10 +- ui/pages/guest-edit.html.tmpl | 20 ++- ui/pages/i18n.json.tmpl | 2 + 7 files changed, 180 insertions(+), 99 deletions(-)
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel

On Fri, Jul 22, 2016 at 12:38:59PM -0300, Aline Manera wrote:
On 07/22/2016 12:13 PM, joserz@linux.vnet.ibm.com wrote:
Aline,
Actually it'sa backend issue. Today we are raise exceptions but we need to call the task callback for failure instead.
For example, if you do this in your _attach_pci_device() -> vmhostdevs.py:
try: self._validate_pci_passthrough_env() except: cb('Failed', False)
you should see the error.
However, there's a number of issues that can happen in this process and we need a way to send those error to the front-end in order to be able able to display each of them accordingly.
Why do not _validate_pci_passthrough_env() receives cb as parameter and automatically updates the Task status?
I meant that we need to send the translated error message for any error to the frontend. I'll send a patch for that. @Samuel, can you confirm if your code displays the message from the backend in case of failure? Thank you
On Thu, Jul 21, 2016 at 11:21:14PM +0000, Samuel Henrique De Oliveira Guimaraes wrote:
When the reques tis completed, I receive some Ajax errors on the screenshots and the following output on Wok log:
WOKOBJST0001E: Unable to find aedfc2e5-7cb2-4d48-9471-70d06d781e23 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find aedfc2e5-7cb2-4d48-9471-70d06d781e23 in datastore WOKOBJST0001E: Unable to find 29b4f639-ce59-4ae6-a0f1-667fddae3bb5 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 29b4f639-ce59-4ae6-a0f1-667fddae3bb5 in datastore WOKOBJST0001E: Unable to find 24b61c72-d0f8-48e7-802c-ce6aadbb05a5 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 24b61c72-d0f8-48e7-802c-ce6aadbb05a5 in datastore WOKOBJST0001E: Unable to find 3f59d60a-206c-4917-ba74-24edfc23cd36 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 3f59d60a-206c-4917-ba74-24edfc23cd36 in datastore WOKOBJST0001E: Unable to find 454edf01-8a0e-4ee4-abf7-21a49d7471f0 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 454edf01-8a0e-4ee4-abf7-21a49d7471f0 in datastore WOKOBJST0001E: Unable to find aeebc4a1-5815-423c-8a1f-a04882d81dae in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find aeebc4a1-5815-423c-8a1f-a04882d81dae in datastore WOKOBJST0001E: Unable to find 7bc8625c-8ec3-48e5-b7f7-7cf7956951b6 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 7bc8625c-8ec3-48e5-b7f7-7cf7956951b6 in datastore WOKOBJST0001E: Unable to find 2c2f4ef0-7ce0-4aad-b6c8-b891d21fbf40 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 2c2f4ef0-7ce0-4aad-b6c8-b891d21fbf40 in datastore
I've added some console.log('') messages between the getOngoingAttachingDevices function to make sure that it is running and it does runs after the "/plugins/kimchi/vms/*guest*/hostdevs/" request is completed but it is too late to filter for failed devices. I can remove the filter for tasks that are running and always show the latest failure message but I don't think this should be the proper way to tackle this issue.
-----Original Message----- From: kimchi-devel-bounces@ovirt.org [mailto:kimchi-devel-bounces@ovirt.org] On Behalf Of Samuel Henrique De Oliveira Guimaraes Sent: quinta-feira, 21 de julho de 2016 19:54 To: Aline Manera <alinefm@linux.vnet.ibm.com>; sguimaraes943@gmail.com; Kimchi Devel <kimchi-devel@ovirt.org> Subject: Re: [Kimchi-devel] [PATCH v2] [Kimchi] Issue #956: Unable to assign pci passthrough devices through kimchi
I think there's a timeout issue when attaching a PCI device. The same doesn't happen when you try to detach it. The first time I try to attach the device, the browser network console shows that the 'kimchi/vms/*vm*/hostdevs' request is not finished, so for this I'll have to show the "loading" backdrop before the "process" callback starts. The problem is that by the time it runs the function getOngoingAttachingDevices() it doesn't show any result because the task already failed.
Samuel
-----Original Message----- From: kimchi-devel-bounces@ovirt.org [mailto:kimchi-devel-bounces@ovirt.org] On Behalf Of Aline Manera Sent: quinta-feira, 21 de julho de 2016 18:12 To: sguimaraes943@gmail.com; Kimchi Devel <kimchi-devel@ovirt.org> Subject: Re: [Kimchi-devel] [PATCH v2] [Kimchi] Issue #956: Unable to assign pci passthrough devices through kimchi
Almost there! =)
I noticed the following:
1. Tried to attach a device 2. Task was created but it failed
[alinefm@alinefm-TP440 wok]$ curl -H "Content-Type: application/json" -H "Accept: application/json" -k https://localhost:8001/plugins/kimchi/tasks/2 { "status":"failed", "message":"KCHVMHDEV0003E: No IOMMU groups found. Host PCI pass through needs IOMMU group to function correctly. Please enable Intel VT-d or AMD IOMMU in your BIOS, then verify the Kernel is compiled with IOMMU support. For Intel CPU, add 'intel_iommu=on' to GRUB_CMDLINE_LINUX parameter in /etc/default/grub file. For AMD CPU, add 'iommu=pt iommu=1'.", "id":"2", "target_uri":"/plugins/kimchi/vms/opensuse42.1/hostdevs/" }[
3. I could see a request on /tasks?target_uri=status=running&target_uri=/plugins/kimchi/vms/*name*/hostdevs
The problem is the task status is failed. So it is running nothing and no error is shown.
On 07/21/2016 05:49 PM, sguimaraes943@gmail.com wrote:
From: Samuel Guimarães <sguimaraes943@gmail.com>
This commit fixes an issue with PCI passthrough devices through Kimchi. It also addresses an enhancement to display success messages when some actions doesn't require the Save button and there's no UI feedback to the user (Issue #975).
v2 - Added error callbacks for kimchi.addVMPCIDevice() and kimchi.removeVMPCIDevice() to display error messages before if starts to track ongoing tasks.
Samuel Guimarães (1): Issue #956: Unable to assign pci passthrough devices through kimchi
model/vmhostdevs.py | 2 +- ui/css/kimchi.css | 5 + ui/css/src/modules/_edit-guests.scss | 4 + ui/js/src/kimchi.guest_edit_main.js | 236 +++++++++++++++++++++++------------ ui/js/src/kimchi.guest_main.js | 10 +- ui/pages/guest-edit.html.tmpl | 20 ++- ui/pages/i18n.json.tmpl | 2 + 7 files changed, 180 insertions(+), 99 deletions(-)
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel

-----Original Message----- From: joserz@linux.vnet.ibm.com [mailto:joserz@linux.vnet.ibm.com] Sent: sexta-feira, 22 de julho de 2016 13:04 To: Aline Manera <alinefm@linux.vnet.ibm.com> Cc: Samuel Henrique De Oliveira Guimaraes <samuel.guimaraes@eldorado.org.br>; sguimaraes943@gmail.com; Kimchi Devel <kimchi-devel@ovirt.org> Subject: Re: [Kimchi-devel] [PATCH v2] [Kimchi] Issue #956: Unable to assign pci passthrough devices through kimchi On Fri, Jul 22, 2016 at 12:38:59PM -0300, Aline Manera wrote:
On 07/22/2016 12:13 PM, joserz@linux.vnet.ibm.com wrote:
Aline,
Actually it'sa backend issue. Today we are raise exceptions but we need to call the task callback for failure instead.
For example, if you do this in your _attach_pci_device() -> vmhostdevs.py:
try: self._validate_pci_passthrough_env() except: cb('Failed', False)
you should see the error.
However, there's a number of issues that can happen in this process and we need a way to send those error to the front-end in order to be able able to display each of them accordingly.
Why do not _validate_pci_passthrough_env() receives cb as parameter and automatically updates the Task status?
I meant that we need to send the translated error message for any error to the frontend. I'll send a patch for that. @Samuel, can you confirm if your code displays the message from the backend in case of failure? The V2 now shows error message for both addVMPCIDevice() and removeVMPCIDevice() requests if they fail before creating a new task. If a task is created, once it is captured in the state "running" it will loop until it changes its status to "finished" or "failed". In case it fails, it will copy the task message and display as an error alert. Thank you
On Thu, Jul 21, 2016 at 11:21:14PM +0000, Samuel Henrique De Oliveira Guimaraes wrote:
When the reques tis completed, I receive some Ajax errors on the screenshots and the following output on Wok log:
WOKOBJST0001E: Unable to find aedfc2e5-7cb2-4d48-9471-70d06d781e23 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find aedfc2e5-7cb2-4d48-9471-70d06d781e23 in datastore WOKOBJST0001E: Unable to find 29b4f639-ce59-4ae6-a0f1-667fddae3bb5 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 29b4f639-ce59-4ae6-a0f1-667fddae3bb5 in datastore WOKOBJST0001E: Unable to find 24b61c72-d0f8-48e7-802c-ce6aadbb05a5 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 24b61c72-d0f8-48e7-802c-ce6aadbb05a5 in datastore WOKOBJST0001E: Unable to find 3f59d60a-206c-4917-ba74-24edfc23cd36 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 3f59d60a-206c-4917-ba74-24edfc23cd36 in datastore WOKOBJST0001E: Unable to find 454edf01-8a0e-4ee4-abf7-21a49d7471f0 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 454edf01-8a0e-4ee4-abf7-21a49d7471f0 in datastore WOKOBJST0001E: Unable to find aeebc4a1-5815-423c-8a1f-a04882d81dae in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find aeebc4a1-5815-423c-8a1f-a04882d81dae in datastore WOKOBJST0001E: Unable to find 7bc8625c-8ec3-48e5-b7f7-7cf7956951b6 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 7bc8625c-8ec3-48e5-b7f7-7cf7956951b6 in datastore WOKOBJST0001E: Unable to find 2c2f4ef0-7ce0-4aad-b6c8-b891d21fbf40 in datastore ERROR:cherrypy.error:WOKOBJST0001E: Unable to find 2c2f4ef0-7ce0-4aad-b6c8-b891d21fbf40 in datastore
I've added some console.log('') messages between the getOngoingAttachingDevices function to make sure that it is running and it does runs after the "/plugins/kimchi/vms/*guest*/hostdevs/" request is completed but it is too late to filter for failed devices. I can remove the filter for tasks that are running and always show the latest failure message but I don't think this should be the proper way to tackle this issue.
-----Original Message----- From: kimchi-devel-bounces@ovirt.org [mailto:kimchi-devel-bounces@ovirt.org] On Behalf Of Samuel Henrique De Oliveira Guimaraes Sent: quinta-feira, 21 de julho de 2016 19:54 To: Aline Manera <alinefm@linux.vnet.ibm.com>; sguimaraes943@gmail.com; Kimchi Devel <kimchi-devel@ovirt.org> Subject: Re: [Kimchi-devel] [PATCH v2] [Kimchi] Issue #956: Unable to assign pci passthrough devices through kimchi
I think there's a timeout issue when attaching a PCI device. The same doesn't happen when you try to detach it. The first time I try to attach the device, the browser network console shows that the 'kimchi/vms/*vm*/hostdevs' request is not finished, so for this I'll have to show the "loading" backdrop before the "process" callback starts. The problem is that by the time it runs the function getOngoingAttachingDevices() it doesn't show any result because the task already failed.
Samuel
-----Original Message----- From: kimchi-devel-bounces@ovirt.org [mailto:kimchi-devel-bounces@ovirt.org] On Behalf Of Aline Manera Sent: quinta-feira, 21 de julho de 2016 18:12 To: sguimaraes943@gmail.com; Kimchi Devel <kimchi-devel@ovirt.org> Subject: Re: [Kimchi-devel] [PATCH v2] [Kimchi] Issue #956: Unable to assign pci passthrough devices through kimchi
Almost there! =)
I noticed the following:
1. Tried to attach a device 2. Task was created but it failed
[alinefm@alinefm-TP440 wok]$ curl -H "Content-Type: application/json" -H "Accept: application/json" -k https://localhost:8001/plugins/kimchi/tasks/2 { "status":"failed", "message":"KCHVMHDEV0003E: No IOMMU groups found. Host PCI pass through needs IOMMU group to function correctly. Please enable Intel VT-d or AMD IOMMU in your BIOS, then verify the Kernel is compiled with IOMMU support. For Intel CPU, add 'intel_iommu=on' to GRUB_CMDLINE_LINUX parameter in /etc/default/grub file. For AMD CPU, add 'iommu=pt iommu=1'.", "id":"2", "target_uri":"/plugins/kimchi/vms/opensuse42.1/hostdevs/" }[
3. I could see a request on /tasks?target_uri=status=running&target_uri=/plugins/kimchi/vms/*nam e*/hostdevs
The problem is the task status is failed. So it is running nothing and no error is shown.
On 07/21/2016 05:49 PM, sguimaraes943@gmail.com wrote:
From: Samuel Guimarães <sguimaraes943@gmail.com>
This commit fixes an issue with PCI passthrough devices through Kimchi. It also addresses an enhancement to display success messages when some actions doesn't require the Save button and there's no UI feedback to the user (Issue #975).
v2 - Added error callbacks for kimchi.addVMPCIDevice() and kimchi.removeVMPCIDevice() to display error messages before if starts to track ongoing tasks.
Samuel Guimarães (1): Issue #956: Unable to assign pci passthrough devices through kimchi
model/vmhostdevs.py | 2 +- ui/css/kimchi.css | 5 + ui/css/src/modules/_edit-guests.scss | 4 + ui/js/src/kimchi.guest_edit_main.js | 236 +++++++++++++++++++++++------------ ui/js/src/kimchi.guest_main.js | 10 +- ui/pages/guest-edit.html.tmpl | 20 ++- ui/pages/i18n.json.tmpl | 2 + 7 files changed, 180 insertions(+), 99 deletions(-)
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel
participants (4)
-
Aline Manera
-
joserz@linux.vnet.ibm.com
-
Samuel Henrique De Oliveira Guimaraes
-
sguimaraes943@gmail.com