[Kimchi-devel] [PATCH] [Kimchi] Show error message for untracked and failed cloning tasks
Paulo Ricardo Paz Vital
pvital at linux.vnet.ibm.com
Wed Jul 13 16:35:10 UTC 2016
Reviewed-by: Paulo Ricardo Paz Vital <pvital at linux.vnet.ibm.com>
On Jul 08 04:46PM, Lucio Correia wrote:
> When the asynchronous task for the cloning of a guest fails
> too early, the task is not tracked by listVmsAuto(), which
> does it only for 'running' tasks. Consequently, the error
> message is not showed to the user.
>
> Signed-off-by: Lucio Correia <luciojhc at linux.vnet.ibm.com>
> ---
> ui/js/src/kimchi.guest_main.js | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/ui/js/src/kimchi.guest_main.js b/ui/js/src/kimchi.guest_main.js
> index 8e12fb2..0e11aa1 100644
> --- a/ui/js/src/kimchi.guest_main.js
> +++ b/ui/js/src/kimchi.guest_main.js
> @@ -360,6 +360,17 @@ kimchi.listVmsAuto = function() {
> return guests;
> };
>
> + var trackFailedCloningGuests = function() {
> + kimchi.getTasksByFilter('status=failed&target_uri=' + encodeURIComponent('^/plugins/kimchi/vms/.+/clone'), function(tasks) {
> + for (var i = 0; i < tasks.length; i++) {
> + if (kimchi.trackingTasks.indexOf(tasks[i].id) == -1)
> + kimchi.trackTask(tasks[i].id, null, function(err) {
> + wok.message.error(err.message);
> + }, null);
> + }
> + }, null, true);
> + };
> +
> var getMigratingGuests = function() {
> var guests = [];
> kimchi.getTasksByFilter('status=running&target_uri=' + encodeURIComponent('^/plugins/kimchi/vms/.+/migrate'), function(tasks) {
> @@ -381,7 +392,9 @@ kimchi.listVmsAuto = function() {
>
> kimchi.listVMs(function(result, textStatus, jqXHR) {
> if (result && textStatus == "success") {
> -
> + // Some clone tasks may fail before being tracked. Show
> + // error message for them.
> + trackFailedCloningGuests();
> var migrated = getMigratingGuests();
> for (i = migrated.length - 1; i >= 0; i--) {
> for (j = result.length - 1; j >= 0; j--) {
> --
> 1.9.1
>
> _______________________________________________
> Kimchi-devel mailing list
> Kimchi-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/kimchi-devel
>
--
Paulo Ricardo Paz Vital
Linux Technology Center, IBM Systems
http://www.ibm.com/linux/ltc/
More information about the Kimchi-devel
mailing list