mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-2236: UI - Instances menu - migrate instance to another host - get requiresStorageMotion property from selected option instead of first option from host dropdown.
This commit is contained in:
parent
933e4e6dff
commit
31b9fea5e7
@ -15,7 +15,7 @@
|
|||||||
// specific language governing permissions and limitations
|
// specific language governing permissions and limitations
|
||||||
// under the License.
|
// under the License.
|
||||||
(function($, cloudStack) {
|
(function($, cloudStack) {
|
||||||
var requiresStorageMotion = false;
|
var vmMigrationHostObjs;
|
||||||
cloudStack.sections.instances = {
|
cloudStack.sections.instances = {
|
||||||
title: 'label.instances',
|
title: 'label.instances',
|
||||||
id: 'instances',
|
id: 'instances',
|
||||||
@ -1079,30 +1079,26 @@
|
|||||||
select: function(args) {
|
select: function(args) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: createURL("findHostsForMigration&VirtualMachineId=" + args.context.instances[0].id),
|
url: createURL("findHostsForMigration&VirtualMachineId=" + args.context.instances[0].id),
|
||||||
//url: createURL("listHosts"), //for testing only, comment it out before checking in.
|
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
async: true,
|
async: true,
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
if(json.findhostsformigrationresponse.host != undefined) {
|
if(json.findhostsformigrationresponse.host != undefined) {
|
||||||
var hosts = json.findhostsformigrationresponse.host;
|
vmMigrationHostObjs = json.findhostsformigrationresponse.host;
|
||||||
requiresStorageMotion = json.findhostsformigrationresponse.host[0].requiresStorageMotion;
|
|
||||||
var items = [];
|
var items = [];
|
||||||
$(hosts).each(function() {
|
$(vmMigrationHostObjs).each(function() {
|
||||||
if(this.requiresStorageMotion == true){
|
if(this.requiresStorageMotion == true){
|
||||||
items.push({id: this.id, description: (this.name + " (" + (this.suitableformigration? "Suitable, ": "Not Suitable, ") + "Storage migration required)" )});
|
items.push({id: this.id, description: (this.name + " (" + (this.suitableformigration? "Suitable, ": "Not Suitable, ") + "Storage migration required)" )});
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
items.push({id: this.id, description: (this.name + " (" + (this.suitableformigration? "Suitable": "Not Suitable") + ")" )});
|
items.push({id: this.id, description: (this.name + " (" + (this.suitableformigration? "Suitable": "Not Suitable") + ")" )});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
args.response.success({data: items});
|
args.response.success({data: items});
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
cloudStack.dialog.notice({ message: _l('No Hosts are avaialble for Migration') }); //Only a single host in the set up
|
cloudStack.dialog.notice({ message: _l('No Hosts are avaialble for Migration') }); //Only a single host in the set up
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1110,8 +1106,19 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
action: function(args) {
|
action: function(args) {
|
||||||
|
var selectedHostObj;
|
||||||
|
if(vmMigrationHostObjs != null) {
|
||||||
|
for(var i = 0; i < vmMigrationHostObjs.length; i++) {
|
||||||
|
if(vmMigrationHostObjs[i].id == args.data.hostId) {
|
||||||
|
selectedHostObj = vmMigrationHostObjs[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(selectedHostObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(requiresStorageMotion == true){
|
if(selectedHostObj.requiresStorageMotion == true){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: createURL("migrateVirtualMachineWithVolume&hostid=" + args.data.hostId + "&virtualmachineid=" + args.context.instances[0].id),
|
url: createURL("migrateVirtualMachineWithVolume&hostid=" + args.data.hostId + "&virtualmachineid=" + args.context.instances[0].id),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
@ -1154,7 +1161,6 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
notification: {
|
notification: {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user