[pve-devel] [PATCH v2] Add CT service support and remove type parameter

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Sep 1 14:37:07 CEST 2015


The type parameter is not needed anymore because the service type
can be extracted by only using the unique vmid.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
Changes since v1:
* fixed hardcoded 'vm' when editing service

www/manager/ha/ResourceEdit.js | 8 +++-----
 www/manager/ha/Resources.js    | 4 ++--
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/www/manager/ha/ResourceEdit.js b/www/manager/ha/ResourceEdit.js
index 8c57360..962cdda 100644
--- a/www/manager/ha/ResourceEdit.js
+++ b/www/manager/ha/ResourceEdit.js
@@ -1,15 +1,13 @@
 Ext.define('PVE.ha.VMResourceInputPanel', {
     extend: 'PVE.panel.InputPanel',
 
-    // only usable to type 'vm'
-    
+
     vmid: undefined,
     
     onGetValues: function(values) {
 	var me = this;
 
 	if (me.create) {
-	    values.type = 'vm';
 	    values.sid = values.vmid;
 	}
 	
@@ -88,7 +86,7 @@ Ext.define('PVE.ha.VMResourceEdit', {
             me.url = '/api2/extjs/cluster/ha/resources';
             me.method = 'POST';
         } else {
-            me.url = '/api2/extjs/cluster/ha/resources/vm:' + me.vmid;
+            me.url = '/api2/extjs/cluster/ha/resources/' + me.vmid;
             me.method = 'PUT';
         }
 
@@ -118,7 +116,7 @@ Ext.define('PVE.ha.VMResourceEdit', {
 		    var regex =  /^(\S+):(\S+)$/;
 		    var res = regex.exec(values.sid);
 
-		    if (res[1] !== 'vm') { throw "got unexpected resource type"; };
+		  if (res[1] !== 'vm' && res[1] !== 'ct') { throw "got unexpected resource type"; };
 
 		    values.vmid = res[2];
 		    
diff --git a/www/manager/ha/Resources.js b/www/manager/ha/Resources.js
index 6d6e97c..a8212bd 100644
--- a/www/manager/ha/Resources.js
+++ b/www/manager/ha/Resources.js
@@ -44,7 +44,7 @@ Ext.define('PVE.ha.ResourcesView', {
 	    var regex =  /^(\S+):(\S+)$/;
 	    var res = regex.exec(sid);
 
-	    if (res[1] !== 'vm') { return; };
+	  if (res[1] !== 'vm' && res[1] !== 'ct') { return; };
 	    
 	    var vmid = res[2];
 	    
@@ -146,7 +146,7 @@ Ext.define('PVE.ha.ResourcesView', {
     Ext.define('pve-ha-resources', {
 	extend: 'Ext.data.Model',
 	fields: [ 
-	    'sid', 'type', 'state', 'digest', 'errors', 'group', 'comment'
+	  'sid', 'state', 'digest', 'errors', 'group', 'comment'
 	],
 	idProperty: 'sid'
     });
-- 
2.1.4




More information about the pve-devel mailing list