Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 674DB10C65 for ; Mon, 22 Apr 2013 21:03:27 +0000 (UTC) Received: (qmail 19787 invoked by uid 500); 22 Apr 2013 21:03:27 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 19731 invoked by uid 500); 22 Apr 2013 21:03:27 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 19603 invoked by uid 99); 22 Apr 2013 21:03:27 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Apr 2013 21:03:27 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id C4A6881DDEC; Mon, 22 Apr 2013 21:03:26 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bfederle@apache.org To: commits@cloudstack.apache.org Date: Mon, 22 Apr 2013 21:03:29 -0000 Message-Id: <022e85f008c44e5abc3c3d8204bf69a7@git.apache.org> In-Reply-To: <306d8794d9fe4f4183fb19f935b342bc@git.apache.org> References: <306d8794d9fe4f4183fb19f935b342bc@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [04/50] [abbrv] git commit: updated refs/heads/ui-vm-affinity to 922b51c 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/ui-vm-affinity Commit: fc4f19f915e8edc5ccc0076122fb20c19ad2646a Parents: 59bee8d Author: Pranav Saxena Authored: Fri Apr 19 18:27:07 2013 +0530 Committer: Pranav Saxena 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") {