You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ts...@apache.org on 2013/04/21 19:03:34 UTC
[23/49] git commit: updated refs/heads/marvin_refactor to 0b5fe9a
Storage Motion UI development
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/fc4f19f9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/fc4f19f9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/fc4f19f9
Branch: refs/heads/marvin_refactor
Commit: fc4f19f915e8edc5ccc0076122fb20c19ad2646a
Parents: 59bee8d
Author: Pranav Saxena <pr...@citrix.com>
Authored: Fri Apr 19 18:27:07 2013 +0530
Committer: Pranav Saxena <pr...@citrix.com>
Committed: Fri Apr 19 18:27:07 2013 +0530
----------------------------------------------------------------------
ui/css/cloudstack3.css | 11 ++++++
ui/scripts/instances.js | 64 ++++++++++++++++++++++++++-----------
ui/scripts/storage.js | 73 +++++++++++++++++++++++++++++++++++++++++-
3 files changed, 128 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fc4f19f9/ui/css/cloudstack3.css
----------------------------------------------------------------------
diff --git a/ui/css/cloudstack3.css b/ui/css/cloudstack3.css
index d4c670c..b971cbf 100644
--- a/ui/css/cloudstack3.css
+++ b/ui/css/cloudstack3.css
@@ -11603,6 +11603,17 @@ div.ui-dialog div.autoscaler div.field-group div.form-container form div.form-it
background-position: 0px -707px;
}
+.migrate .icon,
+.migrateVolume .icon {
+ background-position: 0px -125px;
+}
+
+.migrate:hover .icon,
+.migrateVolume:hover .icon {
+ background-position: 0px -707px;
+}
+
+
.attach .icon,
.attachISO .icon,
.attachDisk .icon {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fc4f19f9/ui/scripts/instances.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js
index b2d9dde..bd8b7f6 100644
--- a/ui/scripts/instances.js
+++ b/ui/scripts/instances.js
@@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.
(function($, cloudStack) {
+ var requiresStorageMotion = false;
cloudStack.sections.instances = {
title: 'label.instances',
id: 'instances',
@@ -958,17 +959,31 @@
validation: { required: true },
select: function(args) {
$.ajax({
- url: createURL("listHosts&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",
async: true,
success: function(json) {
- var hosts = json.listhostsresponse.host;
+ if(json.findhostsformigrationresponse.host != undefined){
+ var hosts = json.findhostsformigrationresponse.host;
+ requiresStorageMotion = json.findhostsformigrationresponse.host[0].requiresStorageMotion;
var items = [];
$(hosts).each(function() {
- items.push({id: this.id, description: (this.name + " (" + (this.suitableformigration? "Suitable": "Not Suitable") + ")")});
- });
+ if(this.requiresStorageMotion == true){
+ items.push({id: this.id, description: (this.name + " (" + (this.suitableformigration? "Suitable, ": "Not Suitable, ") + "Storage migration required)" )});
+
+ }
+ else {
+
+ items.push({id: this.id, description: (this.name + " (" + (this.suitableformigration? "Suitable": "Not Suitable") + ")" )});
+
+ }
+ });
args.response.success({data: items});
+ }
+ else
+ cloudStack.dialog.notice({ message: _l('No Hosts are avaialble for Migration') }); //Only a single host in the set up
+
}
});
}
@@ -976,7 +991,31 @@
}
},
action: function(args) {
+
+ if(requiresStorageMotion == true){
$.ajax({
+ url: createURL("migrateVirtualMachineWithVolume&hostid=" + args.data.hostId + "&virtualmachineid=" + args.context.instances[0].id),
+ dataType: "json",
+ async: true,
+ success: function(json) {
+ var jid = json.migratevirtualmachinewithvolumeresponse.jobid;
+ args.response.success(
+ {_custom:
+ {jobId: jid,
+ getUpdatedItem: function(json) {
+ return json.queryasyncjobresultresponse.jobresult.virtualmachine;
+ },
+ getActionFilter: function() {
+ return vmActionfilter;
+ }
+ }
+ }
+ );
+ }
+ });
+ }
+ else{
+ $.ajax({
url: createURL("migrateVirtualMachine&hostid=" + args.data.hostId + "&virtualmachineid=" + args.context.instances[0].id),
dataType: "json",
async: true,
@@ -987,21 +1026,6 @@
{jobId: jid,
getUpdatedItem: function(json) {
return json.queryasyncjobresultresponse.jobresult.virtualmachine;
- /*
- var vmObj;
- $.ajax({
- url: createURL("listVirtualMachines&id=" + args.context.instances[0].id),
- dataType: "json",
- async: false,
- success: function(json) {
- var items = json.listvirtualmachinesresponse.virtualmachine;
- if(items != null && items.length > 0) {
- vmObj = items[0];
- }
- }
- });
- return vmObj;
- */
},
getActionFilter: function() {
return vmActionfilter;
@@ -1011,6 +1035,8 @@
);
}
});
+
+ }
},
notification: {
poll: pollAsyncJobResult
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fc4f19f9/ui/scripts/storage.js
----------------------------------------------------------------------
diff --git a/ui/scripts/storage.js b/ui/scripts/storage.js
index 54605e2..8fd9594 100644
--- a/ui/scripts/storage.js
+++ b/ui/scripts/storage.js
@@ -395,6 +395,69 @@
name: 'Volume details',
viewAll: { path: 'storage.snapshots', label: 'label.snapshots' },
actions: {
+
+ migrateVolume:{
+ label:'Migrate Volume',
+ messages: {
+ confirm: function(args) {
+ return 'Do you want to migrate this volume ?' ;
+ },
+ notification: function(args) {
+ return 'Volume migrated';
+ }
+ },
+
+ createForm: {
+ title: 'Migrate Volume',
+ desc: '',
+ fields: {
+ storagePool: {
+ label: 'Storage Pool',
+ validation: { required: true },
+ select: function(args) {
+ $.ajax({
+ url: createURL("findStoragePoolsForMigration&id=" + args.context.volumes[0].id),
+ dataType: "json",
+ async: true,
+ success: function(json) {
+ var pools = json.findstoragepoolsformigrationresponse.storagepool;
+ var items = [];
+ $(pools).each(function() {
+ items.push({id: this.id, description: this.name + " (" + (this.suitableformigration? "Suitable": "Not Suitable")+")" });
+ });
+ args.response.success({data: items});
+
+ }
+ });
+ }
+ }
+ }
+
+ },
+
+ action: function(args) {
+ $.ajax({
+ url: createURL("migrateVolume&livemigrate=true&storageid=" + args.data.storagePool + "&volumeid=" + args.context.volumes[0].id ),
+ dataType: "json",
+ async: true,
+ success: function(json) {
+ var jid = json.migratevolumeresponse.jobid;
+ args.response.success(
+ {_custom:
+ {
+ jobId: jid
+ }
+ }
+ );
+ }
+ });
+ },
+ notification: {
+ poll: pollAsyncJobResult
+ }
+
+ },
+
takeSnapshot: {
label: 'label.action.take.snapshot',
messages: {
@@ -961,7 +1024,7 @@
},
action: function(args) {
$.ajax({
- url: createURL("migrateVolume&storageid=" + args.data.storageId + "&volumeid=" + args.context.volumes[0].id),
+ url: createURL("migrateVolume&storageid=" + args.data.storagePool + "&volumeid=" + args.context.volumes[0].id),
dataType: "json",
async: true,
success: function(json) {
@@ -1538,6 +1601,7 @@
var jsonObj = args.context.item;
var allowedActions = [];
+
if (jsonObj.state == 'Destroyed' || jsonObj.state == 'Migrating' || jsonObj.state == 'Uploading') {
return [];
}
@@ -1557,6 +1621,13 @@
allowedActions.push("downloadVolume");
}
}
+
+ if(jsonObj.type == "ROOT" || jsonObj.type =="DATADISK"){
+ if(jsonObj.state == "Ready" && isAdmin() && jsonObj.virtualmachineid != null ){
+ allowedActions.push("migrateVolume");
+ }
+ }
+
if(jsonObj.state != "Creating") {
if(jsonObj.type == "ROOT") {
if (jsonObj.vmstate == "Stopped") {