[pve-devel] r5893 - in pve-manager/pve2/www/new: data qemu

svn-commits at proxmox.com svn-commits at proxmox.com
Tue May 3 09:44:00 CEST 2011


Author: dietmar
Date: 2011-05-03 09:44:00 +0200 (Tue, 03 May 2011)
New Revision: 5893

Modified:
   pve-manager/pve2/www/new/data/ResourceStore.js
   pve-manager/pve2/www/new/qemu/CreateWizard.js
Log:
find free VMID


Modified: pve-manager/pve2/www/new/data/ResourceStore.js
===================================================================
--- pve-manager/pve2/www/new/data/ResourceStore.js	2011-05-03 07:33:11 UTC (rev 5892)
+++ pve-manager/pve2/www/new/data/ResourceStore.js	2011-05-03 07:44:00 UTC (rev 5893)
@@ -3,6 +3,15 @@
     requires: ['PVE.Utils'],
     singleton: true,
 
+    findNextVMID: function() {
+	var me = this, i;
+	
+	for (i = 100; i < 10000; i++) {
+	    if (!me.find('vmid', i))
+		return i;
+	}
+    },
+
     constructor: function(config) {
 	var me = this;
 

Modified: pve-manager/pve2/www/new/qemu/CreateWizard.js
===================================================================
--- pve-manager/pve2/www/new/qemu/CreateWizard.js	2011-05-03 07:33:11 UTC (rev 5892)
+++ pve-manager/pve2/www/new/qemu/CreateWizard.js	2011-05-03 07:44:00 UTC (rev 5893)
@@ -1,19 +1,22 @@
 
 Ext.define('PVE.qemu.CreateWizard', {
     extend: 'PVE.window.Wizard',
+    requires: ['PVE.data.ResourceStore'],
 
     initComponent: function() {
 	var me = this;
 
-	cardTypeStore =Ext.create('Ext.data.ArrayStore', {
+	cardTypeStore = Ext.create('Ext.data.ArrayStore', {
             fields: ['key'],
             data : [ 
 		['rtl8139'], 
 		['e1000'],
 		['virtio']
 	    ]
-        }), 
+        });
 
+	var nextvmid = PVE.data.ResourceStore.findNextVMID();
+
 	Ext.applyIf(me, {
 	    title: 'Create new virtual machine',
 	    items: [
@@ -30,7 +33,8 @@
 			{
 			    xtype: 'numberfield',
 			    name: 'vmid',
-			    minValue: 101,
+			    value: nextvmid,
+			    minValue: 100,
 			    maxValue: 999999999,
 			    fieldLabel: 'Unique ID',
 			    allowBlank: false




More information about the pve-devel mailing list