diff --git a/src/oca/ruby/opennebula/host.rb b/src/oca/ruby/opennebula/host.rb index 893ed25926..ba7459dc91 100644 --- a/src/oca/ruby/opennebula/host.rb +++ b/src/oca/ruby/opennebula/host.rb @@ -217,6 +217,7 @@ module OpenNebula return rc if OpenNebula.is_error?(rc) vm.deploy(id, false) + return vm.id end ####################################################################### diff --git a/src/sunstone/models/OpenNebulaJSON/HostJSON.rb b/src/sunstone/models/OpenNebulaJSON/HostJSON.rb index 0768e154e5..5c6cf0db47 100644 --- a/src/sunstone/models/OpenNebulaJSON/HostJSON.rb +++ b/src/sunstone/models/OpenNebulaJSON/HostJSON.rb @@ -73,7 +73,12 @@ module OpenNebulaJSON end def import_wild(params=Hash.new) - super(params['name']) + rc = super(params['name']) + if OpenNebula.is_error?(rc) + return rc + else + return VirtualMachineJSON.new_with_id(rc, @client) + end end end end diff --git a/src/sunstone/models/SunstoneServer.rb b/src/sunstone/models/SunstoneServer.rb index 8ec3c85a5b..fe9ad56ec2 100644 --- a/src/sunstone/models/SunstoneServer.rb +++ b/src/sunstone/models/SunstoneServer.rb @@ -206,7 +206,11 @@ class SunstoneServer < CloudServer if OpenNebula.is_error?(rc) return [500, rc.to_json] else - return [204, resource.to_json] + if rc.nil? + return [204, resource.to_json] + else + return [201, rc.to_json] + end end end diff --git a/src/sunstone/public/app/opennebula/action.js b/src/sunstone/public/app/opennebula/action.js index c1b6cd02d2..829a28f989 100644 --- a/src/sunstone/public/app/opennebula/action.js +++ b/src/sunstone/public/app/opennebula/action.js @@ -53,10 +53,10 @@ define(function(require) { type: "POST", contentType: "application/json; charset=utf-8", data: JSON.stringify(action), - success: function() { + success: function(response) { _clearCache(cache_name); - return callback ? callback(request) : null; + return callback ? callback(request, response) : null; }, error: function(response) { return callbackError ? diff --git a/src/sunstone/public/app/tabs/hosts-tab/panels/wilds.js b/src/sunstone/public/app/tabs/hosts-tab/panels/wilds.js index c61058f94d..8455ba932a 100644 --- a/src/sunstone/public/app/tabs/hosts-tab/panels/wilds.js +++ b/src/sunstone/public/app/tabs/hosts-tab/panels/wilds.js @@ -151,7 +151,7 @@ define(function(require) { data: dataJSON, success: function(request, response) { OpenNebulaAction.clear_cache("VM"); - // TODO Notifier.notifyCustom(Locale.tr("VM imported"), " ID: " + response.VM.ID, false); + Notifier.notifyCustom(Locale.tr("VM imported"), " ID: " + response.VM.ID, false); // Delete row (shouldn't be there in next monitorization) that.dataTableWildHosts.fnDeleteRow(wild_row);