[pve-devel] [PATCH manager 2/3] White and indentation fixes

2017-08-30 Thread Emmanuel Kasper
---
 www/manager6/dc/Log.js   | 4 ++--
 www/manager6/dc/Tasks.js | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/www/manager6/dc/Log.js b/www/manager6/dc/Log.js
index 4a47f18e..64178137 100644
--- a/www/manager6/dc/Log.js
+++ b/www/manager6/dc/Log.js
@@ -77,12 +77,12 @@ Ext.define('PVE.dc.Log', {
storeid: 'pve-cluster-log',
model: 'pve-cluster-log',
proxy: {
-type: 'pve',
+   type: 'pve',
url: '/api2/json/cluster/log'
}
});
 
-   var store = Ext.create('PVE.data.DiffStore', { 
+   var store = Ext.create('PVE.data.DiffStore', {
rstore: logstore,
appendAtStart: true 
});
diff --git a/www/manager6/dc/Tasks.js b/www/manager6/dc/Tasks.js
index b5727bc1..793101f4 100644
--- a/www/manager6/dc/Tasks.js
+++ b/www/manager6/dc/Tasks.js
@@ -105,12 +105,12 @@ Ext.define('PVE.dc.Tasks', {
storeid: 'pve-cluster-tasks',
model: 'pve-tasks',
proxy: {
-type: 'pve',
+   type: 'pve',
url: '/api2/json/cluster/tasks'
}
});
 
-   var store = Ext.create('PVE.data.DiffStore', { 
+   var store = Ext.create('PVE.data.DiffStore', {
rstore: taskstore,
sortAfterUpdate: true,
appendAtStart: true,
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager 1/3] Rewrite Log Panel and Task Panel with declarative synthax

2017-08-30 Thread Emmanuel Kasper
No functional changes
---
 www/manager6/dc/Log.js   | 130 +++
 www/manager6/dc/Tasks.js | 195 +++
 2 files changed, 161 insertions(+), 164 deletions(-)

diff --git a/www/manager6/dc/Log.js b/www/manager6/dc/Log.js
index 62370eca..4a47f18e 100644
--- a/www/manager6/dc/Log.js
+++ b/www/manager6/dc/Log.js
@@ -4,12 +4,75 @@
 
 Ext.define('PVE.dc.Log', {
 extend: 'Ext.grid.GridPanel',
-
 alias: ['widget.pveClusterLog'],
+stateful: false,
+sortableColumns: false,
+
+viewConfig: {
+   trackOver: false,
+   stripeRows: true,
+   getRowClass: function(record, index) {
+   var pri = record.get('pri');
+   if (pri && pri <= 3) {
+   return "pve-invalid-row";
+   }
+   }
+},
+columns: [
+   {
+   header: gettext("Time"),
+   dataIndex: 'time',
+   width: 150,
+   renderer: function(value) {
+   return Ext.Date.format(value, "M d H:i:s");
+   }
+   },
+   {
+   header: gettext("Node"),
+   dataIndex: 'node',
+   width: 150
+   },
+   {
+   header: gettext("Service"),
+   dataIndex: 'tag',
+   width: 100
+   },
+   {
+   header: "PID",
+   dataIndex: 'pid',
+   width: 100
+   },
+   {
+   header: gettext("User name"),
+   dataIndex: 'user',
+   width: 150
+   },
+   {
+   header: gettext("Severity"),
+   dataIndex: 'pri',
+   renderer: PVE.Utils.render_serverity,
+   width: 100
+   },
+   {
+   header: gettext("Message"),
+   dataIndex: 'msg',
+   flex: 1
+   }
+],
+listeners: {
+   activate: function() {
+   this.getStore().rstore.startUpdate();
+   },
+   deactivate: function() {
+   this.getStore().rstore.stopUpdate();
+   },
+   destroy: function() {
+   this.getStore().rstore.stopUpdate();
+   }
+},
 
 initComponent : function() {
var me = this;
-
var logstore = new PVE.data.UpdateStore({
storeid: 'pve-cluster-log',
model: 'pve-cluster-log',
@@ -25,68 +88,7 @@ Ext.define('PVE.dc.Log', {
});
 
Ext.apply(me, {
-   store: store,
-   stateful: false,
-
-   viewConfig: {
-   trackOver: false,
-   stripeRows: true,
- 
-   getRowClass: function(record, index) {
-   var pri = record.get('pri');
-
-   if (pri && pri <= 3) {
-   return "pve-invalid-row";
-   }
-   }
-   },
-   sortableColumns: false,
-   columns: [
-   { 
-   header: gettext("Time"), 
-   dataIndex: 'time',
-   width: 150,
-   renderer: function(value) { 
-   return Ext.Date.format(value, "M d H:i:s"); 
-   }
-   },
-   { 
-   header: gettext("Node"), 
-   dataIndex: 'node',
-   width: 150
-   },
-   { 
-   header: gettext("Service"), 
-   dataIndex: 'tag',
-   width: 100
-   },
-   { 
-   header: "PID", 
-   dataIndex: 'pid',
-   width: 100 
-   },
-   { 
-   header: gettext("User name"), 
-   dataIndex: 'user',
-   width: 150
-   },
-   { 
-   header: gettext("Severity"), 
-   dataIndex: 'pri',
-   renderer: PVE.Utils.render_serverity,
-   width: 100 
-   },
-   { 
-   header: gettext("Message"), 
-   dataIndex: 'msg',
-   flex: 1   
-   }
-   ],
-   listeners: {
-   activate: logstore.startUpdate,
-   deactivate: logstore.stopUpdate,
-   destroy: logstore.stopUpdate
-   }
+   store: store
});
 
me.callParent();
diff --git a/www/manager6/dc/Tasks.js b/www/manager6/dc/Tasks.js
index 5d65bd2e..b5727bc1 100644
--- a/www/manager6/dc/Tasks.js
+++ b/www/manager6/dc/Tasks.js
@@ -1,11 +1,102 @@
 /* This class defines the "Tasks" tab of the bottom status panel
  * Tasks are jobs with a start, end and log output
  */
-
 Ext.define('PVE.dc.Tasks', {
 extend: 'Ext.grid.GridPanel',
-
 alias: ['widget.pveClusterTasks'],
+stateful: false,
+sortableColumns: false,
+
+viewConfig: {
+   trackOver: false,
+   stripeRows: true,
+   getRowClass: function(record, index) {
+   var status = record.get('status')

Re: [pve-devel] [PATCH manager] pool: add member: use generic 'Virtual Guest' wording

2017-08-31 Thread Emmanuel Kasper
On 08/31/2017 09:47 AM, Thomas Lamprecht wrote:
> ---
>  www/manager6/grid/PoolMembers.js | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/www/manager6/grid/PoolMembers.js 
> b/www/manager6/grid/PoolMembers.js
> index 5d020f7b..8c7315f9 100644
> --- a/www/manager6/grid/PoolMembers.js
> +++ b/www/manager6/grid/PoolMembers.js
> @@ -87,7 +87,7 @@ Ext.define('PVE.pool.AddVM', {
>   ]
>   });
>   Ext.apply(me, {
> - subject: gettext('Virtual Machine'),
> + subject: gettext('Virtual Guest'),
I think we used 'Guest'  up to now ?

see Datacenter -> Summary second panel
and the replication panel




___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] [PATCH manager] pending changes: switch to orange and anotate with '(pending)'

2017-08-31 Thread Emmanuel Kasper
On 08/31/2017 10:52 AM, Thomas Lamprecht wrote:
> red is normally strongly associated with errors, put pending changes
> are not errors.
> Tus use proxmox orange, to not scare (new) users and annotate the
> pending entry with '(pending)' to make it easier to see what
> happens.
> ---
>  www/manager6/grid/PendingObjectGrid.js | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/www/manager6/grid/PendingObjectGrid.js 
> b/www/manager6/grid/PendingObjectGrid.js
> index d5702f2e..aa3aa488 100644
> --- a/www/manager6/grid/PendingObjectGrid.js
> +++ b/www/manager6/grid/PendingObjectGrid.js
> @@ -64,7 +64,7 @@ Ext.define('PVE.grid.PendingObjectGrid', {
>   }
>  
>   if (pending || pendingdelete) {
> - return current + '' + (pending || '') + 
> pendingdelete + '';
> + return current + '' + (pending || '') + 
> pendingdelete + ' (pending)';
>   } else {
>   return current;
>   }
> 
Good idea: we use red for validations errors and unresponsive nodes so
this makes sense not to reuse it for annoting pending changes.

Two nitpicks: could we maybe use color: darkorange as it looks like the
styling you want to use, and we avoid hardsetting an hex value.

Also we have a gettext string available for pending, that we use in the
Replication panel.

If we add a gettext, it will be a long string concatenation so maybe the
use of Ext.String.format() is a bit more readable

return Ext.String.format('{0}{1} {2}
({3})', current, pending || '', pendingdelete, gettext('pending'));

___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] [PATCH manager v2 1/3] pool: add member: use generic wording for 'Guest'

2017-08-31 Thread Emmanuel Kasper
tested OK, and the serie looks good to me

On 08/31/2017 02:25 PM, Thomas Lamprecht wrote:
> ---
> 
> changes v1 -> v2:
> * use 'Guest' instead of 'Virtual Guest'
> 
>  www/manager6/grid/PoolMembers.js | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/www/manager6/grid/PoolMembers.js 
> b/www/manager6/grid/PoolMembers.js
> index 5d020f7b..825708c5 100644
> --- a/www/manager6/grid/PoolMembers.js
> +++ b/www/manager6/grid/PoolMembers.js
> @@ -87,7 +87,7 @@ Ext.define('PVE.pool.AddVM', {
>   ]
>   });
>   Ext.apply(me, {
> - subject: gettext('Virtual Machine'),
> + subject: gettext('Guest'),
>   items: [ vmsField, vmGrid ]
>   });
>  
> @@ -212,7 +212,7 @@ Ext.define('PVE.grid.PoolMembers', {
>   menu: new Ext.menu.Menu({
>   items: [
>   {
> - text: gettext('Virtual Machine'),
> + text: gettext('Guest'),
>   iconCls: 'pve-itype-icon-qemu',
>   handler: function() {
>   var win = Ext.create('PVE.pool.AddVM', { 
> pool: me.pool });
> 

___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] Switching the scsi controller type in the Qemu Create VM Wizard

2017-09-05 Thread Emmanuel Kasper
Hi

I would like to change the default scsi controller we use in the Wizard
from virtio-scsi-pci, to virtio-scsi-single in a forthcoming path serie
which touch the HD edition window.
The difference between the two types is that with virtio-scsi-single
each new disk is added on its own controller on its own pci bus, which
is needed by the iothread option.

This change would allow to select the iothread option on VM creation if
the user wants that.

The current behaviour is to change in the background the scsi controller
if iothread is selected, without giving a clue to the user that we changed.

Any thoughts about this ?

Emmanuel


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] Switching the scsi controller type in the Qemu Create VM Wizard

2017-09-06 Thread Emmanuel Kasper
On 09/05/2017 05:48 PM, Dietmar Maurer wrote:
>> This change would allow to select the iothread option on VM creation if
>> the user wants that.
> 
> I am quite unsure about that - this is usually just a waste of resources ...

OK then I'll keep our current defaults.



___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager 02/10] Move Wizard static properties to class body

2017-09-06 Thread Emmanuel Kasper
This allow those properties to be easily overriden in subclasses in a later step
---
 www/manager6/window/Wizard.js | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/www/manager6/window/Wizard.js b/www/manager6/window/Wizard.js
index 7ae58776..26c3ceaf 100644
--- a/www/manager6/window/Wizard.js
+++ b/www/manager6/window/Wizard.js
@@ -1,5 +1,13 @@
 Ext.define('PVE.window.Wizard', {
 extend: 'Ext.window.Window',
+width: 620,
+height: 450,
+modal: true,
+border: false,
+draggable: true,
+closable: true,
+resizable: false,
+layout: 'border',
 
 activeTitle: '', // used for automated testing
 
@@ -175,14 +183,6 @@ Ext.define('PVE.window.Wizard', {
}
 
Ext.apply(me, {
-   width: 620,
-   height: 450,
-   modal: true,
-   border: false,
-   draggable: true,
-   closable: true,
-   resizable: false,
-   layout: 'border',
items: [
{
// disabled for now - not really needed
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager 08/10] Improve the display names of VirtIO-blk and VirtIO SCSI controllers

2017-09-06 Thread Emmanuel Kasper
SCSI is redundant in the VirtIO SCSI controller type.
VirtIO-blk allows to better understand the different choices in the Combobox
and is also the name used by Qemu upstream.
---
 www/manager6/Utils.js| 4 ++--
 www/manager6/form/BusTypeSelector.js | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 0b850977..9f79506a 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -202,9 +202,9 @@ Ext.define('PVE.Utils', { utilities: {
} else if (value === 'megasas') {
return 'MegaRAID SAS 8708EM2';
} else if (value === 'virtio-scsi-pci') {
-   return 'VirtIO SCSI';
+   return 'VirtIO';
} else if (value === 'virtio-scsi-single') {
-   return 'VirtIO SCSI single';
+   return 'VirtIO single';
} else if (value === 'pvscsi') {
return 'VMware PVSCSI';
} else {
diff --git a/www/manager6/form/BusTypeSelector.js 
b/www/manager6/form/BusTypeSelector.js
index 0b37857e..95db8d1b 100644
--- a/www/manager6/form/BusTypeSelector.js
+++ b/www/manager6/form/BusTypeSelector.js
@@ -5,7 +5,7 @@ Ext.define('PVE.form.BusTypeSelector', {
 // ordering matters
 busList: [
['ide', 'IDE'],
-   ['virtio', 'VirtIO'],
+   ['virtio', 'VirtIO-blk'],
['scsi', 'SCSI'],
['sata', 'SATA']
 ],
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager 05/10] Save the components we found via down() in a variable for later reuse.

2017-09-06 Thread Emmanuel Kasper
---
 www/manager6/form/ControllerSelector.js | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/www/manager6/form/ControllerSelector.js 
b/www/manager6/form/ControllerSelector.js
index 14ad574e..15023a7a 100644
--- a/www/manager6/form/ControllerSelector.js
+++ b/www/manager6/form/ControllerSelector.js
@@ -58,11 +58,14 @@ Ext.define('PVE.form.ControllerSelector', {
me.vmconfig = Ext.apply({}, vmconfig);
 
var clist = ['ide', 'virtio', 'scsi', 'sata'];
+   var bussel = me.down('field[name=controller]');
+   var deviceid = me.down('field[name=deviceid]');
+
if (autoSelect === 'cdrom') {
clist = ['ide', 'scsi', 'sata'];
if (!Ext.isDefined(me.vmconfig.ide2)) {
-   me.down('field[name=controller]').setValue('ide');
-   me.down('field[name=deviceid]').setValue(2);
+   bussel.setValue('ide');
+   deviceid.setValue(2);
return;
}
} else  {
@@ -76,16 +79,16 @@ Ext.define('PVE.form.ControllerSelector', {
if (controller === 'virtio' && me.noVirtIO) {
return; //continue
}
-   me.down('field[name=controller]').setValue(controller);
+   bussel.setValue(controller);
for (i = 0; i <= PVE.form.ControllerSelector.maxIds[controller]; 
i++) {
confid = controller + i.toString();
if (!Ext.isDefined(me.vmconfig[confid])) {
-   me.down('field[name=deviceid]').setValue(i);
+   deviceid.setValue(i);
return false; // break
}
}
});
-   me.down('field[name=deviceid]').validate();
+   deviceid.validate();
 },
 
 initComponent: function() {
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager 06/10] Use the noVirtiIO ControllerSelector property to build the list of controllers

2017-09-06 Thread Emmanuel Kasper
---
 www/manager6/form/ControllerSelector.js | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/www/manager6/form/ControllerSelector.js 
b/www/manager6/form/ControllerSelector.js
index 15023a7a..5c6631b3 100644
--- a/www/manager6/form/ControllerSelector.js
+++ b/www/manager6/form/ControllerSelector.js
@@ -61,9 +61,9 @@ Ext.define('PVE.form.ControllerSelector', {
var bussel = me.down('field[name=controller]');
var deviceid = me.down('field[name=deviceid]');
 
-   if (autoSelect === 'cdrom') {
+   if (me.noVirtiIO) {
clist = ['ide', 'scsi', 'sata'];
-   if (!Ext.isDefined(me.vmconfig.ide2)) {
+   if (autoSelect === 'cdrom' && !Ext.isDefined(me.vmconfig.ide2)) {
bussel.setValue('ide');
deviceid.setValue(2);
return;
@@ -76,9 +76,6 @@ Ext.define('PVE.form.ControllerSelector', {
 
Ext.Array.each(clist, function(controller) {
var confid, i;
-   if (controller === 'virtio' && me.noVirtIO) {
-   return; //continue
-   }
bussel.setValue(controller);
for (i = 0; i <= PVE.form.ControllerSelector.maxIds[controller]; 
i++) {
confid = controller + i.toString();
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager 00/10] Display the SCSI controller type when adding a new drive

2017-09-06 Thread Emmanuel Kasper
Since we switched to the SCSI controller in the Wizard as the recommended 
controller
for hard disks (using VirtIO scsi in the backend) it was not clear for users
that they were using a VirtIO driver for the disk.
An example of this would be:
https://forum.proxmox.com/threads/proxmox-hypervisor-scsi-or-virtio.36506/#post-179056
This came in the trainings as well.

Example before / after:
Before: http://imgur.com/a/Ozy6v
After: http://imgur.com/a/axJBa

This unfortunately does not play well with the controller selection based on 
the Iothread
checkbox, as the Bus picker list would then needed to be updated based on a 
checkbox selection.
IMHO, it is more important to provide a good visual feedback on which elements 
the user is 
manipulating, so I reverted this change, which was used only in the wizard 
anyway.

About the patch serie:
 * 01-06 is some refactoring work to prepare for the new combo box
 * 07 use the new combobox when adding a disk
 * 08-10 use the new combobox when adding a disk in the wizard

Emmanuel Kasper (10):
  Do not change the SCSI controller type when iothread was selected
  Move Wizard static properties to class body
  Do not use 'autoselect' as a boolean when preselecting a bus
  Remove unused noScsi parameter
  Save the components we found via down() in a variable for later reuse.
  Use the noVirtiIO ControllerSelector property to build the list of
controllers
  Enhance BusStypeSelector with the SCSI controller description
  Improve the display names of VirtIO-blk and VirtIO SCSI controllers
  Make room in QemuWizard and Edit Window so that the larger combo boxes
properly fit.
  Propagate the SCSI hw to the Hard Disk panel when selecting an OS

 www/manager6/Utils.js   |  4 +-
 www/manager6/form/BusTypeSelector.js| 56 ++--
 www/manager6/form/ControllerSelector.js | 66 -
 www/manager6/qemu/CDEdit.js |  3 ++
 www/manager6/qemu/CreateWizard.js   |  3 +-
 www/manager6/qemu/HDEdit.js | 12 +++---
 www/manager6/qemu/OSTypeEdit.js | 11 --
 www/manager6/window/Edit.js |  3 ++
 www/manager6/window/Wizard.js   | 16 
 9 files changed, 107 insertions(+), 67 deletions(-)

-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager 07/10] Enhance BusStypeSelector with the SCSI controller description

2017-09-06 Thread Emmanuel Kasper
Since we started in PVE 4.3 to autoselect SCSI for new Linux VMs,
it was not clear that this controller actually uses a pv virtio
driver, which is confusing for users.

See for example:
https://forum.proxmox.com/threads/proxmox-hypervisor-scsi-or-virtio.36506/#post-179056

The vm configuration is only available to components of an InputPanel
after the components has been by the input panel, so we rebuild the
backing store when we get the vmconfig.

Note that we don't extend KVComboBox anymore because we need to set the store
ourselves and not via ComboItems. We were never using KVComboBox functionality 
anyway
since this combobox was never empty nor invalid.
---
 www/manager6/form/BusTypeSelector.js| 56 +++--
 www/manager6/form/ControllerSelector.js |  9 +++---
 www/manager6/qemu/HDEdit.js |  3 ++
 3 files changed, 54 insertions(+), 14 deletions(-)

diff --git a/www/manager6/form/BusTypeSelector.js 
b/www/manager6/form/BusTypeSelector.js
index ae7c327e..0b37857e 100644
--- a/www/manager6/form/BusTypeSelector.js
+++ b/www/manager6/form/BusTypeSelector.js
@@ -1,20 +1,56 @@
 Ext.define('PVE.form.BusTypeSelector', {
-extend: 'PVE.form.KVComboBox',
+extend: 'Ext.form.field.ComboBox',
 alias: 'widget.pveBusSelector',
-  
-noVirtIO: false,
 
-initComponent: function() {
-   var me = this;
+// ordering matters
+busList: [
+   ['ide', 'IDE'],
+   ['virtio', 'VirtIO'],
+   ['scsi', 'SCSI'],
+   ['sata', 'SATA']
+],
+
+getBusTypes: function() {
+   return this.busList.map(function (el) {
+   return el[0];
+   });
+},
 
-   me.comboItems = [['ide', 'IDE'], ['sata', 'SATA']];
+describeBus: function(bus, scsihw) {
+   var desc;
+   var i;
 
-   if (!me.noVirtIO) {
-   me.comboItems.push(['virtio', 'VirtIO']);
+   if (bus === 'scsi') {
+   desc = this.busList[2][1] + ' - ' + PVE.Utils.render_scsihw(scsihw);
+   return desc;
}
 
-   me.comboItems.push(['scsi', 'SCSI']);
+   for (i = 0; i < this.busList.length; i++) {
+   if (bus === this.busList[i][0]) {
+   desc = this.busList[i][1];
+   return desc;
+   }
+   }
+},
 
-   me.callParent();
+// once we know the vmconfig, rebuild the store with scsihw full 
description
+buildStore: function(busses, scsihw) {
+   var me = this;
+   var store = [];
+   Ext.Array.forEach(busses, function(bus) {
+   store.push([bus, me.describeBus(bus, scsihw)]);
+   });
+   me.setStore(store);
+   return me;
+},
+
+buildDefaultStore: function(scsihw) {
+   var me = this;
+   this.buildStore(me.getBusTypes(), scsihw);
+   return me;
+},
+
+initComponent: function() {
+   this.buildDefaultStore().callParent();
 }
 });
diff --git a/www/manager6/form/ControllerSelector.js 
b/www/manager6/form/ControllerSelector.js
index 5c6631b3..d15fda84 100644
--- a/www/manager6/form/ControllerSelector.js
+++ b/www/manager6/form/ControllerSelector.js
@@ -57,12 +57,13 @@ Ext.define('PVE.form.ControllerSelector', {
 
me.vmconfig = Ext.apply({}, vmconfig);
 
-   var clist = ['ide', 'virtio', 'scsi', 'sata'];
var bussel = me.down('field[name=controller]');
var deviceid = me.down('field[name=deviceid]');
+   var clist = bussel.getBusTypes();
 
-   if (me.noVirtiIO) {
-   clist = ['ide', 'scsi', 'sata'];
+   if (me.noVirtIO) {
+   clist.splice(1, 1); // remove virtio blk
+   bussel.buildStore(clist, me.vmconfig.scsihw);
if (autoSelect === 'cdrom' && !Ext.isDefined(me.vmconfig.ide2)) {
bussel.setValue('ide');
deviceid.setValue(2);
@@ -72,6 +73,7 @@ Ext.define('PVE.form.ControllerSelector', {
// in most cases we want to add a disk to the same controller
// we previously used
clist = me.sortByPreviousUsage(me.vmconfig, clist);
+   bussel.buildStore(clist, me.vmconfig.scsihw);
}
 
Ext.Array.each(clist, function(controller) {
@@ -102,7 +104,6 @@ Ext.define('PVE.form.ControllerSelector', {
xtype: 'pveBusSelector',
name: 'controller',
value: PVE.qemu.OSDefaults.generic.busType,
-   noVirtIO: me.noVirtIO,
allowBlank: false,
flex: 2,
listeners: {
diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index 2874bfa8..9fbbc763 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -17,6 +17,9 @@ Ext.define('PVE.qemu.HDInputPanel', {
 
onControllerChange: function(field) {
var value = field.getValue();
+   if (!value) {
+   return;
+   }
 
var allowIOthread = value.match(/^(virtio|scsi)/);
this.lookup

[pve-devel] [PATCH manager 09/10] Make room in QemuWizard and Edit Window so that the larger combo boxes properly fit.

2017-09-06 Thread Emmanuel Kasper
This will benefit the BusTypeSelector, the DiskFormatSelector, the CD 
FileSelector,
and possibily other long fields like vm name, pool name.
---
 www/manager6/form/ControllerSelector.js | 4 ++--
 www/manager6/qemu/CDEdit.js | 3 +++
 www/manager6/qemu/CreateWizard.js   | 1 +
 www/manager6/qemu/HDEdit.js | 3 +++
 www/manager6/window/Edit.js | 3 +++
 5 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/www/manager6/form/ControllerSelector.js 
b/www/manager6/form/ControllerSelector.js
index d15fda84..ce6ac428 100644
--- a/www/manager6/form/ControllerSelector.js
+++ b/www/manager6/form/ControllerSelector.js
@@ -103,9 +103,9 @@ Ext.define('PVE.form.ControllerSelector', {
{
xtype: 'pveBusSelector',
name: 'controller',
+   flex: 7,
value: PVE.qemu.OSDefaults.generic.busType,
allowBlank: false,
-   flex: 2,
listeners: {
change: function(t, value) {
if (!me.rendered || !value) {
@@ -120,10 +120,10 @@ Ext.define('PVE.form.ControllerSelector', {
{
xtype: 'pveIntegerField',
name: 'deviceid',
+   flex: 3,
minValue: 0,
maxValue: PVE.form.ControllerSelector.maxIds.ide,
value: '0',
-   flex: 1,
validator: function(value) {
/*jslint confusion: true */
if (!me.rendered) {
diff --git a/www/manager6/qemu/CDEdit.js b/www/manager6/qemu/CDEdit.js
index 51921b8d..0c660a1d 100644
--- a/www/manager6/qemu/CDEdit.js
+++ b/www/manager6/qemu/CDEdit.js
@@ -147,6 +147,9 @@ Ext.define('PVE.qemu.CDInputPanel', {
 
 Ext.define('PVE.qemu.CDEdit', {
 extend: 'PVE.window.Edit',
+fieldDefaults: {
+   width: 140
+},
 
 initComponent : function() {
var me = this;
diff --git a/www/manager6/qemu/CreateWizard.js 
b/www/manager6/qemu/CreateWizard.js
index 944309a6..a01fc81b 100644
--- a/www/manager6/qemu/CreateWizard.js
+++ b/www/manager6/qemu/CreateWizard.js
@@ -2,6 +2,7 @@ Ext.define('PVE.qemu.CreateWizard', {
 extend: 'PVE.window.Wizard',
 alias: 'widget.pveQemuCreateWizard',
 qemuScsiController: undefined,
+width: 680,
 
 controller: {
 
diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index 9fbbc763..5d4e7c89 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -300,6 +300,9 @@ Ext.define('PVE.qemu.HDEdit', {
 extend: 'PVE.window.Edit',
 
 isAdd: true,
+fieldDefaults: {
+   width: 140
+},
 
 initComponent : function() {
var me = this;
diff --git a/www/manager6/window/Edit.js b/www/manager6/window/Edit.js
index 9a026683..9941c5d1 100644
--- a/www/manager6/window/Edit.js
+++ b/www/manager6/window/Edit.js
@@ -259,6 +259,9 @@ Ext.define('PVE.window.Edit', {
colwidth += me.fieldDefaults.labelWidth - 100;
}

+   if (me.fieldDefaults && me.fieldDefaults.width) {
+   colwidth += me.fieldDefaults.width - 100;
+   }
 
var twoColumn = items[0].column1 || items[0].column2;
 
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager 04/10] Remove unused noScsi parameter

2017-09-06 Thread Emmanuel Kasper
SCSI is a valid bus for Disks and CD drives, so it should always
be appear in the bus list.
---
 www/manager6/form/BusTypeSelector.js| 6 +-
 www/manager6/form/ControllerSelector.js | 6 +-
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/www/manager6/form/BusTypeSelector.js 
b/www/manager6/form/BusTypeSelector.js
index 9b9492fc..ae7c327e 100644
--- a/www/manager6/form/BusTypeSelector.js
+++ b/www/manager6/form/BusTypeSelector.js
@@ -4,8 +4,6 @@ Ext.define('PVE.form.BusTypeSelector', {
   
 noVirtIO: false,
 
-noScsi: false,
-
 initComponent: function() {
var me = this;
 
@@ -15,9 +13,7 @@ Ext.define('PVE.form.BusTypeSelector', {
me.comboItems.push(['virtio', 'VirtIO']);
}
 
-   if (!me.noScsi) {
-   me.comboItems.push(['scsi', 'SCSI']);
-   }
+   me.comboItems.push(['scsi', 'SCSI']);
 
me.callParent();
 }
diff --git a/www/manager6/form/ControllerSelector.js 
b/www/manager6/form/ControllerSelector.js
index 045e7d0d..14ad574e 100644
--- a/www/manager6/form/ControllerSelector.js
+++ b/www/manager6/form/ControllerSelector.js
@@ -13,8 +13,6 @@ Ext.define('PVE.form.ControllerSelector', {
 
 noVirtIO: false,
 
-noScsi: false,
-
 vmconfig: {}, // used to check for existing devices
 
 sortByPreviousUsage: function(vmconfig, controllerList) {
@@ -75,8 +73,7 @@ Ext.define('PVE.form.ControllerSelector', {
 
Ext.Array.each(clist, function(controller) {
var confid, i;
-   if ((controller === 'virtio' && me.noVirtIO) ||
-   (controller === 'scsi' && me.noScsi)) {
+   if (controller === 'virtio' && me.noVirtIO) {
return; //continue
}
me.down('field[name=controller]').setValue(controller);
@@ -106,7 +103,6 @@ Ext.define('PVE.form.ControllerSelector', {
name: 'controller',
value: PVE.qemu.OSDefaults.generic.busType,
noVirtIO: me.noVirtIO,
-   noScsi: me.noScsi,
allowBlank: false,
flex: 2,
listeners: {
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager 01/10] Do not change the SCSI controller type when iothread was selected

2017-09-06 Thread Emmanuel Kasper
This was happening without giving the user feedback, and changes a value
which should be set somewhere in the Options Panel.
---
 www/manager6/qemu/CreateWizard.js | 2 +-
 www/manager6/qemu/HDEdit.js   | 4 
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/www/manager6/qemu/CreateWizard.js 
b/www/manager6/qemu/CreateWizard.js
index c3e2fc8a..944309a6 100644
--- a/www/manager6/qemu/CreateWizard.js
+++ b/www/manager6/qemu/CreateWizard.js
@@ -161,7 +161,7 @@ Ext.define('PVE.qemu.CreateWizard', {
var nodename = kv.nodename;
delete kv.nodename;
 
-   if (me.qemuScsiController && !kv.scsihw) {
+   if (me.qemuScsiController) {
kv.scsihw = me.qemuScsiController;
}
 
diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index e7535f50..464aa49c 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -115,10 +115,6 @@ Ext.define('PVE.qemu.HDInputPanel', {
 
if (values.iothread) {
me.drive.iothread = 'on';
-   // do not silently change a VM-wide option after creating it
-   if (me.insideWizard) {
-   params.scsihw = 'virtio-scsi-single';
-   }
} else {
delete me.drive.iothread;
}
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager 10/10] Propagate the SCSI hw to the Hard Disk panel when selecting an OS

2017-09-06 Thread Emmanuel Kasper
---
 www/manager6/qemu/OSTypeEdit.js | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/www/manager6/qemu/OSTypeEdit.js b/www/manager6/qemu/OSTypeEdit.js
index 162a92ec..a779ab91 100644
--- a/www/manager6/qemu/OSTypeEdit.js
+++ b/www/manager6/qemu/OSTypeEdit.js
@@ -22,18 +22,21 @@ Ext.define('PVE.qemu.OSTypeInputPanel', {
targetValues = PVE.qemu.OSDefaults.generic;
}
 
-   me.setWidget('pveBusSelector', targetValues.busType);
-   me.setWidget('pveNetworkCardSelector', 
targetValues.networkCard);
+   me.queryWidget('pveBusSelector')
+   .buildDefaultStore(targetValues.scsihw)
+   .setValue(targetValues.busType);
+
+   
me.queryWidget('pveNetworkCardSelector').setValue(targetValues.networkCard);
me.setWizardHiddenValue('qemuScsiController', 
targetValues.scsihw);
}
}
},
-   setWidget: function(widget, newValue) {
+   queryWidget: function(widget) {
// changing a widget is safe only if ComponentQuery.query returns us
// a single value array
var widgets = Ext.ComponentQuery.query('pveQemuCreateWizard ' + 
widget);
if (widgets.length === 1) {
-   widgets[0].setValue(newValue);
+   return widgets[0];
} else {
throw 'non unique widget :' + widget + ' in Wizard';
}
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager 03/10] Do not use 'autoselect' as a boolean when preselecting a bus

2017-09-06 Thread Emmanuel Kasper
The bus selector is displayed when we add a Hard Disk or CD Drive.
When it is displayed, we *always* preselect the next available
slot on the controller of our choice.
So this test is not needed.

We keep the test on the string value of 'autoselect' to select
a bus position when adding a CD Drive.
---
 www/manager6/form/ControllerSelector.js | 53 -
 www/manager6/qemu/HDEdit.js |  2 +-
 2 files changed, 27 insertions(+), 28 deletions(-)

diff --git a/www/manager6/form/ControllerSelector.js 
b/www/manager6/form/ControllerSelector.js
index 002134ef..045e7d0d 100644
--- a/www/manager6/form/ControllerSelector.js
+++ b/www/manager6/form/ControllerSelector.js
@@ -58,37 +58,36 @@ Ext.define('PVE.form.ControllerSelector', {
var me = this;
 
me.vmconfig = Ext.apply({}, vmconfig);
-   if (autoSelect) {
-   var clist = ['ide', 'virtio', 'scsi', 'sata'];
-   if (autoSelect === 'cdrom') {
-   clist = ['ide', 'scsi', 'sata'];
-   if (!Ext.isDefined(me.vmconfig.ide2)) {
-   me.down('field[name=controller]').setValue('ide');
-   me.down('field[name=deviceid]').setValue(2);
-   return;
-   }
-   } else  {
-   // in most cases we want to add a disk to the same controller
-   // we previously used
-   clist = me.sortByPreviousUsage(me.vmconfig, clist);
+
+   var clist = ['ide', 'virtio', 'scsi', 'sata'];
+   if (autoSelect === 'cdrom') {
+   clist = ['ide', 'scsi', 'sata'];
+   if (!Ext.isDefined(me.vmconfig.ide2)) {
+   me.down('field[name=controller]').setValue('ide');
+   me.down('field[name=deviceid]').setValue(2);
+   return;
}
+   } else  {
+   // in most cases we want to add a disk to the same controller
+   // we previously used
+   clist = me.sortByPreviousUsage(me.vmconfig, clist);
+   }
 
-   Ext.Array.each(clist, function(controller) {
-   var confid, i;
-   if ((controller === 'virtio' && me.noVirtIO) ||
+   Ext.Array.each(clist, function(controller) {
+   var confid, i;
+   if ((controller === 'virtio' && me.noVirtIO) ||
(controller === 'scsi' && me.noScsi)) {
-   return; //continue
-   }
-   me.down('field[name=controller]').setValue(controller);
-   for (i = 0; i <= 
PVE.form.ControllerSelector.maxIds[controller]; i++) {
-   confid = controller + i.toString();
-   if (!Ext.isDefined(me.vmconfig[confid])) {
-   me.down('field[name=deviceid]').setValue(i);
-   return false; // break
-   }
+   return; //continue
+   }
+   me.down('field[name=controller]').setValue(controller);
+   for (i = 0; i <= PVE.form.ControllerSelector.maxIds[controller]; 
i++) {
+   confid = controller + i.toString();
+   if (!Ext.isDefined(me.vmconfig[confid])) {
+   me.down('field[name=deviceid]').setValue(i);
+   return false; // break
}
-   });
-   }
+   }
+   });
me.down('field[name=deviceid]').validate();
 },
 
diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index 464aa49c..2874bfa8 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -136,7 +136,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
me.vmconfig = vmconfig;
 
if (me.bussel) {
-   me.bussel.setVMConfig(vmconfig, true);
+   me.bussel.setVMConfig(vmconfig);
}
if (me.unusedDisks) {
var disklist = [];
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [RFC PATCH common] Use double hyphens when prefixing command options in the documentation

2017-09-06 Thread Emmanuel Kasper
This makes our man pages follow the GNU long option recommandation
where non-single character options are prefixed with a double hyphen.
(https://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html)

The benefit for PVE is that our documentation looks more similar to what
a user with previous Linux knowledge is used to.

Our bash autocompletion helper only completes options using double hyphens too.
---
This would require a rebuild of all packages which have a cli handler.
Many examples of the reference documentation use the -- syntax already though,
I would update the remaining if this patch is applied.

 src/PVE/RESTHandler.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PVE/RESTHandler.pm b/src/PVE/RESTHandler.pm
index d700976..07b044d 100644
--- a/src/PVE/RESTHandler.pm
+++ b/src/PVE/RESTHandler.pm
@@ -431,7 +431,7 @@ my $get_property_description = sub {
} elsif ($style eq 'config-sub') {
$res .= "`$name`=";
} elsif ($style eq 'arg') {
-   $res .= "`-$name` ";
+   $res .= "`--$name` ";
} elsif ($style eq 'fixed') {
$res .= "`<$name>`: ";
} else {
@@ -578,7 +578,7 @@ sub usage_str {
 
if (!$prop->{$k}->{optional}) {
$args .= " " if $args;
-   $args .= "-$base <$type_text>"
+   $args .= "--$base <$type>"
}
 } 
 
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] [RFC PATCH common] Use double hyphens when prefixing command options in the documentation

2017-09-06 Thread Emmanuel Kasper
please ignore, rebase error 

On 09/06/2017 02:24 PM, Emmanuel Kasper wrote:
> This makes our man pages follow the GNU long option recommandation
> where non-single character options are prefixed with a double hyphen.
> (https://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html)
> 
> The benefit for PVE is that our documentation looks more similar to what
> a user with previous Linux knowledge is used to.
> 
> Our bash autocompletion helper only completes options using double hyphens 
> too.
> ---
> This would require a rebuild of all packages which have a cli handler.
> Many examples of the reference documentation use the -- syntax already though,
> I would update the remaining if this patch is applied.
> 
>  src/PVE/RESTHandler.pm | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/PVE/RESTHandler.pm b/src/PVE/RESTHandler.pm
> index d700976..07b044d 100644
> --- a/src/PVE/RESTHandler.pm
> +++ b/src/PVE/RESTHandler.pm
> @@ -431,7 +431,7 @@ my $get_property_description = sub {
>   } elsif ($style eq 'config-sub') {
>   $res .= "`$name`=";
>   } elsif ($style eq 'arg') {
> - $res .= "`-$name` ";
> + $res .= "`--$name` ";
>   } elsif ($style eq 'fixed') {
>   $res .= "`<$name>`: ";
>   } else {
> @@ -578,7 +578,7 @@ sub usage_str {
>  
>   if (!$prop->{$k}->{optional}) {
>   $args .= " " if $args;
> - $args .= "-$base <$type_text>"
> + $args .= "--$base <$type>"
>   }
>  } 
>  
> 

___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [RFC PATCH v2 common] Use double hyphens when prefixing command options in the documentation

2017-09-06 Thread Emmanuel Kasper
This makes our man pages follow the GNU long option recommandations
where non-single character options are prefixed with a double hyphen
(https://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html)

The benefit for PVE is that our documentation looks more similar to what
a user with previous Linux knowledge is used to.

Our bash autocompletion helper only completes options using double hyphens too.
---
 src/PVE/RESTHandler.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PVE/RESTHandler.pm b/src/PVE/RESTHandler.pm
index d700976..5c1d419 100644
--- a/src/PVE/RESTHandler.pm
+++ b/src/PVE/RESTHandler.pm
@@ -431,7 +431,7 @@ my $get_property_description = sub {
} elsif ($style eq 'config-sub') {
$res .= "`$name`=";
} elsif ($style eq 'arg') {
-   $res .= "`-$name` ";
+   $res .= "`--$name` ";
} elsif ($style eq 'fixed') {
$res .= "`<$name>`: ";
} else {
@@ -578,7 +578,7 @@ sub usage_str {
 
if (!$prop->{$k}->{optional}) {
$args .= " " if $args;
-   $args .= "-$base <$type_text>"
+   $args .= "--$base <$type_text>"
}
 } 
 
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] [PATCH qemu-server] Fix misleading error message when qmp fails to report a query-block-jobs

2017-09-07 Thread Emmanuel Kasper
any feedback on this ?
cancelling an action because it has been cancelled it not such an
helpful  error message ;)


On 08/02/2017 01:28 PM, Emmanuel Kasper wrote:
> Currently when qmp fails to report a query-block-jobs,
> we exit with the following log:
> 
> drive-scsi0: transferred: 2950692864 bytes remaining: 3491758080 bytes total: 
> 6442450944 bytes progression: 45.80 % busy: 1 ready: 0
> drive-scsi0: transferred: 2950692864 bytes remaining: 3491758080 bytes total: 
> 6442450944 bytes progression: 45.80 % busy: 1 ready: 0
> drive-scsi0: transferred: 2950692864 bytes remaining: 3491758080 bytes total: 
> 6442450944 bytes progression: 45.80 % busy: 1 ready: 0
> drive-scsi0: transferred: 2950692864 bytes remaining: 3491758080 bytes total: 
> 6442450944 bytes progression: 45.80 % busy: 1 ready: 0
> drive-scsi0: transferred: 2950692864 bytes remaining: 3491758080 bytes total: 
> 6442450944 bytes progression: 45.80 % busy: 1 ready: 0
> drive-scsi0: Cancelling block job
> drive-scsi0: Done.
> 2017-07-31 17:51:44 ERROR: online migrate failure - mirroring error: 
> drive-scsi0: mirroring has been cancelled
> 2017-07-31 17:51:44 aborting phase 2 - cleanup resources
> 2017-07-31 17:51:44 migrate_cancel
> 2017-07-31 17:51:53 ERROR: command '/usr/bin/ssh -o 'BatchMode=yes' -o 
> 'HostKeyAlias=pve4' root@192.168.16.75 pvesm free pvetank:vm-600-disk-3' 
> failed: exit code 1
> 
> 'Cancelling block job' comes from the cleanup, but the 'mirroring has been 
> cancelled'
> comes when no job status are returned vm_mon_cmd($vmid, "query-block-jobs")
> ---
>  PVE/QemuServer.pm | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 1f34101..b8b3796 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -6051,7 +6051,8 @@ sub qemu_drive_mirror_monitor {
>   next;
>   }
>  
> - die "$job: mirroring has been cancelled\n" if 
> !defined($running_mirror_jobs->{$job});
> + die "$job: lost track of mirroring job while waiting for ready 
> status\n"
> + if !defined($running_mirror_jobs->{$job});
>  
>   my $busy = $running_mirror_jobs->{$job}->{busy};
>   my $ready = $running_mirror_jobs->{$job}->{ready};
> 

___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] [PATCH manager 3/3] Turn the offline/online checkbox of the Migrate Windows into a displayfield

2017-09-07 Thread Emmanuel Kasper
any feedback on this ?

On 08/24/2017 11:45 AM, Emmanuel Kasper wrote:
> This checkbox had not effect whatsoever:
>  * if the VM was online and offline was selected, the migration would fail
>  with the message that the --online flag is needed for running VMs
>  * if the the VM was offline and online was selected, the migration would
>  happen offline anyway
> ---
>  www/manager6/window/Migrate.js | 30 ++
>  1 file changed, 18 insertions(+), 12 deletions(-)
> 
> diff --git a/www/manager6/window/Migrate.js b/www/manager6/window/Migrate.js
> index 1434d40c..3b7b6266 100644
> --- a/www/manager6/window/Migrate.js
> +++ b/www/manager6/window/Migrate.js
> @@ -27,8 +27,8 @@ Ext.define('PVE.window.Migrate', {
>   target: values.target
>   };
>  
> - if (values.online) {
> - params[view.liveMode] = values.online;
> + if (view.liveMode) {
> + params[view.liveMode] = 1;
>   }
>  
>   PVE.Utils.API2Request({
> @@ -82,13 +82,10 @@ Ext.define('PVE.window.Migrate', {
>   onlineValidator: true
>   },
>   {
> - xtype: 'pvecheckbox',
> - reference: 'onlineToggle',
> - name: 'online',
> - uncheckedValue: 0,
> - defaultValue: 0,
> - checked: false,
> - fieldLabel: gettext('Restart Mode')
> + xtype: 'displayfield',
> + reference: 'migrationMode',
> + fieldLabel: gettext('Mode'),
> + value: gettext('Offline')
>   }
>   ]
>   }
> @@ -130,14 +127,12 @@ Ext.define('PVE.window.Migrate', {
>   me.liveMode = 'restart';
>  
>   if (me.vmtype === 'qemu') {
> - me.lookup('onlineToggle').setFieldLabel(gettext('Online'));
>   me.lookup('pveHelpButton').setHelpConfig({
>   onlineHelp: 'qm_migration'
>   });
>   title = gettext('Migrate') + (' VM ') + me.vmid;
>   me.liveMode = 'online';
>   }
> - me.setTitle(title);
>  
>   var running = false;
>   var vmrec = PVE.data.ResourceStore.findRecord('vmid', me.vmid,
> @@ -145,8 +140,19 @@ Ext.define('PVE.window.Migrate', {
>   if (vmrec && vmrec.data && vmrec.data.running) {
>   running = true;
>   }
> - me.lookup('onlineToggle').setValue(running);
>  
> + if (running) {
> + var displayField = me.lookup('migrationMode');
> + if (me.vmtype === 'qemu') {
> + displayField.setValue(gettext('Online'));
> + me.liveMode = 'online';
> + } else {
> + displayField.setValue(gettext('Restart Mode'));
> + me.liveMode = 'restart';
> + }
> + }
> +
> + me.setTitle(title);
>   me.lookup('pveNodeSelector').disallowedNodes = [me.nodename];
>   me.lookup('formPanel').isValid();
>  }
> 

___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] [PATCH manager 0/3] Turn the Online checkbox of the Migrate Window into a displayfield

2017-09-07 Thread Emmanuel Kasper
On 09/07/2017 11:39 AM, Dominik Csapak wrote:
> On 08/24/2017 11:45 AM, Emmanuel Kasper wrote:
>> This checkbox had no use, as checking/unchecking it would not be able
>> to change the migration type.
>> (see details in third patch).
>> I also took the opportunity to rewrite the component with a
>> ViewController, and this needed
>> a helper to set the help during the component instanciation using a
>> config object.
>>
>> Emmanuel Kasper (3):
>>Allow to set the onlineHelp via a config Object
>>Rework Migrate Window with declarative synthax
>>Turn the offline/online checkbox of the Migrate Windows into a
>>  displayfield
>>
>>   www/manager6/button/HelpButton.js |   6 +
>>   www/manager6/window/Migrate.js| 231
>> +-
>>   2 files changed, 132 insertions(+), 105 deletions(-)
>>
> 
> looks good to me
> 
> an afterthought:
> 
> would it be good to show in the window if the guest is managed by ha?
> (the migration behavior differs then a bit; notably that the migration
> is not started instantly)

yep timing differs, but since otherwise the behaviour is the same, the
task window coming with "requesting HA migration" provides IMHO enough
information

or are they cases when the actual migration will happen differently when
the VM is HA managed ?






___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] [PATCH qemu-server] Fix misleading error message when qmp fails to report a query-block-jobs

2017-09-12 Thread Emmanuel Kasper
On 09/12/2017 02:30 PM, Wolfgang Bumiller wrote:
> On Thu, Sep 07, 2017 at 10:00:07AM +0200, Emmanuel Kasper wrote:
>> any feedback on this ?
>> cancelling an action because it has been cancelled it not such an
>> helpful  error message ;)
> 
> Wouldn't this result in:
> drive-scsi0: Cancelling block job
> 2017-07-31 17:51:44 ERROR: online migrate failure - mirroring error: 
> drive-scsi0: lost track of mirroring job (...)
> 
> Doesn't look much better IMO? Isn't that more confusing?

Ordering is wrong indeed because we first cancel the block job, then
die() with the real error
but at least we have now a real informative message

I will see if I can improve the ordering of output messages

___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v2 00/10] Display the SCSI controller type when adding a new drive

2017-09-12 Thread Emmanuel Kasper
changes since v1:
 * from Dominik hints:
   * use a fixed hint for bus id selector, so we can flex the controller type
   on the remaining width
   * fixe VirtIO typo
 * from Wolfgang B hints:
   * make controller type selector non editable
 * also write 'VirtIO blk' without hyphen in the controller list

NB: still open for better casing of VirtIO blk if anyone finds one ...

I plan an update for the documentation after this serie is applied

Emmanuel Kasper (10):
  Do not change the SCSI controller type when iothread was selected
  Move Wizard static properties to class body
  Do not use 'autoselect' as a boolean when preselecting a bus
  Remove unused noScsi parameter
  Save the components we found via down() in a variable for later reuse.
  Use the noVirtIO ControllerSelector property to build the list of
controllers
  Enhance BusStypeSelector with the SCSI controller description
  Improve the display names of VirtIO blk and VirtIO SCSI controllers
  Make room in QemuWizard and Edit Window so that the larger combo boxes
properly fit
  Propagate the SCSI hw to the Hard Disk panel when selecting an OS

 www/manager6/Utils.js   |  4 +-
 www/manager6/form/BusTypeSelector.js| 58 ++--
 www/manager6/form/ControllerSelector.js | 67 +++--
 www/manager6/qemu/CDEdit.js |  3 ++
 www/manager6/qemu/CreateWizard.js   |  3 +-
 www/manager6/qemu/HDEdit.js | 12 +++---
 www/manager6/qemu/OSTypeEdit.js | 11 --
 www/manager6/window/Edit.js |  3 ++
 www/manager6/window/Wizard.js   | 16 
 9 files changed, 109 insertions(+), 68 deletions(-)

-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v2 01/10] Do not change the SCSI controller type when iothread was selected

2017-09-12 Thread Emmanuel Kasper
This was happening without giving the user feedback, and changes a value
which should be set somewhere in the Options Panel.
---
 www/manager6/qemu/CreateWizard.js | 2 +-
 www/manager6/qemu/HDEdit.js   | 4 
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/www/manager6/qemu/CreateWizard.js 
b/www/manager6/qemu/CreateWizard.js
index c3e2fc8a..944309a6 100644
--- a/www/manager6/qemu/CreateWizard.js
+++ b/www/manager6/qemu/CreateWizard.js
@@ -161,7 +161,7 @@ Ext.define('PVE.qemu.CreateWizard', {
var nodename = kv.nodename;
delete kv.nodename;
 
-   if (me.qemuScsiController && !kv.scsihw) {
+   if (me.qemuScsiController) {
kv.scsihw = me.qemuScsiController;
}
 
diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index e7535f50..464aa49c 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -115,10 +115,6 @@ Ext.define('PVE.qemu.HDInputPanel', {
 
if (values.iothread) {
me.drive.iothread = 'on';
-   // do not silently change a VM-wide option after creating it
-   if (me.insideWizard) {
-   params.scsihw = 'virtio-scsi-single';
-   }
} else {
delete me.drive.iothread;
}
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v2 02/10] Move Wizard static properties to class body

2017-09-12 Thread Emmanuel Kasper
This allow those properties to be easily overriden in subclasses in a later step
---
 www/manager6/window/Wizard.js | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/www/manager6/window/Wizard.js b/www/manager6/window/Wizard.js
index 7ae58776..26c3ceaf 100644
--- a/www/manager6/window/Wizard.js
+++ b/www/manager6/window/Wizard.js
@@ -1,5 +1,13 @@
 Ext.define('PVE.window.Wizard', {
 extend: 'Ext.window.Window',
+width: 620,
+height: 450,
+modal: true,
+border: false,
+draggable: true,
+closable: true,
+resizable: false,
+layout: 'border',
 
 activeTitle: '', // used for automated testing
 
@@ -175,14 +183,6 @@ Ext.define('PVE.window.Wizard', {
}
 
Ext.apply(me, {
-   width: 620,
-   height: 450,
-   modal: true,
-   border: false,
-   draggable: true,
-   closable: true,
-   resizable: false,
-   layout: 'border',
items: [
{
// disabled for now - not really needed
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v2 03/10] Do not use 'autoselect' as a boolean when preselecting a bus

2017-09-12 Thread Emmanuel Kasper
The bus selector is displayed when we add a Hard Disk or CD Drive.
When it is displayed, we *always* preselect the next available
slot on the controller of our choice.
So this test is not needed.

We keep the test on the string value of 'autoselect' to select
a bus position when adding a CD Drive.
---
 www/manager6/form/ControllerSelector.js | 53 -
 www/manager6/qemu/HDEdit.js |  2 +-
 2 files changed, 27 insertions(+), 28 deletions(-)

diff --git a/www/manager6/form/ControllerSelector.js 
b/www/manager6/form/ControllerSelector.js
index 002134ef..045e7d0d 100644
--- a/www/manager6/form/ControllerSelector.js
+++ b/www/manager6/form/ControllerSelector.js
@@ -58,37 +58,36 @@ Ext.define('PVE.form.ControllerSelector', {
var me = this;
 
me.vmconfig = Ext.apply({}, vmconfig);
-   if (autoSelect) {
-   var clist = ['ide', 'virtio', 'scsi', 'sata'];
-   if (autoSelect === 'cdrom') {
-   clist = ['ide', 'scsi', 'sata'];
-   if (!Ext.isDefined(me.vmconfig.ide2)) {
-   me.down('field[name=controller]').setValue('ide');
-   me.down('field[name=deviceid]').setValue(2);
-   return;
-   }
-   } else  {
-   // in most cases we want to add a disk to the same controller
-   // we previously used
-   clist = me.sortByPreviousUsage(me.vmconfig, clist);
+
+   var clist = ['ide', 'virtio', 'scsi', 'sata'];
+   if (autoSelect === 'cdrom') {
+   clist = ['ide', 'scsi', 'sata'];
+   if (!Ext.isDefined(me.vmconfig.ide2)) {
+   me.down('field[name=controller]').setValue('ide');
+   me.down('field[name=deviceid]').setValue(2);
+   return;
}
+   } else  {
+   // in most cases we want to add a disk to the same controller
+   // we previously used
+   clist = me.sortByPreviousUsage(me.vmconfig, clist);
+   }
 
-   Ext.Array.each(clist, function(controller) {
-   var confid, i;
-   if ((controller === 'virtio' && me.noVirtIO) ||
+   Ext.Array.each(clist, function(controller) {
+   var confid, i;
+   if ((controller === 'virtio' && me.noVirtIO) ||
(controller === 'scsi' && me.noScsi)) {
-   return; //continue
-   }
-   me.down('field[name=controller]').setValue(controller);
-   for (i = 0; i <= 
PVE.form.ControllerSelector.maxIds[controller]; i++) {
-   confid = controller + i.toString();
-   if (!Ext.isDefined(me.vmconfig[confid])) {
-   me.down('field[name=deviceid]').setValue(i);
-   return false; // break
-   }
+   return; //continue
+   }
+   me.down('field[name=controller]').setValue(controller);
+   for (i = 0; i <= PVE.form.ControllerSelector.maxIds[controller]; 
i++) {
+   confid = controller + i.toString();
+   if (!Ext.isDefined(me.vmconfig[confid])) {
+   me.down('field[name=deviceid]').setValue(i);
+   return false; // break
}
-   });
-   }
+   }
+   });
me.down('field[name=deviceid]').validate();
 },
 
diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index 464aa49c..2874bfa8 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -136,7 +136,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
me.vmconfig = vmconfig;
 
if (me.bussel) {
-   me.bussel.setVMConfig(vmconfig, true);
+   me.bussel.setVMConfig(vmconfig);
}
if (me.unusedDisks) {
var disklist = [];
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v2 08/10] Improve the display names of VirtIO blk and VirtIO SCSI controllers

2017-09-12 Thread Emmanuel Kasper
SCSI is redundant in the VirtIO SCSI controller type.
VirtIO blk allows to better understand the different choices in the Combobox
and is also the name used by Qemu upstream.
---
 www/manager6/Utils.js| 4 ++--
 www/manager6/form/BusTypeSelector.js | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 0b850977..9f79506a 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -202,9 +202,9 @@ Ext.define('PVE.Utils', { utilities: {
} else if (value === 'megasas') {
return 'MegaRAID SAS 8708EM2';
} else if (value === 'virtio-scsi-pci') {
-   return 'VirtIO SCSI';
+   return 'VirtIO';
} else if (value === 'virtio-scsi-single') {
-   return 'VirtIO SCSI single';
+   return 'VirtIO single';
} else if (value === 'pvscsi') {
return 'VMware PVSCSI';
} else {
diff --git a/www/manager6/form/BusTypeSelector.js 
b/www/manager6/form/BusTypeSelector.js
index afcbb1eb..79a4a2bb 100644
--- a/www/manager6/form/BusTypeSelector.js
+++ b/www/manager6/form/BusTypeSelector.js
@@ -7,7 +7,7 @@ Ext.define('PVE.form.BusTypeSelector', {
 // ordering matters
 busList: [
['ide', 'IDE'],
-   ['virtio', 'VirtIO'],
+   ['virtio', 'VirtIO blk'],
['scsi', 'SCSI'],
['sata', 'SATA']
 ],
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v2 06/10] Use the noVirtIO ControllerSelector property to build the list of controllers

2017-09-12 Thread Emmanuel Kasper
---
 www/manager6/form/ControllerSelector.js | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/www/manager6/form/ControllerSelector.js 
b/www/manager6/form/ControllerSelector.js
index 15023a7a..489b97de 100644
--- a/www/manager6/form/ControllerSelector.js
+++ b/www/manager6/form/ControllerSelector.js
@@ -61,9 +61,9 @@ Ext.define('PVE.form.ControllerSelector', {
var bussel = me.down('field[name=controller]');
var deviceid = me.down('field[name=deviceid]');
 
-   if (autoSelect === 'cdrom') {
+   if (me.noVirtIO) {
clist = ['ide', 'scsi', 'sata'];
-   if (!Ext.isDefined(me.vmconfig.ide2)) {
+   if (autoSelect === 'cdrom' && !Ext.isDefined(me.vmconfig.ide2)) {
bussel.setValue('ide');
deviceid.setValue(2);
return;
@@ -76,9 +76,6 @@ Ext.define('PVE.form.ControllerSelector', {
 
Ext.Array.each(clist, function(controller) {
var confid, i;
-   if (controller === 'virtio' && me.noVirtIO) {
-   return; //continue
-   }
bussel.setValue(controller);
for (i = 0; i <= PVE.form.ControllerSelector.maxIds[controller]; 
i++) {
confid = controller + i.toString();
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v2 04/10] Remove unused noScsi parameter

2017-09-12 Thread Emmanuel Kasper
SCSI is a valid bus for Disks and CD drives, so it should always
be appear in the bus list.
---
 www/manager6/form/BusTypeSelector.js| 6 +-
 www/manager6/form/ControllerSelector.js | 6 +-
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/www/manager6/form/BusTypeSelector.js 
b/www/manager6/form/BusTypeSelector.js
index 9b9492fc..ae7c327e 100644
--- a/www/manager6/form/BusTypeSelector.js
+++ b/www/manager6/form/BusTypeSelector.js
@@ -4,8 +4,6 @@ Ext.define('PVE.form.BusTypeSelector', {
   
 noVirtIO: false,
 
-noScsi: false,
-
 initComponent: function() {
var me = this;
 
@@ -15,9 +13,7 @@ Ext.define('PVE.form.BusTypeSelector', {
me.comboItems.push(['virtio', 'VirtIO']);
}
 
-   if (!me.noScsi) {
-   me.comboItems.push(['scsi', 'SCSI']);
-   }
+   me.comboItems.push(['scsi', 'SCSI']);
 
me.callParent();
 }
diff --git a/www/manager6/form/ControllerSelector.js 
b/www/manager6/form/ControllerSelector.js
index 045e7d0d..14ad574e 100644
--- a/www/manager6/form/ControllerSelector.js
+++ b/www/manager6/form/ControllerSelector.js
@@ -13,8 +13,6 @@ Ext.define('PVE.form.ControllerSelector', {
 
 noVirtIO: false,
 
-noScsi: false,
-
 vmconfig: {}, // used to check for existing devices
 
 sortByPreviousUsage: function(vmconfig, controllerList) {
@@ -75,8 +73,7 @@ Ext.define('PVE.form.ControllerSelector', {
 
Ext.Array.each(clist, function(controller) {
var confid, i;
-   if ((controller === 'virtio' && me.noVirtIO) ||
-   (controller === 'scsi' && me.noScsi)) {
+   if (controller === 'virtio' && me.noVirtIO) {
return; //continue
}
me.down('field[name=controller]').setValue(controller);
@@ -106,7 +103,6 @@ Ext.define('PVE.form.ControllerSelector', {
name: 'controller',
value: PVE.qemu.OSDefaults.generic.busType,
noVirtIO: me.noVirtIO,
-   noScsi: me.noScsi,
allowBlank: false,
flex: 2,
listeners: {
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v2 05/10] Save the components we found via down() in a variable for later reuse.

2017-09-12 Thread Emmanuel Kasper
---
 www/manager6/form/ControllerSelector.js | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/www/manager6/form/ControllerSelector.js 
b/www/manager6/form/ControllerSelector.js
index 14ad574e..15023a7a 100644
--- a/www/manager6/form/ControllerSelector.js
+++ b/www/manager6/form/ControllerSelector.js
@@ -58,11 +58,14 @@ Ext.define('PVE.form.ControllerSelector', {
me.vmconfig = Ext.apply({}, vmconfig);
 
var clist = ['ide', 'virtio', 'scsi', 'sata'];
+   var bussel = me.down('field[name=controller]');
+   var deviceid = me.down('field[name=deviceid]');
+
if (autoSelect === 'cdrom') {
clist = ['ide', 'scsi', 'sata'];
if (!Ext.isDefined(me.vmconfig.ide2)) {
-   me.down('field[name=controller]').setValue('ide');
-   me.down('field[name=deviceid]').setValue(2);
+   bussel.setValue('ide');
+   deviceid.setValue(2);
return;
}
} else  {
@@ -76,16 +79,16 @@ Ext.define('PVE.form.ControllerSelector', {
if (controller === 'virtio' && me.noVirtIO) {
return; //continue
}
-   me.down('field[name=controller]').setValue(controller);
+   bussel.setValue(controller);
for (i = 0; i <= PVE.form.ControllerSelector.maxIds[controller]; 
i++) {
confid = controller + i.toString();
if (!Ext.isDefined(me.vmconfig[confid])) {
-   me.down('field[name=deviceid]').setValue(i);
+   deviceid.setValue(i);
return false; // break
}
}
});
-   me.down('field[name=deviceid]').validate();
+   deviceid.validate();
 },
 
 initComponent: function() {
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v2 10/10] Propagate the SCSI hw to the Hard Disk panel when selecting an OS

2017-09-12 Thread Emmanuel Kasper
---
 www/manager6/qemu/OSTypeEdit.js | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/www/manager6/qemu/OSTypeEdit.js b/www/manager6/qemu/OSTypeEdit.js
index 162a92ec..a779ab91 100644
--- a/www/manager6/qemu/OSTypeEdit.js
+++ b/www/manager6/qemu/OSTypeEdit.js
@@ -22,18 +22,21 @@ Ext.define('PVE.qemu.OSTypeInputPanel', {
targetValues = PVE.qemu.OSDefaults.generic;
}
 
-   me.setWidget('pveBusSelector', targetValues.busType);
-   me.setWidget('pveNetworkCardSelector', 
targetValues.networkCard);
+   me.queryWidget('pveBusSelector')
+   .buildDefaultStore(targetValues.scsihw)
+   .setValue(targetValues.busType);
+
+   
me.queryWidget('pveNetworkCardSelector').setValue(targetValues.networkCard);
me.setWizardHiddenValue('qemuScsiController', 
targetValues.scsihw);
}
}
},
-   setWidget: function(widget, newValue) {
+   queryWidget: function(widget) {
// changing a widget is safe only if ComponentQuery.query returns us
// a single value array
var widgets = Ext.ComponentQuery.query('pveQemuCreateWizard ' + 
widget);
if (widgets.length === 1) {
-   widgets[0].setValue(newValue);
+   return widgets[0];
} else {
throw 'non unique widget :' + widget + ' in Wizard';
}
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v2 07/10] Enhance BusStypeSelector with the SCSI controller description

2017-09-12 Thread Emmanuel Kasper
Since we started in PVE 4.3 to autoselect SCSI for new Linux VMs,
it was not clear that this controller actually uses a pv virtio
driver, which is confusing for users.

See for example:
https://forum.proxmox.com/threads/proxmox-hypervisor-scsi-or-virtio.36506/#post-179056

The vm configuration is only available to components of an InputPanel
after the components has been by the input panel, so we rebuild the
backing store when we get the vmconfig.

Note that we don't extend KVComboBox anymore because we need to set the store
ourselves and not via ComboItems. We were never using KVComboBox functionality 
anyway
since this combobox was never empty nor invalid.
---
 www/manager6/form/BusTypeSelector.js| 58 +++--
 www/manager6/form/ControllerSelector.js |  8 ++---
 www/manager6/qemu/HDEdit.js |  3 ++
 3 files changed, 55 insertions(+), 14 deletions(-)

diff --git a/www/manager6/form/BusTypeSelector.js 
b/www/manager6/form/BusTypeSelector.js
index ae7c327e..afcbb1eb 100644
--- a/www/manager6/form/BusTypeSelector.js
+++ b/www/manager6/form/BusTypeSelector.js
@@ -1,20 +1,58 @@
 Ext.define('PVE.form.BusTypeSelector', {
-extend: 'PVE.form.KVComboBox',
+extend: 'Ext.form.field.ComboBox',
 alias: 'widget.pveBusSelector',
-  
-noVirtIO: false,
+allowBlank: false,
+editable: false,
 
-initComponent: function() {
-   var me = this;
+// ordering matters
+busList: [
+   ['ide', 'IDE'],
+   ['virtio', 'VirtIO'],
+   ['scsi', 'SCSI'],
+   ['sata', 'SATA']
+],
+
+getBusTypes: function() {
+   return this.busList.map(function (el) {
+   return el[0];
+   });
+},
 
-   me.comboItems = [['ide', 'IDE'], ['sata', 'SATA']];
+describeBus: function(bus, scsihw) {
+   var desc;
+   var i;
 
-   if (!me.noVirtIO) {
-   me.comboItems.push(['virtio', 'VirtIO']);
+   if (bus === 'scsi') {
+   desc = this.busList[2][1] + ' - ' + PVE.Utils.render_scsihw(scsihw);
+   return desc;
}
 
-   me.comboItems.push(['scsi', 'SCSI']);
+   for (i = 0; i < this.busList.length; i++) {
+   if (bus === this.busList[i][0]) {
+   desc = this.busList[i][1];
+   return desc;
+   }
+   }
+},
 
-   me.callParent();
+// once we know the vmconfig, rebuild the store with scsihw full 
description
+buildStore: function(busses, scsihw) {
+   var me = this;
+   var store = [];
+   Ext.Array.forEach(busses, function(bus) {
+   store.push([bus, me.describeBus(bus, scsihw)]);
+   });
+   me.setStore(store);
+   return me;
+},
+
+buildDefaultStore: function(scsihw) {
+   var me = this;
+   this.buildStore(me.getBusTypes(), scsihw);
+   return me;
+},
+
+initComponent: function() {
+   this.buildDefaultStore().callParent();
 }
 });
diff --git a/www/manager6/form/ControllerSelector.js 
b/www/manager6/form/ControllerSelector.js
index 489b97de..a2298fd8 100644
--- a/www/manager6/form/ControllerSelector.js
+++ b/www/manager6/form/ControllerSelector.js
@@ -57,12 +57,13 @@ Ext.define('PVE.form.ControllerSelector', {
 
me.vmconfig = Ext.apply({}, vmconfig);
 
-   var clist = ['ide', 'virtio', 'scsi', 'sata'];
var bussel = me.down('field[name=controller]');
var deviceid = me.down('field[name=deviceid]');
+   var clist = bussel.getBusTypes();
 
if (me.noVirtIO) {
-   clist = ['ide', 'scsi', 'sata'];
+   clist.splice(1, 1); // remove virtio blk
+   bussel.buildStore(clist, me.vmconfig.scsihw);
if (autoSelect === 'cdrom' && !Ext.isDefined(me.vmconfig.ide2)) {
bussel.setValue('ide');
deviceid.setValue(2);
@@ -72,6 +73,7 @@ Ext.define('PVE.form.ControllerSelector', {
// in most cases we want to add a disk to the same controller
// we previously used
clist = me.sortByPreviousUsage(me.vmconfig, clist);
+   bussel.buildStore(clist, me.vmconfig.scsihw);
}
 
Ext.Array.each(clist, function(controller) {
@@ -102,8 +104,6 @@ Ext.define('PVE.form.ControllerSelector', {
xtype: 'pveBusSelector',
name: 'controller',
value: PVE.qemu.OSDefaults.generic.busType,
-   noVirtIO: me.noVirtIO,
-   allowBlank: false,
flex: 2,
listeners: {
change: function(t, value) {
diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index 2874bfa8..9fbbc763 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -17,6 +17,9 @@ Ext.define('PVE.qemu.HDInputPanel', {
 
onControllerChange: function(field) {
var value = field.getValue();
+   if (!value) {
+   return;
+   }
 
var 

[pve-devel] [PATCH manager v2 09/10] Make room in QemuWizard and Edit Window so that the larger combo boxes properly fit

2017-09-12 Thread Emmanuel Kasper
This will benefit the BusTypeSelector, the DiskFormatSelector, the CD 
FileSelector,
and possibily other long fields like vm name, pool name.
---
 www/manager6/form/ControllerSelector.js | 4 ++--
 www/manager6/qemu/CDEdit.js | 3 +++
 www/manager6/qemu/CreateWizard.js   | 1 +
 www/manager6/qemu/HDEdit.js | 3 +++
 www/manager6/window/Edit.js | 3 +++
 5 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/www/manager6/form/ControllerSelector.js 
b/www/manager6/form/ControllerSelector.js
index a2298fd8..a3205632 100644
--- a/www/manager6/form/ControllerSelector.js
+++ b/www/manager6/form/ControllerSelector.js
@@ -104,7 +104,7 @@ Ext.define('PVE.form.ControllerSelector', {
xtype: 'pveBusSelector',
name: 'controller',
value: PVE.qemu.OSDefaults.generic.busType,
-   flex: 2,
+   flex: 1,
listeners: {
change: function(t, value) {
if (!me.rendered || !value) {
@@ -119,10 +119,10 @@ Ext.define('PVE.form.ControllerSelector', {
{
xtype: 'pveIntegerField',
name: 'deviceid',
+   width: 50,
minValue: 0,
maxValue: PVE.form.ControllerSelector.maxIds.ide,
value: '0',
-   flex: 1,
validator: function(value) {
/*jslint confusion: true */
if (!me.rendered) {
diff --git a/www/manager6/qemu/CDEdit.js b/www/manager6/qemu/CDEdit.js
index 51921b8d..0c660a1d 100644
--- a/www/manager6/qemu/CDEdit.js
+++ b/www/manager6/qemu/CDEdit.js
@@ -147,6 +147,9 @@ Ext.define('PVE.qemu.CDInputPanel', {
 
 Ext.define('PVE.qemu.CDEdit', {
 extend: 'PVE.window.Edit',
+fieldDefaults: {
+   width: 140
+},
 
 initComponent : function() {
var me = this;
diff --git a/www/manager6/qemu/CreateWizard.js 
b/www/manager6/qemu/CreateWizard.js
index 944309a6..a01fc81b 100644
--- a/www/manager6/qemu/CreateWizard.js
+++ b/www/manager6/qemu/CreateWizard.js
@@ -2,6 +2,7 @@ Ext.define('PVE.qemu.CreateWizard', {
 extend: 'PVE.window.Wizard',
 alias: 'widget.pveQemuCreateWizard',
 qemuScsiController: undefined,
+width: 680,
 
 controller: {
 
diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index 9fbbc763..5d4e7c89 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -300,6 +300,9 @@ Ext.define('PVE.qemu.HDEdit', {
 extend: 'PVE.window.Edit',
 
 isAdd: true,
+fieldDefaults: {
+   width: 140
+},
 
 initComponent : function() {
var me = this;
diff --git a/www/manager6/window/Edit.js b/www/manager6/window/Edit.js
index 9a026683..9941c5d1 100644
--- a/www/manager6/window/Edit.js
+++ b/www/manager6/window/Edit.js
@@ -259,6 +259,9 @@ Ext.define('PVE.window.Edit', {
colwidth += me.fieldDefaults.labelWidth - 100;
}

+   if (me.fieldDefaults && me.fieldDefaults.width) {
+   colwidth += me.fieldDefaults.width - 100;
+   }
 
var twoColumn = items[0].column1 || items[0].column2;
 
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] [PATCH manager v2 09/10] Make room in QemuWizard and Edit Window so that the larger combo boxes properly fit

2017-09-13 Thread Emmanuel Kasper
Q

On 09/13/2017 07:09 AM, Thomas Lamprecht wrote:
> On 09/12/2017 02:44 PM, Emmanuel Kasper wrote:
>> This will benefit the BusTypeSelector, the DiskFormatSelector, the CD
>> FileSelector,
>> and possibily other long fields like vm name, pool name.
>> ---
>>   www/manager6/form/ControllerSelector.js | 4 ++--
>>   www/manager6/qemu/CDEdit.js | 3 +++
>>   www/manager6/qemu/CreateWizard.js   | 1 +
>>   www/manager6/qemu/HDEdit.js | 3 +++
>>   www/manager6/window/Edit.js | 3 +++
>>   5 files changed, 12 insertions(+), 2 deletions(-)
>>
>> diff --git a/www/manager6/form/ControllerSelector.js
>> b/www/manager6/form/ControllerSelector.js
>> index a2298fd8..a3205632 100644
>> --- a/www/manager6/form/ControllerSelector.js
>> +++ b/www/manager6/form/ControllerSelector.js
>> @@ -104,7 +104,7 @@ Ext.define('PVE.form.ControllerSelector', {
>>   xtype: 'pveBusSelector',
>>   name: 'controller',
>>   value: PVE.qemu.OSDefaults.generic.busType,
>> -flex: 2,
>> +flex: 1,
>>   listeners: {
>>   change: function(t, value) {
>>   if (!me.rendered || !value) {
>> @@ -119,10 +119,10 @@ Ext.define('PVE.form.ControllerSelector', {
>>   {
>>   xtype: 'pveIntegerField',
>>   name: 'deviceid',
>> +width: 50,
>>   minValue: 0,
>>   maxValue: PVE.form.ControllerSelector.maxIds.ide,
>>   value: '0',
>> -flex: 1,
>>   validator: function(value) {
>>   /*jslint confusion: true */
>>   if (!me.rendered) {
>> diff --git a/www/manager6/qemu/CDEdit.js b/www/manager6/qemu/CDEdit.js
>> index 51921b8d..0c660a1d 100644
>> --- a/www/manager6/qemu/CDEdit.js
>> +++ b/www/manager6/qemu/CDEdit.js
>> @@ -147,6 +147,9 @@ Ext.define('PVE.qemu.CDInputPanel', {
>> Ext.define('PVE.qemu.CDEdit', {
>>   extend: 'PVE.window.Edit',
>> +fieldDefaults: {
>> +width: 140
>> +},
>> initComponent : function() {
>>   var me = this;
>> diff --git a/www/manager6/qemu/CreateWizard.js
>> b/www/manager6/qemu/CreateWizard.js
>> index 944309a6..a01fc81b 100644
>> --- a/www/manager6/qemu/CreateWizard.js
>> +++ b/www/manager6/qemu/CreateWizard.js
>> @@ -2,6 +2,7 @@ Ext.define('PVE.qemu.CreateWizard', {
>>   extend: 'PVE.window.Wizard',
>>   alias: 'widget.pveQemuCreateWizard',
>>   qemuScsiController: undefined,
>> +width: 680,
> 
> 
> So my "increase create wizard" patch would make sense, after all. :)

I put more stuff inside the combo box so it makes sense :)

> Here you change the height/width ratio and do it only for VMs, not for
> CTs...
> Not sure if that better than the approach I've taken, i.e. keep them
> both in
> sync so that the wizard have a more consistent appearance and keep our
> old ratio.

> But wider is more popular currently, as it seems, so maybe change the ratio
> but I'd then sync up CTs wizard too.

Why not.

> The rest looks OK, even if I don't like fixed with. They are the cause
> of the
> often to narrow column widths in grids where headings and/or data gets
> ellipsized
> as they where all made with the older theme in mind, but that's another
> problem...

I am not a fan of magic width too, but I don't see an easy alternative here.

___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH qemu-server v8 1/6] Force overwriting existing compressed man pages and symbolic links

2017-09-13 Thread Emmanuel Kasper
This allows calling the 'make install' target twice in a row.
---
 Makefile | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index e9482f2..998d17a 100644
--- a/Makefile
+++ b/Makefile
@@ -69,12 +69,12 @@ install: ${PKGSOURCES}
install -D -m 0644 modules-load.conf 
${DESTDIR}/etc/modules-load.d/qemu-server.conf
install -m 0755 qmextract ${DESTDIR}${LIBDIR}
install -m 0644 qm.1 ${DESTDIR}/${MAN1DIR}
-   gzip -9 -n ${DESTDIR}/${MAN1DIR}/qm.1
+   gzip -9 -n -f ${DESTDIR}/${MAN1DIR}/qm.1
install -m 0644 qmrestore.1 ${DESTDIR}/${MAN1DIR}
-   gzip -9 -n ${DESTDIR}/${MAN1DIR}/qmrestore.1
+   gzip -9 -n -f ${DESTDIR}/${MAN1DIR}/qmrestore.1
install -m 0644 qm.conf.5 ${DESTDIR}/${MAN5DIR}
-   gzip -9 -n ${DESTDIR}/${MAN5DIR}/qm.conf.5
-   cd ${DESTDIR}/${MAN5DIR}; ln -s qm.conf.5.gz vm.conf.5.gz
+   gzip -9 -n -f ${DESTDIR}/${MAN5DIR}/qm.conf.5
+   cd ${DESTDIR}/${MAN5DIR}; ln -s -f qm.conf.5.gz vm.conf.5.gz
 
 .PHONY: deb
 deb: ${DEB}
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH qemu-server v8 6/6] Add new qm command 'importovf', to create VMs from an OVF manifest

2017-09-13 Thread Emmanuel Kasper
Currently the following extracted parameters are used to create a VM:
* VM name
* Memory
* Number of cores
* Disks
---
 PVE/CLI/qm.pm | 99 +++
 1 file changed, 99 insertions(+)

diff --git a/PVE/CLI/qm.pm b/PVE/CLI/qm.pm
index 5dce10f..0a5571b 100755
--- a/PVE/CLI/qm.pm
+++ b/PVE/CLI/qm.pm
@@ -18,10 +18,12 @@ use PVE::INotify;
 use PVE::RPCEnvironment;
 use PVE::QemuServer;
 use PVE::QemuServer::ImportDisk;
+use PVE::QemuServer::OVF;
 use PVE::API2::Qemu;
 use JSON;
 use PVE::JSONSchema qw(get_standard_option);
 use Term::ReadLine;
+use Data::Dumper;
 
 use PVE::CLIHandler;
 
@@ -509,6 +511,100 @@ __PACKAGE__->register_method ({
return undef;
 }});
 
+__PACKAGE__->register_method ({
+name => 'importovf',
+path => 'importovf',
+description => "Create a new VM using parameters read from an OVF 
manifest",
+parameters => {
+   additionalProperties => 0,
+   properties => {
+   vmid => get_standard_option('pve-vmid', { completion => 
\&PVE::Cluster::complete_next_vmid }),
+   manifest => {
+   type => 'string',
+   description => 'path to the ovf file',
+   },
+   storage => get_standard_option('pve-storage-id', {
+   description => 'Target storage ID',
+   completion => \&PVE::QemuServer::complete_storage,
+   optional => 0,
+   }),
+   format => {
+   type => 'string',
+   description => 'Target format',
+   enum => [ 'raw', 'qcow2', 'vmdk' ],
+   optional => 1,
+   },
+   dryrun => {
+   type => 'boolean',
+   description => 'Print a parsed representation of the extracted 
OVF parameters, but do not create a VM',
+   optional => 1,
+   }
+   },
+},
+returns => { type => 'string'},
+code => sub {
+   my ($param) = @_;
+
+   my $vmid = PVE::Tools::extract_param($param, 'vmid');
+   my $ovf_file = PVE::Tools::extract_param($param, 'manifest');
+   my $storeid = PVE::Tools::extract_param($param, 'storage');
+   my $format = PVE::Tools::extract_param($param, 'format');
+   my $dryrun = PVE::Tools::extract_param($param, 'dryrun');
+
+   die "$ovf_file: non-existent or non-regular file\n" if (! -f $ovf_file);
+   my $storecfg = PVE::Storage::config();
+   PVE::Storage::storage_check_enabled($storecfg, $storeid);
+
+   my $parsed = PVE::QemuServer::OVF::parse_ovf($ovf_file);
+
+   if ($dryrun) {
+   print Dumper($parsed);
+   exit(0);
+   }
+
+   $param->{name} = $parsed->{qm}->{name} if 
defined($parsed->{qm}->{name});
+   $param->{memory} = $parsed->{qm}->{memory} if 
defined($parsed->{qm}->{memory});
+   $param->{cores} = $parsed->{qm}->{cores} if 
defined($parsed->{qm}->{cores});
+
+   my $importfn = sub {
+
+   PVE::Cluster::check_vmid_unused($vmid);
+
+   my $conf = $param;
+
+   eval {
+   # order matters, as do_import() will load_config() internally
+   $conf->{smbios1} = PVE::QemuServer::generate_smbios1_uuid();
+   PVE::QemuConfig->write_config($vmid, $conf);
+
+   foreach my $disk (@{ $parsed->{disks} }) {
+   my ($file, $drive) = ($disk->{backing_file}, 
$disk->{disk_address});
+   PVE::QemuServer::ImportDisk::do_import($file, $vmid, 
$storeid,
+   { drive_name => $drive, format => $format });
+   }
+
+   # reload after disks entries have been created
+   $conf = PVE::QemuConfig->load_config($vmid);
+   PVE::QemuConfig->check_lock($conf);
+   my $firstdisk = PVE::QemuServer::resolve_first_disk($conf);
+   $conf->{bootdisk} = $firstdisk if $firstdisk;
+   PVE::QemuConfig->write_config($vmid, $conf);
+  };
+
+   my $err = $@;
+   if ($err) {
+   my $skiplock = 1;
+   eval { PVE::QemuServer::vm_destroy($storecfg, $vmid, 
$skiplock); };
+   die "import failed - $err";
+   }
+
+   };
+
+   my $wait_for_lock = 1;
+   return PVE::QemuConfig->lock_config_full($vmid, $wait_for_lock, 
$importfn);
+
+}
+});
 
 my $print_agent_result = sub {
 my ($data) = @_;
@@ -666,6 +762,9 @@ our $cmddef = {
 terminal => [ __PACKAGE__, 'terminal', ['vmid']],
 
 importdisk => [ __PACKAGE__, 'importdisk', ['vmid', 'source', 'storage']],
+
+importovf => [ __PACKAGE__, 'importovf', ['vmid', 'manifest', 'storage']],
+
 };
 
 1;
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH qemu-server v8 3/6] Initial support for importing OVF virtual machines

2017-09-13 Thread Emmanuel Kasper
Following OVF parameters will be extracted:
 * VM name
 * Memory
 * Number of cores
 * disks and their associated controllers
---
 PVE/QemuServer/Makefile |   1 +
 PVE/QemuServer/OVF.pm   | 236 
 2 files changed, 237 insertions(+)
 create mode 100644 PVE/QemuServer/OVF.pm

diff --git a/PVE/QemuServer/Makefile b/PVE/QemuServer/Makefile
index f75f2e6..49f65f3 100644
--- a/PVE/QemuServer/Makefile
+++ b/PVE/QemuServer/Makefile
@@ -4,3 +4,4 @@ install:
install -D -m 0644 USB.pm ${DESTDIR}${PERLDIR}/PVE/QemuServer/USB.pm
install -D -m 0644 Memory.pm 
${DESTDIR}${PERLDIR}/PVE/QemuServer/Memory.pm
install -D -m 0644 ImportDisk.pm 
${DESTDIR}${PERLDIR}/PVE/QemuServer/ImportDisk.pm
+   install -D -m 0644 OVF.pm ${DESTDIR}${PERLDIR}/PVE/QemuServer/OVF.pm
diff --git a/PVE/QemuServer/OVF.pm b/PVE/QemuServer/OVF.pm
new file mode 100644
index 000..7ee4dc8
--- /dev/null
+++ b/PVE/QemuServer/OVF.pm
@@ -0,0 +1,236 @@
+# Open Virtualization Format import routines
+# https://www.dmtf.org/standards/ovf
+package PVE::QemuServer::OVF;
+
+use strict;
+use warnings;
+
+use XML::LibXML;
+use File::Spec;
+use File::Basename;
+use Data::Dumper;
+use Cwd 'realpath';
+
+use PVE::Tools;
+use PVE::Storage;
+
+# map OVF resources types to descriptive strings
+# this will allow us to explore the xml tree without using magic numbers
+# 
http://schemas.dmtf.org/wbem/cim-html/2/CIM_ResourceAllocationSettingData.html
+my @resources = (
+{ id => 1, dtmf_name => 'Other' },
+{ id => 2, dtmf_name => 'Computer System' },
+{ id => 3, dtmf_name => 'Processor' },
+{ id => 4, dtmf_name => 'Memory' },
+{ id => 5, dtmf_name => 'IDE Controller', pve_type => 'ide' },
+{ id => 6, dtmf_name => 'Parallel SCSI HBA', pve_type => 'scsi' },
+{ id => 7, dtmf_name => 'FC HBA' },
+{ id => 8, dtmf_name => 'iSCSI HBA' },
+{ id => 9, dtmf_name => 'IB HCA' },
+{ id => 10, dtmf_name => 'Ethernet Adapter' },
+{ id => 11, dtmf_name => 'Other Network Adapter' },
+{ id => 12, dtmf_name => 'I/O Slot' },
+{ id => 13, dtmf_name => 'I/O Device' },
+{ id => 14, dtmf_name => 'Floppy Drive' },
+{ id => 15, dtmf_name => 'CD Drive' },
+{ id => 16, dtmf_name => 'DVD drive' },
+{ id => 17, dtmf_name => 'Disk Drive' },
+{ id => 18, dtmf_name => 'Tape Drive' },
+{ id => 19, dtmf_name => 'Storage Extent' },
+{ id => 20, dtmf_name => 'Other storage device', pve_type => 'sata'},
+{ id => 21, dtmf_name => 'Serial port' },
+{ id => 22, dtmf_name => 'Parallel port' },
+{ id => 23, dtmf_name => 'USB Controller' },
+{ id => 24, dtmf_name => 'Graphics controller' },
+{ id => 25, dtmf_name => 'IEEE 1394 Controller' },
+{ id => 26, dtmf_name => 'Partitionable Unit' },
+{ id => 27, dtmf_name => 'Base Partitionable Unit' },
+{ id => 28, dtmf_name => 'Power' },
+{ id => 29, dtmf_name => 'Cooling Capacity' },
+{ id => 30, dtmf_name => 'Ethernet Switch Port' },
+{ id => 31, dtmf_name => 'Logical Disk' },
+{ id => 32, dtmf_name => 'Storage Volume' },
+{ id => 33, dtmf_name => 'Ethernet Connection' },
+{ id => 34, dtmf_name => 'DMTF reserved' },
+{ id => 35, dtmf_name => 'Vendor Reserved'}
+);
+
+sub find_by {
+my ($key, $param) = @_;
+foreach my $resource (@resources) {
+   if ($resource->{$key} eq $param) {
+   return ($resource);
+   }
+}
+return undef;
+}
+
+sub dtmf_name_to_id {
+my ($dtmf_name) = @_;
+my $found = find_by('dtmf_name', $dtmf_name);
+if ($found) {
+   return $found->{id};
+} else {
+   return undef;
+}
+}
+
+sub id_to_pve {
+my ($id) = @_;
+my $resource = find_by('id', $id);
+if ($resource) {
+   return $resource->{pve_type};
+} else {
+   return undef;
+}
+}
+
+# returns two references, $qm which holds qm.conf style key/values, and \@disks
+sub parse_ovf {
+my ($ovf, $debug) = @_;
+
+my $dom = XML::LibXML->load_xml(location => $ovf, no_blanks => 1);
+
+# register the xml namespaces in a xpath context object
+# 'ovf' is the default namespace so it will prepended to each xml element
+my $xpc = XML::LibXML::XPathContext->new($dom);
+$xpc->registerNs('ovf', 'http://schemas.dmtf.org/ovf/envelope/1');
+$xpc->registerNs('rasd', 
'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData');
+$xpc->registerNs('vssd', 
'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData');
+
+
+# hash to save qm.conf parameters
+my $qm;
+
+#array to save a disk list
+my @disks;
+
+# easy xpath
+# walk down the dom until we find the matching XML element
+my $xpath_find_name = "/ovf:Envelope/ovf:VirtualSystem/ovf:Name";
+my $ovf_name = $xpc->findvalue($xpath_find_name);
+
+if ($ovf_name) {
+   ($qm->{name} = $ovf_name) =~ s/[^a-zA-Z0-9\-]//g; # 
PVE::QemuServer::confdesc requires a valid

[pve-devel] [PATCH qemu-server v8 0/6] Add qm importovf command

2017-09-13 Thread Emmanuel Kasper
bumping this after the topic has been brough in forum:
https://forum.proxmox.com/threads/procedure-to-import-vmware-ova-to-proxmox-5-0-23-with-zfs-vm-store.36779/#post-180321

changes since V7:
rebase on master

Emmanuel Kasper (6):
  Force overwriting existing compressed man pages and symbolic links
  Add a build dependency to libxml-libxml-perl, needed for OVF parsing
  Initial support for importing OVF virtual machines
  Add tests for parse_ovf function
  Refactor defaut bootdisk and smbios1 uuid generation in own subs
  Add new qm command 'importovf', to create VMs from an OVF manifest

 Makefile |   8 +-
 PVE/API2/Qemu.pm |  20 +--
 PVE/CLI/qm.pm|  99 +++
 PVE/QemuServer.pm|  20 +++
 PVE/QemuServer/Makefile  |   1 +
 PVE/QemuServer/OVF.pm| 236 +++
 debian/control   |   1 +
 test/Makefile|   5 +-
 test/ovf_manifests/Win10-Liz-disk1.vmdk  | Bin 0 -> 65536 bytes
 test/ovf_manifests/Win10-Liz.ovf | 142 
 test/ovf_manifests/Win_2008_R2_two-disks.ovf | 145 
 test/ovf_manifests/disk1.vmdk| Bin 0 -> 65536 bytes
 test/ovf_manifests/disk2.vmdk| Bin 0 -> 65536 bytes
 test/run_ovf_tests.pl|  42 +
 14 files changed, 698 insertions(+), 21 deletions(-)
 create mode 100644 PVE/QemuServer/OVF.pm
 create mode 100644 test/ovf_manifests/Win10-Liz-disk1.vmdk
 create mode 100755 test/ovf_manifests/Win10-Liz.ovf
 create mode 100755 test/ovf_manifests/Win_2008_R2_two-disks.ovf
 create mode 100644 test/ovf_manifests/disk1.vmdk
 create mode 100644 test/ovf_manifests/disk2.vmdk
 create mode 100755 test/run_ovf_tests.pl

-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH qemu-server v8 2/6] Add a build dependency to libxml-libxml-perl, needed for OVF parsing

2017-09-13 Thread Emmanuel Kasper
XML::LibXML is being actively developed, and has 91 reverse
depencies in Debian Stretch, so it should not go away.
---
 debian/control | 1 +
 1 file changed, 1 insertion(+)

diff --git a/debian/control b/debian/control
index c2000e7..d5e4bb6 100644
--- a/debian/control
+++ b/debian/control
@@ -23,6 +23,7 @@ Depends: libc6 (>= 2.7-18),
  libjson-xs-perl,
  libio-multiplex-perl,
  libnet-ssleay-perl,
+ libxml-libxml-perl,
  socat,
  pve-firewall,
  libuuid-perl,
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH qemu-server v8 5/6] Refactor defaut bootdisk and smbios1 uuid generation in own subs

2017-09-13 Thread Emmanuel Kasper
This will allow code reuse for qm importovf
---
 PVE/API2/Qemu.pm  | 20 
 PVE/QemuServer.pm | 20 
 2 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 1002c87..4173bdf 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -535,26 +535,14 @@ __PACKAGE__->register_method({
 
$vollist = &$create_disks($rpcenv, $authuser, $conf, 
$storecfg, $vmid, $pool, $param, $storage);
 
-   # try to be smart about bootdisk
-   my @disks = PVE::QemuServer::valid_drive_names();
-   my $firstdisk;
-   foreach my $ds (reverse @disks) {
-   next if !$conf->{$ds};
-   my $disk = PVE::QemuServer::parse_drive($ds, 
$conf->{$ds});
-   next if PVE::QemuServer::drive_is_cdrom($disk);
-   $firstdisk = $ds;
-   }
-
-   if (!$conf->{bootdisk} && $firstdisk) {
-   $conf->{bootdisk} = $firstdisk;
+   if (!$conf->{bootdisk}) {
+   my $firstdisk = 
PVE::QemuServer::resolve_first_disk($conf);
+   $conf->{bootdisk} = $firstdisk if $firstdisk;
}
 
# auto generate uuid if user did not specify smbios1 option
if (!$conf->{smbios1}) {
-   my ($uuid, $uuid_str);
-   UUID::generate($uuid);
-   UUID::unparse($uuid, $uuid_str);
-   $conf->{smbios1} = "uuid=$uuid_str";
+   $conf->{smbios1} = 
PVE::QemuServer::generate_smbios1_uuid();
}
 
PVE::QemuConfig->write_config($vmid, $conf);
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 2d09726..ee1cecd 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -6421,6 +6421,26 @@ sub resolve_dst_disk_format {
return $format;
 }
 
+sub resolve_first_disk {
+my $conf = shift;
+my @disks = PVE::QemuServer::valid_drive_names();
+my $firstdisk;
+foreach my $ds (reverse @disks) {
+   next if !$conf->{$ds};
+   my $disk = PVE::QemuServer::parse_drive($ds, $conf->{$ds});
+   next if PVE::QemuServer::drive_is_cdrom($disk);
+   $firstdisk = $ds;
+}
+return $firstdisk;
+}
+
+sub generate_smbios1_uuid {
+my ($uuid, $uuid_str);
+UUID::generate($uuid);
+UUID::unparse($uuid, $uuid_str);
+return "uuid=$uuid_str";
+}
+
 # bash completion helper
 
 sub complete_backup_archives {
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH qemu-server v8 4/6] Add tests for parse_ovf function

2017-09-13 Thread Emmanuel Kasper
This includes:
 * a test script
 * the manifests generated by exports from a VmWare Workstation
 *  disk images are generated from qemu-img, with a 2KB size
(it is possible to inspect the disk images with od -bc
they contain a VMDK header and the rest are null characters)
---
 test/Makefile|   5 +-
 test/ovf_manifests/Win10-Liz-disk1.vmdk  | Bin 0 -> 65536 bytes
 test/ovf_manifests/Win10-Liz.ovf | 142 ++
 test/ovf_manifests/Win_2008_R2_two-disks.ovf | 145 +++
 test/ovf_manifests/disk1.vmdk| Bin 0 -> 65536 bytes
 test/ovf_manifests/disk2.vmdk| Bin 0 -> 65536 bytes
 test/run_ovf_tests.pl|  42 
 7 files changed, 333 insertions(+), 1 deletion(-)
 create mode 100644 test/ovf_manifests/Win10-Liz-disk1.vmdk
 create mode 100755 test/ovf_manifests/Win10-Liz.ovf
 create mode 100755 test/ovf_manifests/Win_2008_R2_two-disks.ovf
 create mode 100644 test/ovf_manifests/disk1.vmdk
 create mode 100644 test/ovf_manifests/disk2.vmdk
 create mode 100755 test/run_ovf_tests.pl

diff --git a/test/Makefile b/test/Makefile
index 37330cf..6777f4a 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -1,7 +1,10 @@
 all: test
 
-test: test_snapshot
+test: test_snapshot test_ovf
 
 test_snapshot: run_snapshot_tests.pl
./run_snapshot_tests.pl
./test_get_replicatable_volumes.pl
+
+test_ovf: run_ovf_tests.pl
+   ./run_ovf_tests.pl
diff --git a/test/ovf_manifests/Win10-Liz-disk1.vmdk 
b/test/ovf_manifests/Win10-Liz-disk1.vmdk
new file mode 100644
index 
..662354a3d1333a2f6c4364005e53bfe7cd8b9044
GIT binary patch
literal 65536
zcmeIvy>HV%7zbeUF`dK)46s{U!a5_FoJCkDB
zKRozW{5{ByIY=etVNVcI$B
zY@^?CwTN|j)tg?;i)G&AZFqPqoW(5P2K~XUq>9sqVVe!!?y@Y;)^#k~TefEvd2_XU
z^M@5mfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk4^iOdL%ftb
z5g~`p!f^fB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ
zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U
zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7
z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N
p0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK;Zui`~%h>XmtPp

literal 0
HcmV?d1

diff --git a/test/ovf_manifests/Win10-Liz.ovf b/test/ovf_manifests/Win10-Liz.ovf
new file mode 100755
index 000..46642c0
--- /dev/null
+++ b/test/ovf_manifests/Win10-Liz.ovf
@@ -0,0 +1,142 @@
+
+
+http://schemas.dmtf.org/ovf/envelope/1"; 
xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common"; 
xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"; 
xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData";
 xmlns:vmw="http://www.vmware.com/schema/ovf"; 
xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData";
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
+  
+
+  
+  
+Virtual disk information
+http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized";
 ovf:populatedSize="16798056448"/>
+  
+  
+The list of logical networks
+
+  The bridged network
+
+  
+  
+A virtual machine
+Win10-Liz
+
+  The kind of installed guest operating system
+
+
+  Virtual hardware requirements
+  
+Virtual Hardware Family
+0
+Win10-Liz
+vmx-11
+  
+  
+hertz * 10^6
+Number of Virtual CPUs
+4 virtual CPU(s)
+1
+3
+4
+  
+  
+byte * 2^20
+Memory Size
+6144MB of memory
+2
+4
+6144
+  
+  
+0
+SATA Controller
+sataController0
+3
+vmware.sata.ahci
+20
+  
+  
+0
+USB Controller (XHCI)
+usb3
+4
+vmware.usb.xhci
+23
+  
+  
+0
+USB Controller (EHCI)
+usb
+5
+vmware.usb.ehci
+23
+
+  
+  
+0
+SCSI Controller
+scsiController0
+6
+lsilogicsas
+6
+  
+  
+true
+serial0
+7
+21
+
+  
+  
+0
+disk0
+ovf:/disk/vmdisk1
+8
+6
+17
+  
+  
+2
+true
+bridged
+E1000e ethernet adapter on 
"bridged"
+ethernet0
+9
+E1000e
+10
+
+  
+  
+false
+sound
+10
+vmware.soundcard.hdaudio
+1
+  
+  
+false
+video
+11
+24
+
+  
+  
+false
+vmci
+12
+vmware.vmci
+1
+  
+  
+1
+false
+cdrom0
+13
+3
+15
+  
+  
+  
+  
+  
+  
+
+  
+
\ No newline at end of file
diff --git a/test/ovf_manifests/Win_2008_R2

Re: [pve-devel] [PATCH qemu-server v8 1/6] Force overwriting existing compressed man pages and symbolic links

2017-09-14 Thread Emmanuel Kasper


On 09/14/2017 08:09 AM, Thomas Lamprecht wrote:
> On 09/13/2017 04:10 PM, Emmanuel Kasper wrote:
>> This allows calling the 'make install' target twice in a row.
> 
> Looks OK, we overwrite everything else so why not the man pages.
> 
> This can be already applied even if we would say the current
> iteration of this series still lacks something, IMO, no need
> to drag this along...
> 
> Also, FYI: I assume you made this patch in the first place to
> allow faster testing your changes by just doing `make install`
> circumventing the slower package build of `make dinstall` where
> this patch wouldn't be needed?
> If so, you could like to use perl's -I switch:
> 
>> -Idirectory
>>  Directories specified by -I are prepended to the search
>>  path for modules (@INC).
> 
> 
> For example, in your case you could do the following from inside the
> qemu-servers top level directory:
> 
> perl -I. ./qm importovf ...
> 
> Just for the case that you did not know this all already :)
> 

I was using use lib qw(..);
in the unit tests, but not the -I switch for the command line
thanks for the hint

___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH qemu-server 1/1] do not overwrite global signal handlers

2017-09-14 Thread Emmanuel Kasper
perls 'local' must be either used in front of each $SIG{...}
assignments or they must be put in a list, else it affects only the
first variable and the rest are *not* in local context.

In all cases the global signal handlers we overwrote were in cli programs or
forked workers, not in daemons.
---
 PVE/API2/Qemu.pm |  5 -
 PVE/QemuServer.pm| 23 ++-
 PVE/QemuServer/ImportDisk.pm |  8 +---
 3 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 1002c87..66ffc07 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -2697,7 +2697,10 @@ __PACKAGE__->register_method({
my $newvollist = [];
 
eval {
-   local $SIG{INT} = $SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = sub 
{ die "interrupted by signal\n"; };
+   local $SIG{INT} =
+   local $SIG{TERM} =
+   local $SIG{QUIT} =
+   local $SIG{HUP} = sub { die "interrupted by signal\n"; 
};
 
warn "moving disk with snapshots, snapshots will not be 
moved!\n"
if $snapshotted;
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 2d09726..03e7ca4 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -5622,9 +5622,11 @@ sub restore_vma_archive {
 
 eval {
# enable interrupts
-   local $SIG{INT} = $SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = $SIG{PIPE} = 
sub {
-   die "interrupted by signal\n";
-   };
+   local $SIG{INT} =
+   local $SIG{TERM} =
+   local $SIG{QUIT} =
+   local $SIG{HUP} =
+   local $SIG{PIPE} = sub { die "interrupted by signal\n"; };
local $SIG{ALRM} = sub { die "got timeout\n"; };
 
$oldtimeout = alarm($timeout);
@@ -5738,15 +5740,18 @@ sub restore_tar_archive {
 my $tmpfn = "$conffile.$$.tmp";
 
 # disable interrupts (always do cleanups)
-local $SIG{INT} = $SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = sub {
-   print STDERR "got interrupt - ignored\n";
-};
+local $SIG{INT} =
+   local $SIG{TERM} =
+   local $SIG{QUIT} =
+   local $SIG{HUP} = sub { print STDERR "got interrupt - ignored\n"; };
 
 eval {
# enable interrupts
-   local $SIG{INT} = $SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = $SIG{PIPE} = 
sub {
-   die "interrupted by signal\n";
-   };
+   local $SIG{INT} =
+   local $SIG{TERM} =
+   local $SIG{QUIT} =
+   local $SIG{HUP} =
+   local $SIG{PIPE} = sub { die "interrupted by signal\n"; };
 
if ($archive eq '-') {
print "extracting archive from STDIN\n";
diff --git a/PVE/QemuServer/ImportDisk.pm b/PVE/QemuServer/ImportDisk.pm
index edbc20e..db7db63 100755
--- a/PVE/QemuServer/ImportDisk.pm
+++ b/PVE/QemuServer/ImportDisk.pm
@@ -82,9 +82,11 @@ sub do_import {
 
 eval {
# trap interrupts so we have a chance to clean up
-   local $SIG{INT} = $SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = $SIG{PIPE} = 
sub {
-   die "interrupted by signal\n";
-   };
+   local $SIG{INT} =
+   local $SIG{TERM} =
+   local $SIG{QUIT} =
+   local $SIG{HUP} =
+   local $SIG{PIPE} = sub { die "interrupted by signal\n"; };
PVE::Storage::activate_volumes($storecfg, [$dst_volid]);
run_command($convert_command);
PVE::Storage::deactivate_volumes($storecfg, [$dst_volid]);
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH qemu-server 0/1] Do not overwrite global signal handlers, extra fix

2017-09-14 Thread Emmanuel Kasper
While poking around QemuServer.pm I noticed a couple of places where we were
using 'local' in a wrong way like Thomas reported.
After checking with grep in /usr/share/perl5/PVE, this should be now fixed
everywhere.

Emmanuel Kasper (1):
  do not overwrite global signal handlers

 PVE/API2/Qemu.pm |  5 -
 PVE/QemuServer.pm| 23 ++-
 PVE/QemuServer/ImportDisk.pm |  8 +---
 3 files changed, 23 insertions(+), 13 deletions(-)

-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] rfc : implementing a cloudinit metadata server

2017-09-20 Thread Emmanuel Kasper
On 08/30/2017 07:52 AM, Alexandre DERUMIER wrote:
> Hi,
> 
> the previous cloudinit patches used a cdrom for config drive.
> 
> Wolfgang tell me that it could be great to get it work for lxc too.
> 
> 
> So maybe we could try to implement a cloudinit metadataserver, with same api 
> than cloudstack (or amazon ec2, or both)
> 

Hi Alexandre

Not so feature-full like cloud-init, but I am using libguestfs for basic
VMs offline provisioning  (hostname, network, ssh key) and this method
might be of interest to you.
I am using for instance this smallish script in my testlab,

The VM selves expose their name in the namework via Multicast DNS (
avahi-daemon) so I directly connect to them on first boot via "ssh
vm_hostname.local"

#!/usr/bin/perl

use strict;
use warnings;
use feature 'say';
use Sys::Guestfs;


use PVE::RPCEnvironment;
use PVE::QemuConfig;
use PVE::QemuServer;
use PVE::Storage;

my $vmid = $ARGV[0] or die "no \$vmid specified";
my $root_authorized_key = $ARGV[1] || "/home/manu/.ssh/id_rsa.pub";

my $vm_conf = PVE::QemuConfig->load_config($vmid);
my $target_hostname = $vm_conf->{name} || "test-vm";

my $boot_disk = $vm_conf->{bootdisk} || "scsi0";
my $parsed_drive = PVE::QemuServer::parse_drive($boot_disk,
$vm_conf->{$boot_disk});
my $volid = $parsed_drive->{file};
my $cfg = PVE::Storage::config();
my $image = PVE::Storage::path($cfg, $volid);


my $g = Sys::Guestfs->new();
$g->add_drive($image);
$g->launch(); # miss a test that VM is powered off

my @roots = $g->inspect_os();
scalar @roots == 1 || die "non recognized rootfs or multiboot disk
detected";
my $root = $roots[0];

my %mount_map = $g->inspect_get_mountpoints($root);
my @fses = sort {length $a <=> length $b} keys(%mount_map);

foreach my $fs (@fses) {
$g->mount($mount_map{$fs}, $fs);
}

$g->write("/etc/hostname", $target_hostname);
$g->write("/etc/hosts", "127.0.0.1 localhost\n");
$g->write_append("/etc/hosts", "127.0.0.2 $target_hostname\n");


my $net = <<'EOF';
auto lo
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet dhcp
EOF
$g->write("/etc/network/interfaces", $net);

$g->sh_lines('rm --verbose --force /etc/ssh/ssh_host_*');
$g->write("/etc/rc.local", "#!/bin/sh -e\n");
$g->write_append("/etc/rc.local", "-f ssh_host_ecdsa_key.pub ||
dpkg-reconfigure openssh-server\n");
$g->write_append("/etc/rc.local", "exit 0\n");

$g->upload($root_authorized_key, "/root/.ssh/authorized_keys");
$g->chmod(600, "/root/.ssh/authorized_keys");


say $g->cat("/etc/hostname") . ": successfull provisioning";

$g->shutdown();
$g->close();

___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH RFC qemu-kvm 1/1] Provides a virtual package qemu-system-x86

2017-09-21 Thread Emmanuel Kasper
Mainly to allow libguestfs and associated tools to work with our qemu binary.

libguestfs tests at run timethe output of qemu -help and qemu -device ?
to detect which features it can use, so it should not
depend on which configure flags were used when compiling our qemu binary.
---
 debian/control| 4 ++--
 debian/pve-qemu-kvm.links | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)
 create mode 100644 debian/pve-qemu-kvm.links

diff --git a/debian/control b/debian/control
index ecf65c2..591cb61 100644
--- a/debian/control
+++ b/debian/control
@@ -45,8 +45,8 @@ Depends: ${shlibs:Depends}, ${misc:Depends},
  numactl,
  libjemalloc1,
  libjpeg62-turbo
-Conflicts: qemu, qemu-kvm, qemu-utils, kvm, pve-kvm, pve-qemu-kvm-2.6.18
-Provides: qemu-utils
+Conflicts: qemu, qemu-kvm, qemu-utils, qemu-system-x86, kvm, pve-kvm, 
pve-qemu-kvm-2.6.18
+Provides: qemu-utils, qemu-system-x86
 Replaces: pve-kvm, pve-qemu-kvm-2.6.18, qemu-utils
 Description: Full virtualization on x86 hardware
  Using KVM, one can run multiple virtual PCs, each running unmodified Linux or
diff --git a/debian/pve-qemu-kvm.links b/debian/pve-qemu-kvm.links
new file mode 100644
index 000..8e769d8
--- /dev/null
+++ b/debian/pve-qemu-kvm.links
@@ -0,0 +1 @@
+/usr/bin/kvm /usr/bin/qemu-system-x86_64
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH RFC qemu-kvm 0/1] Provides a qemu-system-x86 virtual package

2017-09-21 Thread Emmanuel Kasper
This will allow the installation of extra packages requiring qemu
Bigger use case is libguestfs0 and libguestfs-tools , this has been asked
in a few different forum threads
libguestfs-tools allow to inspect and edit disk images of offline guests
and do not require libvirt domains to be used.

Example use cases:

virt-edit --add /path/to/disk_image /boot/grub/grub.cfg
virt-win-reg /path/to/disk/image "HKLM\SOFTWARE\Microsoft\Windows 
NT\CurrentVersion" ProductName
Windows 10 Enterprise Evaluation

See http://libguestfs.org/guestfs-faq.1.html for the relation between libguestfs
and libvirt.

Sending this as RFC as the debian qemu-system-x86 package provides two binaries
qemu-system-i386 and qemu-system-x86_64, and I am not sure if we should provide 
a
symlink to qemu-system-i386 as well (libguestfs does not need this it in any 
case)


Emmanuel Kasper (1):
  Provides a virtual package qemu-system-x86

 debian/control| 4 ++--
 debian/pve-qemu-kvm.links | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)
 create mode 100644 debian/pve-qemu-kvm.links

-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] [PATCH RFC qemu-kvm 1/1] Provides a virtual package qemu-system-x86

2017-09-21 Thread Emmanuel Kasper
On 09/21/2017 10:50 AM, Wolfgang Bumiller wrote:
> On Thu, Sep 21, 2017 at 10:26:46AM +0200, Emmanuel Kasper wrote:
>> Mainly to allow libguestfs and associated tools to work with our qemu binary.
>>
>> libguestfs tests at run timethe output of qemu -help and qemu -device ?
>> to detect which features it can use, so it should not
>> depend on which configure flags were used when compiling our qemu binary.
>> ---
>>  debian/control| 4 ++--
>>  debian/pve-qemu-kvm.links | 1 +
>>  2 files changed, 3 insertions(+), 2 deletions(-)
>>  create mode 100644 debian/pve-qemu-kvm.links
>>
>> diff --git a/debian/control b/debian/control
>> index ecf65c2..591cb61 100644
>> --- a/debian/control
>> +++ b/debian/control
>> @@ -45,8 +45,8 @@ Depends: ${shlibs:Depends}, ${misc:Depends},
>>   numactl,
>>   libjemalloc1,
>>   libjpeg62-turbo
>> -Conflicts: qemu, qemu-kvm, qemu-utils, kvm, pve-kvm, pve-qemu-kvm-2.6.18
>> -Provides: qemu-utils
>> +Conflicts: qemu, qemu-kvm, qemu-utils, qemu-system-x86, kvm, pve-kvm, 
>> pve-qemu-kvm-2.6.18
>> +Provides: qemu-utils, qemu-system-x86
> 
> To provide qemu-system-x86 we'd need to also ship a
> /usr/bin/qemu-system-i386 (which is not the same as qemu-system-x86_64).
I was not sure about this, as stated in the cover letter

after reading
https://lists.gnu.org/archive/html/qemu-devel/2012-09/msg02134.html
the main difference between those two binaries is that
/usr/bin/qemu-system-i386  is faster when running 16/32 bit OSes

since we've been running 32 bits OSes on our 64 bits qemu-system for a
long time here without problem I don't see a compatibility problem here
if  the /usr/bin/qemu-system-i386 and /usr/bin/qemu-system-x86_64 points
to the same binary. or ?

>>  Replaces: pve-kvm, pve-qemu-kvm-2.6.18, qemu-utils
>>  Description: Full virtualization on x86 hardware
>>   Using KVM, one can run multiple virtual PCs, each running unmodified Linux 
>> or
>> diff --git a/debian/pve-qemu-kvm.links b/debian/pve-qemu-kvm.links
>> new file mode 100644
>> index 000..8e769d8
>> --- /dev/null
>> +++ b/debian/pve-qemu-kvm.links
>> @@ -0,0 +1 @@
>> +/usr/bin/kvm /usr/bin/qemu-system-x86_64
> 
> I'd rather have the rules file updated to not rename the binary and
> instead make /usr/bin/kvm the symlink (also from within the rules file
> since it depends on $(ARCH) there (and amd64 would have to be translated
> to x86_64...)).

agree, makes sense to me too

___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v3 8/8] Render full name of VirtIO Block controller

2017-09-26 Thread Emmanuel Kasper
This will hopefully reduce confusion with SCSI VirtIO controller
---
 www/manager6/form/BusTypeSelector.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/www/manager6/form/BusTypeSelector.js 
b/www/manager6/form/BusTypeSelector.js
index ae7c327e..8abdcf4b 100644
--- a/www/manager6/form/BusTypeSelector.js
+++ b/www/manager6/form/BusTypeSelector.js
@@ -10,7 +10,7 @@ Ext.define('PVE.form.BusTypeSelector', {
me.comboItems = [['ide', 'IDE'], ['sata', 'SATA']];
 
if (!me.noVirtIO) {
-   me.comboItems.push(['virtio', 'VirtIO']);
+   me.comboItems.push(['virtio', 'VirtIO Block']);
}
 
me.comboItems.push(['scsi', 'SCSI']);
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v3 4/8] Use the noVirtIO ControllerSelector property to build the list of controllers

2017-09-26 Thread Emmanuel Kasper
---
 www/manager6/form/ControllerSelector.js | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/www/manager6/form/ControllerSelector.js 
b/www/manager6/form/ControllerSelector.js
index 15023a7a..489b97de 100644
--- a/www/manager6/form/ControllerSelector.js
+++ b/www/manager6/form/ControllerSelector.js
@@ -61,9 +61,9 @@ Ext.define('PVE.form.ControllerSelector', {
var bussel = me.down('field[name=controller]');
var deviceid = me.down('field[name=deviceid]');
 
-   if (autoSelect === 'cdrom') {
+   if (me.noVirtIO) {
clist = ['ide', 'scsi', 'sata'];
-   if (!Ext.isDefined(me.vmconfig.ide2)) {
+   if (autoSelect === 'cdrom' && !Ext.isDefined(me.vmconfig.ide2)) {
bussel.setValue('ide');
deviceid.setValue(2);
return;
@@ -76,9 +76,6 @@ Ext.define('PVE.form.ControllerSelector', {
 
Ext.Array.each(clist, function(controller) {
var confid, i;
-   if (controller === 'virtio' && me.noVirtIO) {
-   return; //continue
-   }
bussel.setValue(controller);
for (i = 0; i <= PVE.form.ControllerSelector.maxIds[controller]; 
i++) {
confid = controller + i.toString();
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v3 0/8] Display the SCSI controller type when adding a new drive

2017-09-26 Thread Emmanuel Kasper
Since we switched to the SCSI controller in the Wizard as the recommended 
controller
for hard disks (using VirtIO scsi in the backend) it was not clear for users
that they were actually using a paravirtualized driver.

An example of user confusion:
https://forum.proxmox.com/threads/proxmox-hypervisor-scsi-or-virtio.36506/#post-179056
This iproblem in the trainings as well.

Patches 1-4 are code cleanups, no change since v2.
Patches 5-8 contain the new functionality.

changes since v2:

* use a readonly display field to display the controller type instead of adding 
the SCSI
controller type in the BusSelection combobox. This reduces the amount of user 
visible changes
(the field is only displayed for SCSI buses selections) and also less intrusive 
as we
don't need to change the rendered values of an existing combo box.
Also this allows to store the selected SCSI controller type inside the wizard 
in a real
component, so we can get rid of the setHiddenWizard() method which was a bit 
ugly.
* write VirtIO as VirtIO Block when display a VirtIO Block controller

Emmanuel Kasper (8):
  Do not use 'autoselect' as a boolean when preselecting a bus
  Remove unused noScsi parameter
  Save the components we found via down() in a variable for later reuse.
  Use the noVirtIO ControllerSelector property to build the list of
controllers
  Add a field to show which SCSI controller type we are currently using
  When inside the wizard, actualize the scsiType display field based on
iothread selection
  After OS type selection in Wizard, set the appropriate SCSI controller
type in the Hard Disk panel
  Render full name of VirtIO Block controller

 www/manager6/form/BusTypeSelector.js|  8 ++---
 www/manager6/form/ControllerSelector.js | 59 +++--
 www/manager6/qemu/CreateWizard.js   |  5 ---
 www/manager6/qemu/HDEdit.js | 45 +++--
 www/manager6/qemu/OSDefaults.js |  2 +-
 www/manager6/qemu/OSTypeEdit.js | 10 +-
 6 files changed, 66 insertions(+), 63 deletions(-)

-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v3 3/8] Save the components we found via down() in a variable for later reuse.

2017-09-26 Thread Emmanuel Kasper
---
 www/manager6/form/ControllerSelector.js | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/www/manager6/form/ControllerSelector.js 
b/www/manager6/form/ControllerSelector.js
index 14ad574e..15023a7a 100644
--- a/www/manager6/form/ControllerSelector.js
+++ b/www/manager6/form/ControllerSelector.js
@@ -58,11 +58,14 @@ Ext.define('PVE.form.ControllerSelector', {
me.vmconfig = Ext.apply({}, vmconfig);
 
var clist = ['ide', 'virtio', 'scsi', 'sata'];
+   var bussel = me.down('field[name=controller]');
+   var deviceid = me.down('field[name=deviceid]');
+
if (autoSelect === 'cdrom') {
clist = ['ide', 'scsi', 'sata'];
if (!Ext.isDefined(me.vmconfig.ide2)) {
-   me.down('field[name=controller]').setValue('ide');
-   me.down('field[name=deviceid]').setValue(2);
+   bussel.setValue('ide');
+   deviceid.setValue(2);
return;
}
} else  {
@@ -76,16 +79,16 @@ Ext.define('PVE.form.ControllerSelector', {
if (controller === 'virtio' && me.noVirtIO) {
return; //continue
}
-   me.down('field[name=controller]').setValue(controller);
+   bussel.setValue(controller);
for (i = 0; i <= PVE.form.ControllerSelector.maxIds[controller]; 
i++) {
confid = controller + i.toString();
if (!Ext.isDefined(me.vmconfig[confid])) {
-   me.down('field[name=deviceid]').setValue(i);
+   deviceid.setValue(i);
return false; // break
}
}
});
-   me.down('field[name=deviceid]').validate();
+   deviceid.validate();
 },
 
 initComponent: function() {
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v3 2/8] Remove unused noScsi parameter

2017-09-26 Thread Emmanuel Kasper
SCSI is a valid bus for Disks and CD drives, so it should always
be appear in the bus list.
---
 www/manager6/form/BusTypeSelector.js| 6 +-
 www/manager6/form/ControllerSelector.js | 6 +-
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/www/manager6/form/BusTypeSelector.js 
b/www/manager6/form/BusTypeSelector.js
index 9b9492fc..ae7c327e 100644
--- a/www/manager6/form/BusTypeSelector.js
+++ b/www/manager6/form/BusTypeSelector.js
@@ -4,8 +4,6 @@ Ext.define('PVE.form.BusTypeSelector', {
   
 noVirtIO: false,
 
-noScsi: false,
-
 initComponent: function() {
var me = this;
 
@@ -15,9 +13,7 @@ Ext.define('PVE.form.BusTypeSelector', {
me.comboItems.push(['virtio', 'VirtIO']);
}
 
-   if (!me.noScsi) {
-   me.comboItems.push(['scsi', 'SCSI']);
-   }
+   me.comboItems.push(['scsi', 'SCSI']);
 
me.callParent();
 }
diff --git a/www/manager6/form/ControllerSelector.js 
b/www/manager6/form/ControllerSelector.js
index 045e7d0d..14ad574e 100644
--- a/www/manager6/form/ControllerSelector.js
+++ b/www/manager6/form/ControllerSelector.js
@@ -13,8 +13,6 @@ Ext.define('PVE.form.ControllerSelector', {
 
 noVirtIO: false,
 
-noScsi: false,
-
 vmconfig: {}, // used to check for existing devices
 
 sortByPreviousUsage: function(vmconfig, controllerList) {
@@ -75,8 +73,7 @@ Ext.define('PVE.form.ControllerSelector', {
 
Ext.Array.each(clist, function(controller) {
var confid, i;
-   if ((controller === 'virtio' && me.noVirtIO) ||
-   (controller === 'scsi' && me.noScsi)) {
+   if (controller === 'virtio' && me.noVirtIO) {
return; //continue
}
me.down('field[name=controller]').setValue(controller);
@@ -106,7 +103,6 @@ Ext.define('PVE.form.ControllerSelector', {
name: 'controller',
value: PVE.qemu.OSDefaults.generic.busType,
noVirtIO: me.noVirtIO,
-   noScsi: me.noScsi,
allowBlank: false,
flex: 2,
listeners: {
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v3 7/8] After OS type selection in Wizard, set the appropriate SCSI controller type in the Hard Disk panel

2017-09-26 Thread Emmanuel Kasper
This was done previously without any kind of user visible feedback,
so users would not know that they had a Virtio SCSI controller as default 
controller for Linux VMs.
---
 www/manager6/qemu/CreateWizard.js |  5 -
 www/manager6/qemu/OSDefaults.js   |  2 +-
 www/manager6/qemu/OSTypeEdit.js   | 10 +-
 3 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/www/manager6/qemu/CreateWizard.js 
b/www/manager6/qemu/CreateWizard.js
index 954b8ef0..c508bb7f 100644
--- a/www/manager6/qemu/CreateWizard.js
+++ b/www/manager6/qemu/CreateWizard.js
@@ -1,7 +1,6 @@
 Ext.define('PVE.qemu.CreateWizard', {
 extend: 'PVE.window.Wizard',
 alias: 'widget.pveQemuCreateWizard',
-qemuScsiController: undefined,
 
 controller: {
 
@@ -167,10 +166,6 @@ Ext.define('PVE.qemu.CreateWizard', {
var nodename = kv.nodename;
delete kv.nodename;
 
-   if (me.qemuScsiController && !kv.scsihw) {
-   kv.scsihw = me.qemuScsiController;
-   }
-
PVE.Utils.API2Request({
url: '/nodes/' + nodename + '/qemu',
waitMsgTarget: me,
diff --git a/www/manager6/qemu/OSDefaults.js b/www/manager6/qemu/OSDefaults.js
index d47b9d01..d6f733a8 100644
--- a/www/manager6/qemu/OSDefaults.js
+++ b/www/manager6/qemu/OSDefaults.js
@@ -66,7 +66,7 @@ Ext.define('PVE.qemu.OSDefaults', {
pveOS: 'w2k',
parent : 'generic',
networkCard: 'rtl8139',
-   scsihw: 'lsi'
+   scsihw: ''
});
// https://pve.proxmox.com/wiki/Windows_XP_Guest_Notes
addOS({
diff --git a/www/manager6/qemu/OSTypeEdit.js b/www/manager6/qemu/OSTypeEdit.js
index 1235ddfd..27b0c40c 100644
--- a/www/manager6/qemu/OSTypeEdit.js
+++ b/www/manager6/qemu/OSTypeEdit.js
@@ -27,7 +27,7 @@ Ext.define('PVE.qemu.OSTypeInputPanel', {
 
me.setWidget('pveBusSelector', targetValues.busType);
me.setWidget('pveNetworkCardSelector', targetValues.networkCard);
-   me.setWizardHiddenValue('qemuScsiController', targetValues.scsihw);
+   me.setWidget('field[name=scsihw]', targetValues.scsihw);
},
setWidget: function(widget, newValue) {
// changing a widget is safe only if ComponentQuery.query returns us
@@ -38,14 +38,6 @@ Ext.define('PVE.qemu.OSTypeInputPanel', {
} else {
throw 'non unique widget :' + widget + ' in Wizard';
}
-   },
-   setWizardHiddenValue: function(property, newValue) {
-   var wizards = Ext.ComponentQuery.query('pveQemuCreateWizard ');
-   if (wizards.length === 1) {
-   wizards[0][property] = newValue;
-   } else {
-   throw 'non unique wizard, unable to set ' + property;
-   }
}
 },
 
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v3 1/8] Do not use 'autoselect' as a boolean when preselecting a bus

2017-09-26 Thread Emmanuel Kasper
The bus selector is displayed when we add a Hard Disk or CD Drive.
When it is displayed, we *always* preselect the next available
slot on the controller of our choice.
So this test is not needed.

We keep the test on the string value of 'autoselect' to select
a bus position when adding a CD Drive.
---
 www/manager6/form/ControllerSelector.js | 53 -
 www/manager6/qemu/HDEdit.js |  2 +-
 2 files changed, 27 insertions(+), 28 deletions(-)

diff --git a/www/manager6/form/ControllerSelector.js 
b/www/manager6/form/ControllerSelector.js
index 002134ef..045e7d0d 100644
--- a/www/manager6/form/ControllerSelector.js
+++ b/www/manager6/form/ControllerSelector.js
@@ -58,37 +58,36 @@ Ext.define('PVE.form.ControllerSelector', {
var me = this;
 
me.vmconfig = Ext.apply({}, vmconfig);
-   if (autoSelect) {
-   var clist = ['ide', 'virtio', 'scsi', 'sata'];
-   if (autoSelect === 'cdrom') {
-   clist = ['ide', 'scsi', 'sata'];
-   if (!Ext.isDefined(me.vmconfig.ide2)) {
-   me.down('field[name=controller]').setValue('ide');
-   me.down('field[name=deviceid]').setValue(2);
-   return;
-   }
-   } else  {
-   // in most cases we want to add a disk to the same controller
-   // we previously used
-   clist = me.sortByPreviousUsage(me.vmconfig, clist);
+
+   var clist = ['ide', 'virtio', 'scsi', 'sata'];
+   if (autoSelect === 'cdrom') {
+   clist = ['ide', 'scsi', 'sata'];
+   if (!Ext.isDefined(me.vmconfig.ide2)) {
+   me.down('field[name=controller]').setValue('ide');
+   me.down('field[name=deviceid]').setValue(2);
+   return;
}
+   } else  {
+   // in most cases we want to add a disk to the same controller
+   // we previously used
+   clist = me.sortByPreviousUsage(me.vmconfig, clist);
+   }
 
-   Ext.Array.each(clist, function(controller) {
-   var confid, i;
-   if ((controller === 'virtio' && me.noVirtIO) ||
+   Ext.Array.each(clist, function(controller) {
+   var confid, i;
+   if ((controller === 'virtio' && me.noVirtIO) ||
(controller === 'scsi' && me.noScsi)) {
-   return; //continue
-   }
-   me.down('field[name=controller]').setValue(controller);
-   for (i = 0; i <= 
PVE.form.ControllerSelector.maxIds[controller]; i++) {
-   confid = controller + i.toString();
-   if (!Ext.isDefined(me.vmconfig[confid])) {
-   me.down('field[name=deviceid]').setValue(i);
-   return false; // break
-   }
+   return; //continue
+   }
+   me.down('field[name=controller]').setValue(controller);
+   for (i = 0; i <= PVE.form.ControllerSelector.maxIds[controller]; 
i++) {
+   confid = controller + i.toString();
+   if (!Ext.isDefined(me.vmconfig[confid])) {
+   me.down('field[name=deviceid]').setValue(i);
+   return false; // break
}
-   });
-   }
+   }
+   });
me.down('field[name=deviceid]').validate();
 },
 
diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index e7535f50..8a415d8b 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -140,7 +140,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
me.vmconfig = vmconfig;
 
if (me.bussel) {
-   me.bussel.setVMConfig(vmconfig, true);
+   me.bussel.setVMConfig(vmconfig);
}
if (me.unusedDisks) {
var disklist = [];
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v3 6/8] When inside the wizard, actualize the scsiType display field based on iothread selection

2017-09-26 Thread Emmanuel Kasper
We keep the same logic as before: once the iothread option is selected, the 
default SCSI
controller is switched to virtio-scsi-single until iothread is unselected again.
---
 www/manager6/qemu/HDEdit.js | 28 ++--
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index 075ad667..14ee0b50 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -19,9 +19,13 @@ Ext.define('PVE.qemu.HDInputPanel', {
var value = field.getValue();
 
var allowIOthread = value.match(/^(virtio|scsi)/);
-   this.lookup('iothread').setDisabled(!allowIOthread);
+   var iothread = this.lookup('iothread');
+   iothread.setDisabled(!allowIOthread);
if (!allowIOthread) {
-   this.lookup('iothread').setValue(false);
+   // prevent event loop
+   iothread.suspendEvent('change');
+   iothread.setValue(false);
+   iothread.resumeEvent('change');
}
 
var scsi = value.match(/^scsi/);
@@ -74,6 +78,15 @@ Ext.define('PVE.qemu.HDInputPanel', {
me.hdsizesel.setVisible(true);
}
}
+   },
+   'field[name=iothread]' : {
+   change: function(f, value) {
+   if (!this.getView().insideWizard) {
+   return;
+   }
+   this.lookupReference('scsiType')
+   .setValue(value ? 'virtio-scsi-single'  : 
'virtio-scsi-pci');
+   }
}
}
 },
@@ -116,10 +129,6 @@ Ext.define('PVE.qemu.HDInputPanel', {
 
if (values.iothread) {
me.drive.iothread = 'on';
-   // do not silently change a VM-wide option after creating it
-   if (me.insideWizard) {
-   params.scsihw = 'virtio-scsi-single';
-   }
} else {
delete me.drive.iothread;
}
@@ -130,6 +139,10 @@ Ext.define('PVE.qemu.HDInputPanel', {
delete me.drive.cache;
}
 
+   if (values.scsihw) {
+   params.scsihw = values.scsihw;
+   }
+
params[confid] = PVE.Parser.printQemuDrive(me.drive);
 
return params;
@@ -198,9 +211,12 @@ Ext.define('PVE.qemu.HDInputPanel', {
});
me.column1.push(me.bussel);
me.scsiType = Ext.create('Ext.form.field.Display', {
+   name: 'scsihw',
fieldLabel: gettext('Type'),
reference: 'scsiType',
renderer: PVE.Utils.render_scsihw,
+   // do not change a VM wide option after creation
+   submitValue: me.insideWizard,
hidden: true
});
me.column1.push(me.scsiType);
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v3 5/8] Add a field to show which SCSI controller type we are currently using

2017-09-26 Thread Emmanuel Kasper
---
 www/manager6/qemu/HDEdit.js | 15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index 8a415d8b..075ad667 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -24,11 +24,12 @@ Ext.define('PVE.qemu.HDInputPanel', {
this.lookup('iothread').setValue(false);
}
 
-   var allowDiscard = value.match(/^scsi/);
-   this.lookup('discard').setDisabled(!allowDiscard);
-   if (!allowDiscard) {
+   var scsi = value.match(/^scsi/);
+   this.lookup('discard').setDisabled(!scsi);
+   if (!scsi) {
this.lookup('discard').setValue(false);
}
+   this.lookup('scsiType').setVisible(scsi);
},
 
control: {
@@ -141,6 +142,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
 
if (me.bussel) {
me.bussel.setVMConfig(vmconfig);
+   me.scsiType.setValue(vmconfig.scsihw);
}
if (me.unusedDisks) {
var disklist = [];
@@ -195,6 +197,13 @@ Ext.define('PVE.qemu.HDInputPanel', {
vmconfig: me.insideWizard ? {ide2: 'cdrom'} : {}
});
me.column1.push(me.bussel);
+   me.scsiType = Ext.create('Ext.form.field.Display', {
+   fieldLabel: gettext('Type'),
+   reference: 'scsiType',
+   renderer: PVE.Utils.render_scsihw,
+   hidden: true
+   });
+   me.column1.push(me.scsiType);
}
 
if (me.unused) {
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH qemu-server] importovf: explicitly returns undef

2017-09-27 Thread Emmanuel Kasper
We set the returns value to  { type => 'null' } but we returned an empty
string, which was confusing the cli handler.
---
 PVE/CLI/qm.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/PVE/CLI/qm.pm b/PVE/CLI/qm.pm
index 0e17cc9..90a44ef 100755
--- a/PVE/CLI/qm.pm
+++ b/PVE/CLI/qm.pm
@@ -599,7 +599,9 @@ __PACKAGE__->register_method ({
};
 
my $wait_for_lock = 1;
-   return PVE::QemuConfig->lock_config_full($vmid, $wait_for_lock, 
$importfn);
+   PVE::QemuConfig->lock_config_full($vmid, $wait_for_lock, $importfn);
+
+   return undef;
 
 }
 });
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH docs 2/2] Update the Windows import example to use the qm importovf command

2017-09-27 Thread Emmanuel Kasper
Also create a new section, "Add an external disk image to a Virtual Machine"
using the qm importdisk command.
---
NB: qm.1-synopsis.adoc should be rebuilt, so the 'importovf' command is there 
too.
 qm.adoc | 74 -
 1 file changed, 50 insertions(+), 24 deletions(-)

diff --git a/qm.adoc b/qm.adoc
index 44d45f6..f72502c 100644
--- a/qm.adoc
+++ b/qm.adoc
@@ -651,8 +651,8 @@ NOTE: It is not possible to start templates, because this 
would modify
 the disk images. If you want to change the template, create a linked
 clone and modify that.
 
-Importing Virtual Machines from foreign hypervisors

+Importing Virtual Machines and disk images
+--
 
 A VM export from a foreign hypervisor takes usually the form of one or more 
disk
  images, with a configuration file describing the settings of the VM (RAM,
@@ -682,43 +682,69 @@ GNU/Linux and other free Unix can usually be imported 
without hassle. Note
 that we cannot guarantee a successful import/export of Windows VMs in all
 cases due to the problems above.
 
-Step-by-step example of a Windows disk image import
-~~~
+Step-by-step example of a Windows OVF import
+
 
 Microsoft provides
-https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/[Virtual 
Machines exports]
- in different formats for browser testing. We are going to use one of these to
- demonstrate a VMDK import.
+https://developer.microsoft.com/en-us/windows/downloads/virtual-machines/[Virtual
 Machines downloads]
+ to get started with Windows development.We are going to use one of these 
+to demonstrate the OVF import feature.
 
-Download the export zip
-^^^
+Download the Virtual Machine zip
+
 
-After getting informed about the user agreement, choose the _Microsoft Edge on
-Windows 10 Virtual Machine_ for the VMware platform, and download the zip.
+After getting informed about the user agreement, choose the _Windows 10 
+Enterprise (Evaluation - Build)_ for the VMware platform, and download the zip.
 
 Extract the disk image from the zip
 ^^^
 
-Using the unzip utility or any archiver of your choice, unpack the zip,
-and copy via ssh/scp the vmdk file to your {pve} host.
+Using the `unzip` utility or any archiver of your choice, unpack the zip,
+and copy via ssh/scp the ovf and vmdk files to your {pve} host.
 
-Create a new virtual machine and import the disk
-
+Import the Virtual Machine
+^^
 
-Create a virtual machine with 2 cores, 2GB RAM, and one NIC on the default
-+vmbr0+ bridge:
+This will create a new virtual machine, using cores, memory and
+VM name as read from the OVF manifest, and import the disks to the +local-lvm+
+ storage. You have to configure the network manually.
 
- qm create 999 -net0 e1000,bridge=vmbr0 -name Win10 -memory 2048 -bootdisk 
sata0
+ qm importovf 999 WinDev1709Eval.ovf local-lvm
 
-Import the disk image to the +local-lvm+ storage:
+The VM is ready to be started.
 
- qm importdisk 999 "MSEdge - Win10_preview.vmdk" local-lvm
+Add an external disk image to a Virtual Machine
+~~~
 
-The disk will be marked as *Unused* in the VM 999 configuration.
-After that you can go in the GUI, in the VM *Hardware*, *Edit* the unused disk
-and set the *Bus/Device* to *SATA/0*.
-The VM is ready to be started.
+You can also add an existing disk image to a VM, either coming from a 
+foreign hypervisor, or one that you created yourself.
+
+Suppose you created a Debian/Ubuntu disk image with the 'vmdebootstrap' tool:
+
+ vmdebootstrap --verbose \
+  --size 10G --serial-console \
+  --grub --no-extlinux \
+  --package openssh-server \
+  --package avahi-daemon \
+  --package qemu-guest-agent \
+  --hostname vm600 --enable-dhcp \
+  --customize=./copy_pub_ssh.sh \
+  --sparse --image vm600.raw
+
+You can now create a new target VM for this image.
+
+ qm create 600 --net0 virtio,bridge=vmbr0 --name vm600 --serial0 socket \
+   --bootdisk scsi0 --scsihw virtio-scsi-pci --ostype l26
 
+Add the disk image as +unused0+ to the VM, using the storage +pvedir+:
+
+ qm importdisk 600 vm600.raw pvedir
+
+Finally attach the unused disk to the SCSI controller of the VM:
+
+ qm set 600 --scsi0 pvedir:600/vm-600-disk-1.raw
+
+The VM is ready to be started.
 
 Managing Virtual Machines with `qm`
 
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH docs 1/2] Typo correction

2017-09-27 Thread Emmanuel Kasper
---
 qm.adoc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qm.adoc b/qm.adoc
index 6cc8855..44d45f6 100644
--- a/qm.adoc
+++ b/qm.adoc
@@ -679,7 +679,7 @@ the VM. For Windows VMs, you need to install the Windows 
paravirtualized
 drivers by yourself.
 
 GNU/Linux and other free Unix can usually be imported without hassle. Note
-that we cannot guarantee a successful import/export of Windows WM in all
+that we cannot guarantee a successful import/export of Windows VMs in all
 cases due to the problems above.
 
 Step-by-step example of a Windows disk image import
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] [PATCH manager v3 5/8] Add a field to show which SCSI controller type we are currently using

2017-09-28 Thread Emmanuel Kasper
On 09/27/2017 11:27 AM, Thomas Lamprecht wrote:
> On 09/26/2017 02:17 PM, Emmanuel Kasper wrote:
>> ---
>>   www/manager6/qemu/HDEdit.js | 15 ---
>>   1 file changed, 12 insertions(+), 3 deletions(-)
>>
>> diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
>> index 8a415d8b..075ad667 100644
>> --- a/www/manager6/qemu/HDEdit.js
>> +++ b/www/manager6/qemu/HDEdit.js
>> @@ -24,11 +24,12 @@ Ext.define('PVE.qemu.HDInputPanel', {
>>   this.lookup('iothread').setValue(false);
>>   }
>>   -    var allowDiscard = value.match(/^scsi/);
>> -    this.lookup('discard').setDisabled(!allowDiscard);
>> -    if (!allowDiscard) {
>> +    var scsi = value.match(/^scsi/);
>> +    this.lookup('discard').setDisabled(!scsi);
>> +    if (!scsi) {
>>   this.lookup('discard').setValue(false);
>>   }
>> +    this.lookup('scsiType').setVisible(scsi);
>>   },
>>     control: {
>> @@ -141,6 +142,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
>>     if (me.bussel) {
>>   me.bussel.setVMConfig(vmconfig);
>> +    me.scsiType.setValue(vmconfig.scsihw);
>>   }
>>   if (me.unusedDisks) {
>>   var disklist = [];
>> @@ -195,6 +197,13 @@ Ext.define('PVE.qemu.HDInputPanel', {
>>   vmconfig: me.insideWizard ? {ide2: 'cdrom'} : {}
>>   });
>>   me.column1.push(me.bussel);
>> +    me.scsiType = Ext.create('Ext.form.field.Display', {>
>> +    fieldLabel: gettext('Type'),
> 
> Type is to general and not really true here (Type of what?).
> 'SCSI Controller' would match the scsihw edit window better
> and make it clearer why it disappears when something other
> than SCSI is selected, what do you think?

The current gettext strings we have here are either 'SCSI Controller
Type' need to be wrapped on two lines in the Edit Window, or 'Type'

Since this 'Type' field is underneath the Bus Selector, appears only
when the SCSI controller is selected in the Bus Selector, and include
the string SCSI in all the cases that interess us (VirtIO SCSI), I think
'Type' is enough.

For the rest, agree with your suggestions, I will integrate them in a V4.

Emmanuel









___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] [PATCH manager v3 1/8] Do not use 'autoselect' as a boolean when preselecting a bus

2017-09-28 Thread Emmanuel Kasper
On 09/27/2017 10:47 AM, Thomas Lamprecht wrote:
> On 09/26/2017 02:17 PM, Emmanuel Kasper wrote:
>> The bus selector is displayed when we add a Hard Disk or CD Drive.
>> When it is displayed, we *always* preselect the next available
>> slot on the controller of our choice.
>> So this test is not needed.
>>
>> We keep the test on the string value of 'autoselect' to select
>> a bus position when adding a CD Drive.
> 
> Looks good, at least with git show -w :)
> Reviewed-by: Thomas Lamprecht 
> 
> A side comment still inline below.
> 
>> ---
>>   www/manager6/form/ControllerSelector.js | 53
>> -
>>   www/manager6/qemu/HDEdit.js |  2 +-
>>   2 files changed, 27 insertions(+), 28 deletions(-)
>>
>> diff --git a/www/manager6/form/ControllerSelector.js
>> b/www/manager6/form/ControllerSelector.js
>> index 002134ef..045e7d0d 100644
>> --- a/www/manager6/form/ControllerSelector.js
>> +++ b/www/manager6/form/ControllerSelector.js
>> @@ -58,37 +58,36 @@ Ext.define('PVE.form.ControllerSelector', {
>>   var me = this;
>>     me.vmconfig = Ext.apply({}, vmconfig);
>> -    if (autoSelect) {
>> -    var clist = ['ide', 'virtio', 'scsi', 'sata'];
>> -    if (autoSelect === 'cdrom') {
>> -    clist = ['ide', 'scsi', 'sata'];
>> -    if (!Ext.isDefined(me.vmconfig.ide2)) {
>> -    me.down('field[name=controller]').setValue('ide');
>> -    me.down('field[name=deviceid]').setValue(2);
>> -    return;
>> -    }
>> -    } else  {
>> -    // in most cases we want to add a disk to the same controller
>> -    // we previously used
>> -    clist = me.sortByPreviousUsage(me.vmconfig, clist);
>> +
>> +    var clist = ['ide', 'virtio', 'scsi', 'sata'];
>> +    if (autoSelect === 'cdrom') {
>> +    clist = ['ide', 'scsi', 'sata'];
>> +    if (!Ext.isDefined(me.vmconfig.ide2)) {
> 
> AFAIS, this is just the fastpath?
> As performance is rarely a problem when iterating a very small array,
> maybe just remove this all but the line where clist gets re-set
> and let the general-purpose code below handle this case too?

but this would mean that a newly added CD ROM drive is not anymore added
to the index 2 on the IDE bus by default ?

I am not sure of the implications of these for the machines type we
emulate, so I would prefer not to change this in this patch serie



___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v4 0/8] Display the SCSI controller type when adding a new disk

2017-10-02 Thread Emmanuel Kasper
Since we switched to the SCSI controller in the Wizard as the recommended 
controller
for hard disks (using VirtIO scsi in the backend) it was not clear for users
that they were actually using a paravirtualized driver.

An example of user confusion:
https://forum.proxmox.com/threads/proxmox-hypervisor-scsi-or-virtio.36506/#post-179056
The problem was also seen in trainings.

changes since V3:

 * Patch 4: infer that we don't need VirtIO in the controller list, as 
 autoSelect is set to 'cdrom'.  I kept the 'autoSelect' function parameter, as
 I am not sure of the safety of changing the IDE bus position for CD ROM drives.
 * Patch 6: do not suspend change events, use temp variable to store SCSI type
 * Patch 7-8: fix long lines in commit log


Emmanuel Kasper (8):
  Do not use 'autoselect' as a boolean when preselecting a bus
  Remove unused noScsi parameter
  Save the components we found via down() in a variable for later reuse.
  Do not use the noVirtIO property to build the controller list
  Add a field to show which SCSI controller type we are currently using
  Update VM SCSI type based on iothread value when inside the wizard
  Update VM SCSI controller type after OS selection in Wizard
  Render full name of VirtIO Block controller

 www/manager6/form/BusTypeSelector.js|  8 ++---
 www/manager6/form/ControllerSelector.js | 59 +++--
 www/manager6/qemu/CreateWizard.js   |  5 ---
 www/manager6/qemu/HDEdit.js | 37 -
 www/manager6/qemu/OSDefaults.js |  2 +-
 www/manager6/qemu/OSTypeEdit.js | 10 +-
 6 files changed, 60 insertions(+), 61 deletions(-)

-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v4 4/8] Do not use the noVirtIO property to build the controller list

2017-10-02 Thread Emmanuel Kasper
This property is only used for CDEdit, so we can deduce this from
the fact that autoselect is set to 'cdrom'
---
 www/manager6/form/ControllerSelector.js | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/www/manager6/form/ControllerSelector.js 
b/www/manager6/form/ControllerSelector.js
index 15023a7a..1d1ca556 100644
--- a/www/manager6/form/ControllerSelector.js
+++ b/www/manager6/form/ControllerSelector.js
@@ -76,9 +76,6 @@ Ext.define('PVE.form.ControllerSelector', {
 
Ext.Array.each(clist, function(controller) {
var confid, i;
-   if (controller === 'virtio' && me.noVirtIO) {
-   return; //continue
-   }
bussel.setValue(controller);
for (i = 0; i <= PVE.form.ControllerSelector.maxIds[controller]; 
i++) {
confid = controller + i.toString();
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v4 3/8] Save the components we found via down() in a variable for later reuse.

2017-10-02 Thread Emmanuel Kasper
---
 www/manager6/form/ControllerSelector.js | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/www/manager6/form/ControllerSelector.js 
b/www/manager6/form/ControllerSelector.js
index 14ad574e..15023a7a 100644
--- a/www/manager6/form/ControllerSelector.js
+++ b/www/manager6/form/ControllerSelector.js
@@ -58,11 +58,14 @@ Ext.define('PVE.form.ControllerSelector', {
me.vmconfig = Ext.apply({}, vmconfig);
 
var clist = ['ide', 'virtio', 'scsi', 'sata'];
+   var bussel = me.down('field[name=controller]');
+   var deviceid = me.down('field[name=deviceid]');
+
if (autoSelect === 'cdrom') {
clist = ['ide', 'scsi', 'sata'];
if (!Ext.isDefined(me.vmconfig.ide2)) {
-   me.down('field[name=controller]').setValue('ide');
-   me.down('field[name=deviceid]').setValue(2);
+   bussel.setValue('ide');
+   deviceid.setValue(2);
return;
}
} else  {
@@ -76,16 +79,16 @@ Ext.define('PVE.form.ControllerSelector', {
if (controller === 'virtio' && me.noVirtIO) {
return; //continue
}
-   me.down('field[name=controller]').setValue(controller);
+   bussel.setValue(controller);
for (i = 0; i <= PVE.form.ControllerSelector.maxIds[controller]; 
i++) {
confid = controller + i.toString();
if (!Ext.isDefined(me.vmconfig[confid])) {
-   me.down('field[name=deviceid]').setValue(i);
+   deviceid.setValue(i);
return false; // break
}
}
});
-   me.down('field[name=deviceid]').validate();
+   deviceid.validate();
 },
 
 initComponent: function() {
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v4 5/8] Add a field to show which SCSI controller type we are currently using

2017-10-02 Thread Emmanuel Kasper
---
 www/manager6/qemu/HDEdit.js | 15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index 8a415d8b..075ad667 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -24,11 +24,12 @@ Ext.define('PVE.qemu.HDInputPanel', {
this.lookup('iothread').setValue(false);
}
 
-   var allowDiscard = value.match(/^scsi/);
-   this.lookup('discard').setDisabled(!allowDiscard);
-   if (!allowDiscard) {
+   var scsi = value.match(/^scsi/);
+   this.lookup('discard').setDisabled(!scsi);
+   if (!scsi) {
this.lookup('discard').setValue(false);
}
+   this.lookup('scsiType').setVisible(scsi);
},
 
control: {
@@ -141,6 +142,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
 
if (me.bussel) {
me.bussel.setVMConfig(vmconfig);
+   me.scsiType.setValue(vmconfig.scsihw);
}
if (me.unusedDisks) {
var disklist = [];
@@ -195,6 +197,13 @@ Ext.define('PVE.qemu.HDInputPanel', {
vmconfig: me.insideWizard ? {ide2: 'cdrom'} : {}
});
me.column1.push(me.bussel);
+   me.scsiType = Ext.create('Ext.form.field.Display', {
+   fieldLabel: gettext('Type'),
+   reference: 'scsiType',
+   renderer: PVE.Utils.render_scsihw,
+   hidden: true
+   });
+   me.column1.push(me.scsiType);
}
 
if (me.unused) {
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v4 1/8] Do not use 'autoselect' as a boolean when preselecting a bus

2017-10-02 Thread Emmanuel Kasper
The bus selector is displayed when we add a Hard Disk or CD Drive.
When it is displayed, we *always* preselect the next available
slot on the controller of our choice.
So this test is not needed.

We keep the test on the string value of 'autoselect' to select
a bus position when adding a CD Drive.
---
 www/manager6/form/ControllerSelector.js | 53 -
 www/manager6/qemu/HDEdit.js |  2 +-
 2 files changed, 27 insertions(+), 28 deletions(-)

diff --git a/www/manager6/form/ControllerSelector.js 
b/www/manager6/form/ControllerSelector.js
index 002134ef..045e7d0d 100644
--- a/www/manager6/form/ControllerSelector.js
+++ b/www/manager6/form/ControllerSelector.js
@@ -58,37 +58,36 @@ Ext.define('PVE.form.ControllerSelector', {
var me = this;
 
me.vmconfig = Ext.apply({}, vmconfig);
-   if (autoSelect) {
-   var clist = ['ide', 'virtio', 'scsi', 'sata'];
-   if (autoSelect === 'cdrom') {
-   clist = ['ide', 'scsi', 'sata'];
-   if (!Ext.isDefined(me.vmconfig.ide2)) {
-   me.down('field[name=controller]').setValue('ide');
-   me.down('field[name=deviceid]').setValue(2);
-   return;
-   }
-   } else  {
-   // in most cases we want to add a disk to the same controller
-   // we previously used
-   clist = me.sortByPreviousUsage(me.vmconfig, clist);
+
+   var clist = ['ide', 'virtio', 'scsi', 'sata'];
+   if (autoSelect === 'cdrom') {
+   clist = ['ide', 'scsi', 'sata'];
+   if (!Ext.isDefined(me.vmconfig.ide2)) {
+   me.down('field[name=controller]').setValue('ide');
+   me.down('field[name=deviceid]').setValue(2);
+   return;
}
+   } else  {
+   // in most cases we want to add a disk to the same controller
+   // we previously used
+   clist = me.sortByPreviousUsage(me.vmconfig, clist);
+   }
 
-   Ext.Array.each(clist, function(controller) {
-   var confid, i;
-   if ((controller === 'virtio' && me.noVirtIO) ||
+   Ext.Array.each(clist, function(controller) {
+   var confid, i;
+   if ((controller === 'virtio' && me.noVirtIO) ||
(controller === 'scsi' && me.noScsi)) {
-   return; //continue
-   }
-   me.down('field[name=controller]').setValue(controller);
-   for (i = 0; i <= 
PVE.form.ControllerSelector.maxIds[controller]; i++) {
-   confid = controller + i.toString();
-   if (!Ext.isDefined(me.vmconfig[confid])) {
-   me.down('field[name=deviceid]').setValue(i);
-   return false; // break
-   }
+   return; //continue
+   }
+   me.down('field[name=controller]').setValue(controller);
+   for (i = 0; i <= PVE.form.ControllerSelector.maxIds[controller]; 
i++) {
+   confid = controller + i.toString();
+   if (!Ext.isDefined(me.vmconfig[confid])) {
+   me.down('field[name=deviceid]').setValue(i);
+   return false; // break
}
-   });
-   }
+   }
+   });
me.down('field[name=deviceid]').validate();
 },
 
diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index e7535f50..8a415d8b 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -140,7 +140,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
me.vmconfig = vmconfig;
 
if (me.bussel) {
-   me.bussel.setVMConfig(vmconfig, true);
+   me.bussel.setVMConfig(vmconfig);
}
if (me.unusedDisks) {
var disklist = [];
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v4 6/8] Update VM SCSI type based on iothread value when inside the wizard

2017-10-02 Thread Emmanuel Kasper
We keep the same logic as before: once the iothread option is selected,
the SCSI controller is switched to virtio-scsi-single, until iothread
is unselected again.
---
 www/manager6/qemu/HDEdit.js | 20 
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index 075ad667..814097b1 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -74,6 +74,15 @@ Ext.define('PVE.qemu.HDInputPanel', {
me.hdsizesel.setVisible(true);
}
}
+   },
+   'field[name=iothread]' : {
+   change: function(f, value) {
+   if (!this.getView().insideWizard) {
+   return;
+   }
+   var vmScsiType = value ? 'virtio-scsi-single': 
'virtio-scsi-pci';
+   this.lookupReference('scsiType').setValue(vmScsiType);
+   }
}
}
 },
@@ -116,10 +125,6 @@ Ext.define('PVE.qemu.HDInputPanel', {
 
if (values.iothread) {
me.drive.iothread = 'on';
-   // do not silently change a VM-wide option after creating it
-   if (me.insideWizard) {
-   params.scsihw = 'virtio-scsi-single';
-   }
} else {
delete me.drive.iothread;
}
@@ -130,6 +135,10 @@ Ext.define('PVE.qemu.HDInputPanel', {
delete me.drive.cache;
}
 
+   if (values.scsihw) {
+   params.scsihw = values.scsihw;
+   }
+
params[confid] = PVE.Parser.printQemuDrive(me.drive);
 
return params;
@@ -198,9 +207,12 @@ Ext.define('PVE.qemu.HDInputPanel', {
});
me.column1.push(me.bussel);
me.scsiType = Ext.create('Ext.form.field.Display', {
+   name: 'scsihw',
fieldLabel: gettext('Type'),
reference: 'scsiType',
renderer: PVE.Utils.render_scsihw,
+   // do not change a VM wide option after creation
+   submitValue: me.insideWizard,
hidden: true
});
me.column1.push(me.scsiType);
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v4 2/8] Remove unused noScsi parameter

2017-10-02 Thread Emmanuel Kasper
SCSI is a valid bus for Disks and CD drives, so it should always
be appear in the bus list.
---
 www/manager6/form/BusTypeSelector.js| 6 +-
 www/manager6/form/ControllerSelector.js | 6 +-
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/www/manager6/form/BusTypeSelector.js 
b/www/manager6/form/BusTypeSelector.js
index 9b9492fc..ae7c327e 100644
--- a/www/manager6/form/BusTypeSelector.js
+++ b/www/manager6/form/BusTypeSelector.js
@@ -4,8 +4,6 @@ Ext.define('PVE.form.BusTypeSelector', {
   
 noVirtIO: false,
 
-noScsi: false,
-
 initComponent: function() {
var me = this;
 
@@ -15,9 +13,7 @@ Ext.define('PVE.form.BusTypeSelector', {
me.comboItems.push(['virtio', 'VirtIO']);
}
 
-   if (!me.noScsi) {
-   me.comboItems.push(['scsi', 'SCSI']);
-   }
+   me.comboItems.push(['scsi', 'SCSI']);
 
me.callParent();
 }
diff --git a/www/manager6/form/ControllerSelector.js 
b/www/manager6/form/ControllerSelector.js
index 045e7d0d..14ad574e 100644
--- a/www/manager6/form/ControllerSelector.js
+++ b/www/manager6/form/ControllerSelector.js
@@ -13,8 +13,6 @@ Ext.define('PVE.form.ControllerSelector', {
 
 noVirtIO: false,
 
-noScsi: false,
-
 vmconfig: {}, // used to check for existing devices
 
 sortByPreviousUsage: function(vmconfig, controllerList) {
@@ -75,8 +73,7 @@ Ext.define('PVE.form.ControllerSelector', {
 
Ext.Array.each(clist, function(controller) {
var confid, i;
-   if ((controller === 'virtio' && me.noVirtIO) ||
-   (controller === 'scsi' && me.noScsi)) {
+   if (controller === 'virtio' && me.noVirtIO) {
return; //continue
}
me.down('field[name=controller]').setValue(controller);
@@ -106,7 +103,6 @@ Ext.define('PVE.form.ControllerSelector', {
name: 'controller',
value: PVE.qemu.OSDefaults.generic.busType,
noVirtIO: me.noVirtIO,
-   noScsi: me.noScsi,
allowBlank: false,
flex: 2,
listeners: {
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v4 8/8] Render full name of VirtIO Block controller

2017-10-02 Thread Emmanuel Kasper
This will hopefully reduce confusion with SCSI VirtIO controller
---
 www/manager6/form/BusTypeSelector.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/www/manager6/form/BusTypeSelector.js 
b/www/manager6/form/BusTypeSelector.js
index ae7c327e..8abdcf4b 100644
--- a/www/manager6/form/BusTypeSelector.js
+++ b/www/manager6/form/BusTypeSelector.js
@@ -10,7 +10,7 @@ Ext.define('PVE.form.BusTypeSelector', {
me.comboItems = [['ide', 'IDE'], ['sata', 'SATA']];
 
if (!me.noVirtIO) {
-   me.comboItems.push(['virtio', 'VirtIO']);
+   me.comboItems.push(['virtio', 'VirtIO Block']);
}
 
me.comboItems.push(['scsi', 'SCSI']);
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v4 7/8] Update VM SCSI controller type after OS selection in Wizard

2017-10-02 Thread Emmanuel Kasper
This was done previously without any kind of user visible feedback, so users
would not know that they had a Virtio SCSI controller as default controller
for Linux VMs.
---
 www/manager6/qemu/CreateWizard.js |  5 -
 www/manager6/qemu/OSDefaults.js   |  2 +-
 www/manager6/qemu/OSTypeEdit.js   | 10 +-
 3 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/www/manager6/qemu/CreateWizard.js 
b/www/manager6/qemu/CreateWizard.js
index 954b8ef0..c508bb7f 100644
--- a/www/manager6/qemu/CreateWizard.js
+++ b/www/manager6/qemu/CreateWizard.js
@@ -1,7 +1,6 @@
 Ext.define('PVE.qemu.CreateWizard', {
 extend: 'PVE.window.Wizard',
 alias: 'widget.pveQemuCreateWizard',
-qemuScsiController: undefined,
 
 controller: {
 
@@ -167,10 +166,6 @@ Ext.define('PVE.qemu.CreateWizard', {
var nodename = kv.nodename;
delete kv.nodename;
 
-   if (me.qemuScsiController && !kv.scsihw) {
-   kv.scsihw = me.qemuScsiController;
-   }
-
PVE.Utils.API2Request({
url: '/nodes/' + nodename + '/qemu',
waitMsgTarget: me,
diff --git a/www/manager6/qemu/OSDefaults.js b/www/manager6/qemu/OSDefaults.js
index d47b9d01..d6f733a8 100644
--- a/www/manager6/qemu/OSDefaults.js
+++ b/www/manager6/qemu/OSDefaults.js
@@ -66,7 +66,7 @@ Ext.define('PVE.qemu.OSDefaults', {
pveOS: 'w2k',
parent : 'generic',
networkCard: 'rtl8139',
-   scsihw: 'lsi'
+   scsihw: ''
});
// https://pve.proxmox.com/wiki/Windows_XP_Guest_Notes
addOS({
diff --git a/www/manager6/qemu/OSTypeEdit.js b/www/manager6/qemu/OSTypeEdit.js
index 1235ddfd..27b0c40c 100644
--- a/www/manager6/qemu/OSTypeEdit.js
+++ b/www/manager6/qemu/OSTypeEdit.js
@@ -27,7 +27,7 @@ Ext.define('PVE.qemu.OSTypeInputPanel', {
 
me.setWidget('pveBusSelector', targetValues.busType);
me.setWidget('pveNetworkCardSelector', targetValues.networkCard);
-   me.setWizardHiddenValue('qemuScsiController', targetValues.scsihw);
+   me.setWidget('field[name=scsihw]', targetValues.scsihw);
},
setWidget: function(widget, newValue) {
// changing a widget is safe only if ComponentQuery.query returns us
@@ -38,14 +38,6 @@ Ext.define('PVE.qemu.OSTypeInputPanel', {
} else {
throw 'non unique widget :' + widget + ' in Wizard';
}
-   },
-   setWizardHiddenValue: function(property, newValue) {
-   var wizards = Ext.ComponentQuery.query('pveQemuCreateWizard ');
-   if (wizards.length === 1) {
-   wizards[0][property] = newValue;
-   } else {
-   throw 'non unique wizard, unable to set ' + property;
-   }
}
 },
 
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] [PATCH manager] fix #1510: do not scroll back to focus when view gets refreshed

2017-10-02 Thread Emmanuel Kasper
On 10/02/2017 02:53 PM, Thomas Lamprecht wrote:
> Seems to works good, the small code change you made to the
> original function looks also good to me:

> Reviewed-by: Thomas Lamprecht 

Fine for me too,  I tested this with IE11 and this works as expected.






___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH docs] Add a paragraph to explain how network models match use cases

2017-10-02 Thread Emmanuel Kasper
Also :
 * explain more clearly when PVE switched to persistent device naming. (5.0)
 * use eno1 instead of eno0 everywhere when refering to the first onboard device
 * use IP addresses from the range IPv4 Address Blocks for Documentation
 (rfc5737) instead of private IPv4 addresses when giving examples of public IPs
---
 pve-network.adoc | 101 ++-
 1 file changed, 62 insertions(+), 39 deletions(-)

diff --git a/pve-network.adoc b/pve-network.adoc
index beb69ae..5d53924 100644
--- a/pve-network.adoc
+++ b/pve-network.adoc
@@ -5,44 +5,32 @@ ifdef::wiki[]
 :pve-toplevel:
 endif::wiki[]
 
-{pve} uses a bridged networking model. Each host can have up to 4094
-bridges. Bridges are like physical network switches implemented in
-software. All VMs can share a single bridge, as if
-virtual network cables from each guest were all plugged into the same
-switch. But you can also create multiple bridges to separate network
-domains.
-
-For connecting VMs to the outside world, bridges are attached to
-physical network cards. For further flexibility, you can configure
-VLANs (IEEE 802.1q) and network bonding, also known as "link
-aggregation". That way it is possible to build complex and flexible
-virtual networks.
+Network configuration can be done either via the GUI, or by manually 
+editing the file `/etc/network/interfaces`, which contains the
+whole network configuration. The  `interfaces(5)` manual page contains the
+complete format description. All {pve} tools try hard to keep direct
+ user modifications, but using the GUI is still preferable, because it
+protects you from errors.
 
-Debian traditionally uses the `ifup` and `ifdown` commands to
-configure the network. The file `/etc/network/interfaces` contains the
-whole network setup. Please refer to to manual page (`man interfaces`)
-for a complete format description.
+Once the network is configured, you can use the Debian traditional tools 
`ifup` 
+and `ifdown` commands to bring interfaces up and down.
 
 NOTE: {pve} does not write changes directly to
 `/etc/network/interfaces`. Instead, we write into a temporary file
 called `/etc/network/interfaces.new`, and commit those changes when
 you reboot the node.
 
-It is worth mentioning that you can directly edit the configuration
-file. All {pve} tools tries hard to keep such direct user
-modifications. Using the GUI is still preferable, because it
-protect you from errors.
-
-
 Naming Conventions
 ~~
 
 We currently use the following naming conventions for device names:
 
-* New Ethernet devices: en*, systemd network interface names.
+* Ethernet devices: en*, systemd network interface names. This naming scheme is
+ used for new {pve} installations since version 5.0.
 
-* Legacy Ethernet devices: eth[N], where 0 ≤ N (`eth0`, `eth1`, ...)
-They are available when Proxmox VE has been updated by an earlier version.
+* Ethernet devices: eth[N], where 0 ≤ N (`eth0`, `eth1`, ...) This naming
+scheme is used for {pve} hosts which were installed before the 5.0
+release. When upgrading to 5.0, the names are kept as-is.
 
 * Bridge names: vmbr[N], where 0 ≤ N ≤ 4094 (`vmbr0` - `vmbr4094`)
 
@@ -52,8 +40,7 @@ They are available when Proxmox VE has been updated by an 
earlier version.
   separated by a period (`eno1.50`, `bond1.30`)
 
 This makes it easier to debug networks problems, because the device
-names implies the device type.
-
+name implies the device type.
 
 Systemd Network Interface Names
 ^^^
@@ -78,12 +65,46 @@ The most common patterns are:
 
 For more information see 
https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/[Predictable
 Network Interface Names].
 
+Choosing a network configuration
+
+
+Depending on your current network organization and your resources you can 
+choose either a bridged, routed, or masquerading networking setup.
+
+{pve} server in a private LAN, using an external gateway to reach the internet
+^^
+
+The *Bridged* model makes the most sense in this case, and this is also 
+the default mode on new {pve} installations.
+Each of your Guest system will have a virtual interface attached to the 
+{pve} bridge. This is similar in effect to having the Guest network card 
+directly connected to your LAN.
+
+{pve} server at hosting provider, with public IP ranges for Guests
+^^
+
+For this setup, you can use either a *Bridged* or *Routed* model, depending on
+what your provider allows.
+
+{pve} server at hosting provider, with a single public IP address
+^
+
+In that case the only way to get outgoing network accesses for your guest
+systems is to use *Masquerading*. For incoming network access to your guests, 
+you will need to configure 

[pve-devel] [PATCH qemu 1/2] Provides a qemu-system-x86 virtual package

2017-10-04 Thread Emmanuel Kasper
This allows adding additional debian packages on pve hosts
which depends on those.

The following install paths were tested:

 * install of proxmox-ve on debian systems with standard package
 set:  works as expected

 * install of proxmox-ve on debian having the debian qemu package
 installed: refused by the package manager as expected, until
 qemu, qemu-system-x86, libspice-server1 are deinstalled

 * manual install of qemu-system-x86 after proxmox-ve
 is installed: refused by the package manager as expected, until
 proxmox-ve and dependencies are removed

 * install of packages depending on qemu-system-x86
 having proxmox-ve installed: thoses packages are installed as
 expected, no conflict
---
 debian/control | 5 -
 debian/rules   | 8 ++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/debian/control b/debian/control
index 68ba534..c0ade16 100644
--- a/debian/control
+++ b/debian/control
@@ -51,10 +51,13 @@ Conflicts: kvm,
pve-qemu-kvm-2.6.18,
qemu,
qemu-kvm,
+   qemu-system-x86,
qemu-utils,
-Provides: qemu-utils,
+Provides: qemu-system-x86,
+  qemu-utils,
 Replaces: pve-kvm,
   pve-qemu-kvm-2.6.18,
+  qemu-system-x86,
   qemu-utils,
 Description: Full virtualization on x86 hardware
  Using KVM, one can run multiple virtual PCs, each running unmodified Linux or
diff --git a/debian/rules b/debian/rules
index 98637c7..5664fee 100755
--- a/debian/rules
+++ b/debian/rules
@@ -86,8 +86,12 @@ install: build
# Add here commands to install the package into debian/pve-kvm.
$(MAKE) DESTDIR=$(destdir) install
 
-   mv $(destdir)/usr/bin/qemu-system-$(ARCH) $(destdir)/usr/bin/kvm
-   mv $(destdir)/usr/share/man/man1/qemu.1 
$(destdir)/usr/share/man/man1/kvm.1
+   dh_link usr/bin/qemu-system-$(ARCH) usr/bin/kvm
+   # qemu-system-i386 and qemu-system-x86_64 provides the same hardware 
emulation
+ifeq ($(ARCH),x86_64)
+   dh_link usr/bin/qemu-system-$(ARCH) usr/bin/qemu-system-i386
+endif
+   dh_link usr/share/man/man1/qemu.1  usr/share/man/man1/kvm.1
 
# Install the userspace utilities
install -s -m 0755 vma $(destdir)/usr/bin/
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH qemu 2/2] Add a 'Conflicts' with qemu-system-common from Debian

2017-10-04 Thread Emmanuel Kasper
Both qemu-system-common and our pve-qemu-kvm package install the
file /usr/bin/virtfs-proxy-helper.

Since qemu-system-common does not have reverse dependencies in Debian for
packages besides  qemu-system-, and ovmf, which we don't want to
install anyway, we do not need a 'Provides' for it.
---
 debian/control | 1 +
 1 file changed, 1 insertion(+)

diff --git a/debian/control b/debian/control
index c0ade16..8205ed7 100644
--- a/debian/control
+++ b/debian/control
@@ -51,6 +51,7 @@ Conflicts: kvm,
pve-qemu-kvm-2.6.18,
qemu,
qemu-kvm,
+   qemu-system-common,
qemu-system-x86,
qemu-utils,
 Provides: qemu-system-x86,
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH qemu 0/2] Provides a qemu-system-x86 virtual package

2017-10-04 Thread Emmanuel Kasper
This will allow the installation of extra packages requiring a qemu binary
Bigger use case is libguestfs0 and libguestfs-tools , this has been asked
in a few different forum threads
libguestfs-tools allow to inspect and edit disk images of offline guests
and do not require libvirt domains to be used.

Changes since V1:
 * do not rename the qemu binary, but add a kvm symlink to it
 * do not rename the qemu man page, but add kvm symlint to it
 * add a symlink from qemu-system-i386 to qemu-system-x86_64 to better
 match the Debian package we 'Provides'.

While working on the dependencies I noticed, we had a file conflict with 
qemu-system-common which is addressed by the second patch

Example use cases:

virt-edit --add /path/to/disk_image /boot/grub/grub.cfg
virt-win-reg /path/to/disk/image "HKLM\SOFTWARE\Microsoft\Windows 
NT\CurrentVersion" ProductName
Windows 10 Enterprise Evaluation

See http://libguestfs.org/guestfs-faq.1.html for the relation between libguestfs
and libvirt.
Emmanuel Kasper (2):
  Provides a qemu-system-x86 virtual package
  Add a 'Conflicts' with qemu-system-common from Debian

 debian/control | 6 +-
 debian/rules   | 8 ++--
 2 files changed, 11 insertions(+), 3 deletions(-)

-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] [PATCH qemu 1/2] Provides a qemu-system-x86 virtual package

2017-10-04 Thread Emmanuel Kasper
n 10/04/2017 04:10 PM, Thomas Lamprecht wrote:
> On 10/04/2017 03:53 PM, Emmanuel Kasper wrote:
>> This allows adding additional debian packages on pve hosts
>> which depends on those.
>>
>> The following install paths were tested:
>>
>>  * install of proxmox-ve on debian systems with standard package
>>  set:  works as expected
>>
>>  * install of proxmox-ve on debian having the debian qemu package
>>  installed: refused by the package manager as expected, until
>>  qemu, qemu-system-x86, libspice-server1 are deinstalled
>>
>>  * manual install of qemu-system-x86 after proxmox-ve
>>  is installed: refused by the package manager as expected, until
>>  proxmox-ve and dependencies are removed
>>
>>  * install of packages depending on qemu-system-x86
>>  having proxmox-ve installed: thoses packages are installed as
>>  expected, no conflict
>> ---
>>  debian/control | 5 -
>>  debian/rules   | 8 ++--
>>  2 files changed, 10 insertions(+), 3 deletions(-)
>>
>> diff --git a/debian/control b/debian/control
>> index 68ba534..c0ade16 100644
>> --- a/debian/control
>> +++ b/debian/control
>> @@ -51,10 +51,13 @@ Conflicts: kvm,
>> pve-qemu-kvm-2.6.18,
>> qemu,
>> qemu-kvm,
>> +   qemu-system-x86,
>> qemu-utils,
>> -Provides: qemu-utils,
>> +Provides: qemu-system-x86,
>> +  qemu-utils,
>>  Replaces: pve-kvm,
>>pve-qemu-kvm-2.6.18,
>> +  qemu-system-x86,
>>qemu-utils,
>>  Description: Full virtualization on x86 hardware
>>   Using KVM, one can run multiple virtual PCs, each running unmodified Linux 
>> or
>> diff --git a/debian/rules b/debian/rules
>> index 98637c7..5664fee 100755
>> --- a/debian/rules
>> +++ b/debian/rules
>> @@ -86,8 +86,12 @@ install: build
>>  # Add here commands to install the package into debian/pve-kvm.
>>  $(MAKE) DESTDIR=$(destdir) install
>>  
>> -mv $(destdir)/usr/bin/qemu-system-$(ARCH) $(destdir)/usr/bin/kvm
>> -mv $(destdir)/usr/share/man/man1/qemu.1 
>> $(destdir)/usr/share/man/man1/kvm.1
>> +dh_link usr/bin/qemu-system-$(ARCH) usr/bin/kvm
>> +# qemu-system-i386 and qemu-system-x86_64 provides the same hardware 
>> emulation
>> +ifeq ($(ARCH),x86_64)
>> +dh_link usr/bin/qemu-system-$(ARCH) usr/bin/qemu-system-i386
>> +endif
>> +dh_link usr/share/man/man1/qemu.1  usr/share/man/man1/kvm.1
> 
> What about adding a 'debian/pve-qemu-kvm.links' file with the following
> content:
> usr/bin/qemu-system-x86_64 usr/bin/kvm
> usr/bin/qemu-system-x86_64 usr/bin/qemu-system-i386
> usr/share/man/man1/qemu.1  usr/share/man/man1/kvm.1
> 
> We currently support only x86_64 so this should be OK, if we add another
> architecture we either just add the other links too or (preferred) add a
> new package with the same package source - e.g., pve-qemu-aarch64.

Well if there is a consensus that we should use
debian/pve-qemu-kvm.{links,install} files,  I am not opposed to it :)
I just created the symlinks in the debian/rule, so we could build a
package for aarch64  with this rule file.
If you plan to create a separate binary for aarch64, we can use indeed
the declarative dh synthax.

@Wolgang B: you seemed to prefer in your review of the RFC version of
this patch to have the symlinks created based on the value of $(ARCH) in
the rules file. Any opinion on the matter ?


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] [PATCH manager v3 5/8] Add a field to show which SCSI controller type we are currently using

2017-10-05 Thread Emmanuel Kasper
On 10/05/2017 11:25 AM, Thomas Lamprecht wrote:
> On 09/28/2017 03:10 PM, Emmanuel Kasper wrote:
>> On 09/27/2017 11:27 AM, Thomas Lamprecht wrote:
>>> On 09/26/2017 02:17 PM, Emmanuel Kasper wrote:
>>>> ---
>>>>   www/manager6/qemu/HDEdit.js | 15 ---
>>>>   1 file changed, 12 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
>>>> index 8a415d8b..075ad667 100644
>>>> --- a/www/manager6/qemu/HDEdit.js
>>>> +++ b/www/manager6/qemu/HDEdit.js
>>>> @@ -24,11 +24,12 @@ Ext.define('PVE.qemu.HDInputPanel', {
>>>>   this.lookup('iothread').setValue(false);
>>>>   }
>>>>   -    var allowDiscard = value.match(/^scsi/);
>>>> -    this.lookup('discard').setDisabled(!allowDiscard);
>>>> -    if (!allowDiscard) {
>>>> +    var scsi = value.match(/^scsi/);
>>>> +    this.lookup('discard').setDisabled(!scsi);
>>>> +    if (!scsi) {
>>>>   this.lookup('discard').setValue(false);
>>>>   }
>>>> +    this.lookup('scsiType').setVisible(scsi);
>>>>   },
>>>>     control: {
>>>> @@ -141,6 +142,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
>>>>     if (me.bussel) {
>>>>   me.bussel.setVMConfig(vmconfig);
>>>> +    me.scsiType.setValue(vmconfig.scsihw);
>>>>   }
>>>>   if (me.unusedDisks) {
>>>>   var disklist = [];I have renamed and the Display component to 
>>>> SCSI 
>>>> @@ -195,6 +197,13 @@ Ext.define('PVE.qemu.HDInputPanel', {
>>>>   vmconfig: me.insideWizard ? {ide2: 'cdrom'} : {}
>>>>   });
>>>>   me.column1.push(me.bussel);
>>>> +    me.scsiType = Ext.create('Ext.form.field.Display', {>
>>>> +    fieldLabel: gettext('Type'),
>>>
>>> Type is to general and not really true here (Type of what?).
>>> 'SCSI Controller' would match the scsihw edit window better
>>> and make it clearer why it disappears when something other
>>> than SCSI is selected, what do you think?
>>
>> The current gettext strings we have here are either 'SCSI Controller
>> Type' need to be wrapped on two lines in the Edit Window, or 'Type'
>>
> 
> So my proposal would then be to change 'SCSI Controller Type'
> to 'SCSI Controller'. 'Type' does not gives additional information for
> this we select a SCSI controller here and we do not have type appended
> to other fields, e.g., BIOS, Display.
> 
>> Since this 'Type' field is underneath the Bus Selector, appears only
>> when the SCSI controller is selected in the Bus Selector, and include
>> the string SCSI in all the cases that interess us (VirtIO SCSI), I think
>> 'Type' is enough.
>>
> 
> The user does not knows the set of possible values though, so he sees
> that SCSI appears with but there could be other options appearing to
> as he does not sees a list of all possible options. IMHO, this is not
> really user friendly. Also we would diverge from our strategy to avoid
> calling the same thing two different names in the UI, with your version.
> 

agreed, we should not use different names when refering the same
ressource (Dominik favours your proposition as well)

___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v5 5/8] Add a field to show which SCSI controller type we are currently using

2017-10-05 Thread Emmanuel Kasper
We use the field label 'SCSI Controller'. 'Type' is redundant, otherwise
we would have Network Card Type, Display Type, Network Card type, etc ...
---
changes since v4:
 * rename the field label to SCSI Controller, and the associated
  component reference to scsiController.

 www/manager6/qemu/HDEdit.js  | 15 ---
 www/manager6/qemu/Options.js |  2 +-
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index 8a415d8b..b6f08080 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -24,11 +24,12 @@ Ext.define('PVE.qemu.HDInputPanel', {
this.lookup('iothread').setValue(false);
}
 
-   var allowDiscard = value.match(/^scsi/);
-   this.lookup('discard').setDisabled(!allowDiscard);
-   if (!allowDiscard) {
+   var scsi = value.match(/^scsi/);
+   this.lookup('discard').setDisabled(!scsi);
+   if (!scsi) {
this.lookup('discard').setValue(false);
}
+   this.lookup('scsiController').setVisible(scsi);
},
 
control: {
@@ -141,6 +142,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
 
if (me.bussel) {
me.bussel.setVMConfig(vmconfig);
+   me.scsiController.setValue(vmconfig.scsihw);
}
if (me.unusedDisks) {
var disklist = [];
@@ -195,6 +197,13 @@ Ext.define('PVE.qemu.HDInputPanel', {
vmconfig: me.insideWizard ? {ide2: 'cdrom'} : {}
});
me.column1.push(me.bussel);
+   me.scsiController = Ext.create('Ext.form.field.Display', {
+   fieldLabel: gettext('SCSI Controller'),
+   reference: 'scsiController',
+   renderer: PVE.Utils.render_scsihw,
+   hidden: true
+   });
+   me.column1.push(me.scsiController);
}
 
if (me.unused) {
diff --git a/www/manager6/qemu/Options.js b/www/manager6/qemu/Options.js
index 9dc36d70..b5d32537 100644
--- a/www/manager6/qemu/Options.js
+++ b/www/manager6/qemu/Options.js
@@ -175,7 +175,7 @@ Ext.define('PVE.qemu.Options', {
} : undefined
},
scsihw: {
-   header: gettext('SCSI Controller Type'),
+   header: gettext('SCSI Controller'),
editor: caps.vms['VM.Config.Options'] ? 'PVE.qemu.ScsiHwEdit' : 
undefined,
renderer: PVE.Utils.render_scsihw,
defaultValue: ''
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v5 6/8] Update VM SCSI type based on iothread value when inside the wizard

2017-10-05 Thread Emmanuel Kasper
We keep the same logic as before: once the iothread option is selected,
the SCSI controller is switched to virtio-scsi-single, until iothread
is unselected again.
---
rebase after 5/8 changed

 www/manager6/qemu/HDEdit.js | 21 +
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index b6f08080..2b860d8f 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -74,6 +74,15 @@ Ext.define('PVE.qemu.HDInputPanel', {
me.hdsizesel.setVisible(true);
}
}
+   },
+   'field[name=iothread]' : {
+   change: function(f, value) {
+   if (!this.getView().insideWizard) {
+   return;
+   }
+   var vmScsiType = value ? 'virtio-scsi-single': 
'virtio-scsi-pci';
+   this.lookupReference('scsiController').setValue(vmScsiType);
+   }
}
}
 },
@@ -116,10 +125,6 @@ Ext.define('PVE.qemu.HDInputPanel', {
 
if (values.iothread) {
me.drive.iothread = 'on';
-   // do not silently change a VM-wide option after creating it
-   if (me.insideWizard) {
-   params.scsihw = 'virtio-scsi-single';
-   }
} else {
delete me.drive.iothread;
}
@@ -130,6 +135,10 @@ Ext.define('PVE.qemu.HDInputPanel', {
delete me.drive.cache;
}
 
+   if (values.scsihw) {
+   params.scsihw = values.scsihw;
+   }
+
params[confid] = PVE.Parser.printQemuDrive(me.drive);
 
return params;
@@ -197,10 +206,14 @@ Ext.define('PVE.qemu.HDInputPanel', {
vmconfig: me.insideWizard ? {ide2: 'cdrom'} : {}
});
me.column1.push(me.bussel);
+
me.scsiController = Ext.create('Ext.form.field.Display', {
+   name: 'scsihw',
fieldLabel: gettext('SCSI Controller'),
reference: 'scsiController',
renderer: PVE.Utils.render_scsihw,
+   // do not change a VM wide option after creation
+   submitValue: me.insideWizard,
hidden: true
});
me.column1.push(me.scsiController);
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager v5 7/8] Update VM SCSI controller type after OS selection in Wizard

2017-10-05 Thread Emmanuel Kasper
This was done previously without any kind of user visible feedback, so users
would not know that they had a Virtio SCSI controller as default controller
for Linux VMs.
---
rebase after changes in 5/8
 www/manager6/qemu/CreateWizard.js |  5 -
 www/manager6/qemu/OSDefaults.js   |  2 +-
 www/manager6/qemu/OSTypeEdit.js   | 10 +-
 3 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/www/manager6/qemu/CreateWizard.js 
b/www/manager6/qemu/CreateWizard.js
index 954b8ef0..c508bb7f 100644
--- a/www/manager6/qemu/CreateWizard.js
+++ b/www/manager6/qemu/CreateWizard.js
@@ -1,7 +1,6 @@
 Ext.define('PVE.qemu.CreateWizard', {
 extend: 'PVE.window.Wizard',
 alias: 'widget.pveQemuCreateWizard',
-qemuScsiController: undefined,
 
 controller: {
 
@@ -167,10 +166,6 @@ Ext.define('PVE.qemu.CreateWizard', {
var nodename = kv.nodename;
delete kv.nodename;
 
-   if (me.qemuScsiController && !kv.scsihw) {
-   kv.scsihw = me.qemuScsiController;
-   }
-
PVE.Utils.API2Request({
url: '/nodes/' + nodename + '/qemu',
waitMsgTarget: me,
diff --git a/www/manager6/qemu/OSDefaults.js b/www/manager6/qemu/OSDefaults.js
index d47b9d01..d6f733a8 100644
--- a/www/manager6/qemu/OSDefaults.js
+++ b/www/manager6/qemu/OSDefaults.js
@@ -66,7 +66,7 @@ Ext.define('PVE.qemu.OSDefaults', {
pveOS: 'w2k',
parent : 'generic',
networkCard: 'rtl8139',
-   scsihw: 'lsi'
+   scsihw: ''
});
// https://pve.proxmox.com/wiki/Windows_XP_Guest_Notes
addOS({
diff --git a/www/manager6/qemu/OSTypeEdit.js b/www/manager6/qemu/OSTypeEdit.js
index 1235ddfd..27b0c40c 100644
--- a/www/manager6/qemu/OSTypeEdit.js
+++ b/www/manager6/qemu/OSTypeEdit.js
@@ -27,7 +27,7 @@ Ext.define('PVE.qemu.OSTypeInputPanel', {
 
me.setWidget('pveBusSelector', targetValues.busType);
me.setWidget('pveNetworkCardSelector', targetValues.networkCard);
-   me.setWizardHiddenValue('qemuScsiController', targetValues.scsihw);
+   me.setWidget('field[name=scsihw]', targetValues.scsihw);
},
setWidget: function(widget, newValue) {
// changing a widget is safe only if ComponentQuery.query returns us
@@ -38,14 +38,6 @@ Ext.define('PVE.qemu.OSTypeInputPanel', {
} else {
throw 'non unique widget :' + widget + ' in Wizard';
}
-   },
-   setWizardHiddenValue: function(property, newValue) {
-   var wizards = Ext.ComponentQuery.query('pveQemuCreateWizard ');
-   if (wizards.length === 1) {
-   wizards[0][property] = newValue;
-   } else {
-   throw 'non unique wizard, unable to set ' + property;
-   }
}
 },
 
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] [PATCH manager] fix #1516: fix mouse-scrolling of overflowhandlers in firefox

2017-10-05 Thread Emmanuel Kasper
On 10/04/2017 10:04 AM, Dominik Csapak wrote:
> this is a workaround for scrolling in toolbars, etc. in firefox with the
> mouse
> 
> while the result is not very "pretty", it maintains the old behaviour
> for all other browsers and makes it work in firefox
> 
> we can drop this when we update to a new extjs release

looks good to me and works as expected

___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH storage] ISCSIPlugin: Use long options for readability

2017-10-09 Thread Emmanuel Kasper
We otherwise use the long options everywhere in the plugin.
This will build the following command:

iscsiadm  --mode session --sid 1 --rescan
Rescanning session [sid: 1, target: xxx, portal: yyy]
---
 PVE/Storage/ISCSIPlugin.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/Storage/ISCSIPlugin.pm b/PVE/Storage/ISCSIPlugin.pm
index 326de9d..aef8675 100644
--- a/PVE/Storage/ISCSIPlugin.pm
+++ b/PVE/Storage/ISCSIPlugin.pm
@@ -136,7 +136,7 @@ sub iscsi_session_rescan {
 }
 
 foreach my $session (@$session_list) {
-   my $cmd = [$ISCSIADM, '--mode', 'session', '-r', $session, '-R'];
+   my $cmd = [$ISCSIADM, '--mode', 'session', '--sid', $session, 
'--rescan'];
eval { run_command($cmd, outfunc => sub {}); };
warn $@ if $@;
 }
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH docs v2] Add a paragraph to explain how network models match use cases

2017-10-09 Thread Emmanuel Kasper
Also :
 * explain more clearly when PVE switched to persistent device naming. (5.0)
 * use eno1 instead of eno0 everywhere when refering to the first onboard device
 * use IP addresses from the range IPv4 Address Blocks for Documentation
 (rfc5737) instead of private IPv4 addresses when giving examples of public IPs
---
changes since v1:
 * rebase
 pve-network.adoc | 103 ++-
 1 file changed, 64 insertions(+), 39 deletions(-)

diff --git a/pve-network.adoc b/pve-network.adoc
index d5b0a48..d221c32 100644
--- a/pve-network.adoc
+++ b/pve-network.adoc
@@ -5,44 +5,32 @@ ifdef::wiki[]
 :pve-toplevel:
 endif::wiki[]
 
-{pve} uses a bridged networking model. Each host can have up to 4094
-bridges. Bridges are like physical network switches implemented in
-software. All VMs can share a single bridge, as if
-virtual network cables from each guest were all plugged into the same
-switch. But you can also create multiple bridges to separate network
-domains.
-
-For connecting VMs to the outside world, bridges are attached to
-physical network cards. For further flexibility, you can configure
-VLANs (IEEE 802.1q) and network bonding, also known as "link
-aggregation". That way it is possible to build complex and flexible
-virtual networks.
+Network configuration can be done either via the GUI, or by manually 
+editing the file `/etc/network/interfaces`, which contains the
+whole network configuration. The  `interfaces(5)` manual page contains the
+complete format description. All {pve} tools try hard to keep direct
+ user modifications, but using the GUI is still preferable, because it
+protects you from errors.
 
-Debian traditionally uses the `ifup` and `ifdown` commands to
-configure the network. The file `/etc/network/interfaces` contains the
-whole network setup. Please refer to the manual page (`man interfaces`)
-for a complete format description.
+Once the network is configured, you can use the Debian traditional tools 
`ifup` 
+and `ifdown` commands to bring interfaces up and down.
 
 NOTE: {pve} does not write changes directly to
 `/etc/network/interfaces`. Instead, we write into a temporary file
 called `/etc/network/interfaces.new`, and commit those changes when
 you reboot the node.
 
-It is worth mentioning that you can directly edit the configuration
-file. All {pve} tools tries hard to keep such direct user
-modifications. Using the GUI is still preferable, because it
-protect you from errors.
-
-
 Naming Conventions
 ~~
 
 We currently use the following naming conventions for device names:
 
-* New Ethernet devices: en*, systemd network interface names.
+* Ethernet devices: en*, systemd network interface names. This naming scheme is
+ used for new {pve} installations since version 5.0.
 
-* Legacy Ethernet devices: eth[N], where 0 ≤ N (`eth0`, `eth1`, ...)
-They are available when Proxmox VE has been updated by an earlier version.
+* Ethernet devices: eth[N], where 0 ≤ N (`eth0`, `eth1`, ...) This naming
+scheme is used for {pve} hosts which were installed before the 5.0
+release. When upgrading to 5.0, the names are kept as-is.
 
 * Bridge names: vmbr[N], where 0 ≤ N ≤ 4094 (`vmbr0` - `vmbr4094`)
 
@@ -52,8 +40,7 @@ They are available when Proxmox VE has been updated by an 
earlier version.
   separated by a period (`eno1.50`, `bond1.30`)
 
 This makes it easier to debug networks problems, because the device
-names implies the device type.
-
+name implies the device type.
 
 Systemd Network Interface Names
 ^^^
@@ -78,10 +65,47 @@ The most common patterns are:
 
 For more information see 
https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/[Predictable
 Network Interface Names].
 
+Choosing a network configuration
+
+
+Depending on your current network organization and your resources you can 
+choose either a bridged, routed, or masquerading networking setup.
+
+{pve} server in a private LAN, using an external gateway to reach the internet
+^^
+
+The *Bridged* model makes the most sense in this case, and this is also 
+the default mode on new {pve} installations.
+Each of your Guest system will have a virtual interface attached to the 
+{pve} bridge. This is similar in effect to having the Guest network card 
+directly connected to a new switch on your LAN, the {pve} host playing the role
+of the switch.
+
+{pve} server at hosting provider, with public IP ranges for Guests
+^^
+
+For this setup, you can use either a *Bridged* or *Routed* model, depending on
+what your provider allows.
+
+{pve} server at hosting provider, with a single public IP address
+^
+
+In that case the only way to get outgoing network accesses for your guest
+systems is to 

[pve-devel] [PATCH qemu v2 1/5] Remove deprecated dh_clean -k

2017-10-11 Thread Emmanuel Kasper
---
 debian/rules | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/rules b/debian/rules
index 98637c7..28723df 100755
--- a/debian/rules
+++ b/debian/rules
@@ -80,7 +80,7 @@ endif
 install: build
dh_testdir
dh_testroot
-   dh_clean -k
+   dh_prep
dh_installdirs
 
# Add here commands to install the package into debian/pve-kvm.
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH qemu v2 3/5] Bump dephelper compatibility level to 10

2017-10-11 Thread Emmanuel Kasper
The debian package content was found to be the same
with diffoscope. No functional change.
---
 debian/compat  | 2 +-
 debian/control | 2 +-
 debian/rules   | 3 ++-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/debian/compat b/debian/compat
index 7ed6ff8..f599e28 100644
--- a/debian/compat
+++ b/debian/compat
@@ -1 +1 @@
-5
+10
diff --git a/debian/control b/debian/control
index 68ba534..4a55323 100644
--- a/debian/control
+++ b/debian/control
@@ -4,7 +4,7 @@ Priority: extra
 Maintainer: Proxmox Support Team 
 Build-Depends: autotools-dev,
check,
-   debhelper (>= 5),
+   debhelper (>= 10),
glusterfs-common (>= 3.5.2-1),
libacl1-dev,
libaio-dev,
diff --git a/debian/rules b/debian/rules
index a6deceb..1114f99 100755
--- a/debian/rules
+++ b/debian/rules
@@ -114,7 +114,8 @@ binary-indep: build install
 binary-arch: build install
dh_testdir
dh_testroot
-   dh_installchangelogs
+   # exclude historic Changelog file, which stops at release 0.14
+   dh_installchangelogs --exclude=Changelog
dh_installdocs
dh_installexamples
dh_install
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH qemu v2 4/5] Provides a qemu-system-x86 virtual package

2017-10-11 Thread Emmanuel Kasper
This allows adding additional debian packages on pve hosts
which depends on a qemu binary being installed.

The following install paths were tested:

 * install of proxmox-ve on debian systems with standard package
 set:  works as expected

 * install of proxmox-ve on debian having the debian qemu package
 installed: refused by the package manager as expected, until
 qemu, qemu-system-x86, libspice-server1 are deinstalled

 * manual install of qemu-system-x86 after proxmox-ve
 is installed: refused by the package manager as expected, until
 libspice-server1 is installed. If libspice-server1 is installed
 then proxmox-ve is deinstalled.

 * install of packages depending on qemu-system-x86
 having proxmox-ve installed: thoses packages are installed as
 expected, no conflict
---
 debian/control| 5 -
 debian/pve-qemu-kvm.links | 4 
 debian/rules  | 3 ---
 3 files changed, 8 insertions(+), 4 deletions(-)
 create mode 100644 debian/pve-qemu-kvm.links

diff --git a/debian/control b/debian/control
index 4a55323..f7b3aee 100644
--- a/debian/control
+++ b/debian/control
@@ -51,10 +51,13 @@ Conflicts: kvm,
pve-qemu-kvm-2.6.18,
qemu,
qemu-kvm,
+   qemu-system-x86,
qemu-utils,
-Provides: qemu-utils,
+Provides: qemu-system-x86,
+  qemu-utils,
 Replaces: pve-kvm,
   pve-qemu-kvm-2.6.18,
+  qemu-system-x86,
   qemu-utils,
 Description: Full virtualization on x86 hardware
  Using KVM, one can run multiple virtual PCs, each running unmodified Linux or
diff --git a/debian/pve-qemu-kvm.links b/debian/pve-qemu-kvm.links
new file mode 100644
index 000..7088a58
--- /dev/null
+++ b/debian/pve-qemu-kvm.links
@@ -0,0 +1,4 @@
+usr/bin/qemu-system-x86_64 usr/bin/kvm
+# qemu-system-i386 and qemu-system-x86_64 provides the same hardware emulation
+usr/bin/qemu-system-x86_64 usr/bin/qemu-system-i386
+usr/share/man/man1/qemu.1  usr/share/man/man1/kvm.1
diff --git a/debian/rules b/debian/rules
index 1114f99..9396228 100755
--- a/debian/rules
+++ b/debian/rules
@@ -86,9 +86,6 @@ install: build
# Add here commands to install the package into debian/pve-kvm.
$(MAKE) DESTDIR=$(destdir) install
 
-   mv $(destdir)/usr/bin/qemu-system-$(ARCH) $(destdir)/usr/bin/kvm
-   mv $(destdir)/usr/share/man/man1/qemu.1 
$(destdir)/usr/share/man/man1/kvm.1
-
# we do not need openbios files (sparc/ppc)
rm -rf $(destdir)/usr/share/kvm/openbios-*
# remove ppc files
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH qemu v2 5/5] Add a 'Conflicts' with qemu-system-common from Debian

2017-10-11 Thread Emmanuel Kasper
Both qemu-system-common and our pve-qemu-kvm package install the
file /usr/bin/virtfs-proxy-helper.

Since qemu-system-common does not have reverse dependencies in Debian for
packages besides  qemu-system-, and ovmf, which we don't want to
install anyway, we do not need a 'Provides' for it.
---
 debian/control | 1 +
 1 file changed, 1 insertion(+)

diff --git a/debian/control b/debian/control
index f7b3aee..22cdd47 100644
--- a/debian/control
+++ b/debian/control
@@ -51,6 +51,7 @@ Conflicts: kvm,
pve-qemu-kvm-2.6.18,
qemu,
qemu-kvm,
+   qemu-system-common,
qemu-system-x86,
qemu-utils,
 Provides: qemu-system-x86,
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH qemu v2 0/5] Provides a qemu-system-x86 virtual package

2017-10-11 Thread Emmanuel Kasper
This will allow the installation of extra packages requiring a qemu binary
Bigger use case is libguestfs0 and libguestfs-tools , this has been asked
in a few different forum threads
libguestfs-tools allow to inspect and edit disk images of offline guests
and do not require libvirt domains to be used.

Patches 1-3 is just for refactoring / modernizing the qemu packaging
Patch 4 has the real change
Patch 5 is an optional bug fix

We do not take special care for aarch64, as Thomas said this would
probably happen in a package with a different name, which could then
have its own  .links file

Changes since V1:
 * move symlinks to new file pve-qemu-kvm.links

Changes since RFC:
 * do not rename the qemu binary, but add a kvm symlink to it
  * do not rename the qemu man page, but add kvm symlint to it
  * add a symlink from qemu-system-i386 to qemu-system-x86_64 to better
  match the Debian package we 'Provides'.

Emmanuel Kasper (5):
  Remove deprecated dh_clean -k
  Install userspace utilities and UEFI roms via dh_install
  Bump dephelper compatibility level to 10
  Provides a qemu-system-x86 virtual package
  Add a 'Conflicts' with qemu-system-common from Debian

 debian/compat   |  2 +-
 debian/control  |  8 ++--
 debian/pve-qemu-kvm.install |  9 +
 debian/pve-qemu-kvm.links   |  4 
 debian/rules| 20 
 5 files changed, 24 insertions(+), 19 deletions(-)
 create mode 100644 debian/pve-qemu-kvm.install
 create mode 100644 debian/pve-qemu-kvm.links

-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH qemu v2 2/5] Install userspace utilities and UEFI roms via dh_install

2017-10-11 Thread Emmanuel Kasper
---
 debian/pve-qemu-kvm.install |  9 +
 debian/rules| 12 +---
 2 files changed, 10 insertions(+), 11 deletions(-)
 create mode 100644 debian/pve-qemu-kvm.install

diff --git a/debian/pve-qemu-kvm.install b/debian/pve-qemu-kvm.install
new file mode 100644
index 000..0d9a3cb
--- /dev/null
+++ b/debian/pve-qemu-kvm.install
@@ -0,0 +1,9 @@
+# install the userspace utilities
+vma usr/bin/
+debian/kvm-ifup etc/kvm/
+debian/kvm-ifdown etc/kvm/
+
+#install ovmf uefi rom
+debian/OVMF_CODE-pure-efi.fd usr/share/kvm/
+debian/OVMF_VARS-pure-efi.fd usr/share/kvm/
+
diff --git a/debian/rules b/debian/rules
index 28723df..a6deceb 100755
--- a/debian/rules
+++ b/debian/rules
@@ -89,16 +89,6 @@ install: build
mv $(destdir)/usr/bin/qemu-system-$(ARCH) $(destdir)/usr/bin/kvm
mv $(destdir)/usr/share/man/man1/qemu.1 
$(destdir)/usr/share/man/man1/kvm.1
 
-   # Install the userspace utilities
-   install -s -m 0755 vma $(destdir)/usr/bin/
-
-   install -D -m 0755 $(CURDIR)/debian/kvm-ifup $(destdir)/etc/kvm/kvm-ifup
-   install -D -m 0755 $(CURDIR)/debian/kvm-ifdown 
$(destdir)/etc/kvm/kvm-ifdown
-
-   #install ovmf uefi rom
-   install -D -m 0644 $(CURDIR)/debian/OVMF_CODE-pure-efi.fd 
$(destdir)/usr/share/kvm/OVMF_CODE-pure-efi.fd
-   install -D -m 0644 $(CURDIR)/debian/OVMF_VARS-pure-efi.fd 
$(destdir)/usr/share/kvm/OVMF_VARS-pure-efi.fd
-
# we do not need openbios files (sparc/ppc)
rm -rf $(destdir)/usr/share/kvm/openbios-*
# remove ppc files
@@ -127,7 +117,7 @@ binary-arch: build install
dh_installchangelogs
dh_installdocs
dh_installexamples
-#  dh_install
+   dh_install
 #  dh_installmenu
 #  dh_installdebconf
 #  dh_installlogrotate
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] [PATCH manager] fix updateStore destroy

2017-10-11 Thread Emmanuel Kasper
look goods to me

maybe we should have mentioned that this is needed for having the
'autoDestroy' store property working properly. Otherwise it is not clear
why we needed this in the pve context, as all updates store are unqueued
manually with

component.on('destroy', componentstore.stopUpdate);

and the like

On 10/11/2017 11:49 AM, Dominik Csapak wrote:
> the store never fires/gets a destroy event, thus it
> never stops the load_task and never unqueues itself in case
> the store gets destroyed but not explicitely stopped
> 
> with overriding the destroy method, this works now as intended
> 
> Signed-off-by: Dominik Csapak 
> ---
>  www/manager6/data/UpdateStore.js | 12 
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/www/manager6/data/UpdateStore.js 
> b/www/manager6/data/UpdateStore.js
> index 6be36303..a8bc9efe 100644
> --- a/www/manager6/data/UpdateStore.js
> +++ b/www/manager6/data/UpdateStore.js
> @@ -12,6 +12,13 @@ Ext.define('PVE.data.UpdateStore', {
>  
>  isStopped: true,
>  
> +destroy: function() {
> + var me = this;
> + me.load_task.cancel();
> + PVE.data.UpdateQueue.unqueue(me);
> + me.callParent();
> +},
> +
>  constructor: function(config) {
>   var me = this;
>  
> @@ -56,9 +63,6 @@ Ext.define('PVE.data.UpdateStore', {
>  
>   me.callParent([config]);
>  
> - me.on('destroy', function() {
> - load_task.cancel();
> - PVE.data.UpdateQueue.unqueue(me);
> - });
> + me.load_task = load_task;
>  }
>  });
> 

___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] Include dpkg-reconfigure in Makefile

2017-10-16 Thread Emmanuel Kasper
On 10/13/2017 08:13 AM, Thomas wrote:
> Hello!
> 
> How can I include /dpkg-reconfigure tzdata/ (Europe/Berlin) and
> /dpkg-reconfigure/ locales (de_DE.UTF-8) in the Makefile?
Hi Thomas

Not sure I understand your question because server specific setup is
usually not done with Make.

You should either set this it manually over ssh or with a configuration
management system like ansible / puppet.





___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] [PATCH qemu v2 0/5] Provides a qemu-system-x86 virtual package

2017-10-16 Thread Emmanuel Kasper
> In general, looks good to me.
> 
> Upstream package provides also the following man pages[1]:
> /usr/share/man/man1/qemu-system-i386.1.gz
> /usr/share/man/man1/qemu-system-x86_64.1.gz

> Which we do not (we have only qemu), would it make sense
> to make a link to these?

yes makes sense, we should install symlinks for this, and not a qemu man
pages since neither we nor debian provides a qemu man page

I will send a new version of 4/5 covering this


> Additionally to this, would it be possible to remove the postinst?
> AFAIS, the single use for it was to allow the transition from
> keeping the ifup/down scripts in /etc/kvm and not /etc/qemu and
> that happened in PVE 2.2 (2012), so it should be safe to remove it
> for 5.1 as no direct upgrade from 2.2 to 5.1 is possible/
> recommended/...
> But that isn't really urgent and can be done later.
> 
> [1] https://packages.debian.org/de/stretch/amd64/qemu-system-x86/filelist

this should be addresses in another patch serie IMHO


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH qemu v3 4/5] Provides a qemu-system-x86 virtual package

2017-10-16 Thread Emmanuel Kasper
This allows adding additional debian packages on pve hosts
which depends on a qemu binary being installed.

The following install paths were tested:

 * install of proxmox-ve on debian systems with standard package
 set:  works as expected

 * install of proxmox-ve on debian having the debian qemu package
 installed: refused by the package manager as expected, until
 qemu, qemu-system-x86, libspice-server1 are deinstalled

 * manual install of qemu-system-x86 after proxmox-ve
 is installed: refused by the package manager as expected, until
 libspice-server1 is installed. If libspice-server1 is installed
 then proxmox-ve is deinstalled.

 * install of packages depending on qemu-system-x86
 having proxmox-ve installed: thoses packages are installed as
 expected, no conflict
---
 debian/control|  5 -
 debian/pve-qemu-kvm.links | 11 +++
 debian/rules  |  3 ---
 3 files changed, 15 insertions(+), 4 deletions(-)
 create mode 100644 debian/pve-qemu-kvm.links

diff --git a/debian/control b/debian/control
index 4a55323..f7b3aee 100644
--- a/debian/control
+++ b/debian/control
@@ -51,10 +51,13 @@ Conflicts: kvm,
pve-qemu-kvm-2.6.18,
qemu,
qemu-kvm,
+   qemu-system-x86,
qemu-utils,
-Provides: qemu-utils,
+Provides: qemu-system-x86,
+  qemu-utils,
 Replaces: pve-kvm,
   pve-qemu-kvm-2.6.18,
+  qemu-system-x86,
   qemu-utils,
 Description: Full virtualization on x86 hardware
  Using KVM, one can run multiple virtual PCs, each running unmodified Linux or
diff --git a/debian/pve-qemu-kvm.links b/debian/pve-qemu-kvm.links
new file mode 100644
index 000..8749a89
--- /dev/null
+++ b/debian/pve-qemu-kvm.links
@@ -0,0 +1,11 @@
+usr/bin/qemu-system-x86_64 usr/bin/kvm
+
+# qemu-system-i386 and qemu-system-x86_64 provides the same hardware emulation
+usr/bin/qemu-system-x86_64 usr/bin/qemu-system-i386
+
+# upstream provides a qemu man page,
+# we symlink to kvm for backward compatibility
+# and to qemu-system-{i386,x86_64} to fullfill our 'Provides: qemu-system-x86'
+usr/share/man/man1/qemu.1  usr/share/man/man1/kvm.1
+usr/share/man/man1/qemu.1  usr/share/man/man1/qemu-system-i386.1
+usr/share/man/man1/qemu.1  usr/share/man/man1/qemu-system-x86_64.1
diff --git a/debian/rules b/debian/rules
index 1114f99..9396228 100755
--- a/debian/rules
+++ b/debian/rules
@@ -86,9 +86,6 @@ install: build
# Add here commands to install the package into debian/pve-kvm.
$(MAKE) DESTDIR=$(destdir) install
 
-   mv $(destdir)/usr/bin/qemu-system-$(ARCH) $(destdir)/usr/bin/kvm
-   mv $(destdir)/usr/share/man/man1/qemu.1 
$(destdir)/usr/share/man/man1/kvm.1
-
# we do not need openbios files (sparc/ppc)
rm -rf $(destdir)/usr/share/kvm/openbios-*
# remove ppc files
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] [PATCH manager 0/7] WebUI: make HA management easier

2017-10-16 Thread Emmanuel Kasper


On 10/16/2017 01:48 PM, Thomas Lamprecht wrote:
> On 10/16/2017 01:39 PM, Wolfgang Bumiller wrote:
>> On Wed, Oct 11, 2017 at 12:09:40PM +0200, Thomas Lamprecht wrote:
>>> First two patches make adding a new services over DC->HA->Add more
>>> confortable by switching out the simple VMID integer spinner with a
>>> combobox grid showing more details for each VM/CT, addressing #1517
>>> Third one is a small cleanup patch.
>>>
>>> And the rest addresses #1518.
>>> We add a 'More' Button to the VM and CT Config Panel (its base panel)
>>> and move all buttons which may result in config changes there.
>>> After that we have separated power/migrate actions from system
>>> affecting actions (clone, remove, convert to template, HA).
>>>
>>> Thomas Lamprecht (7):
>>>   ui: add VM ComboSelector
>>>   ui: ha: use vmComboSelector when adding new resource
>>>   ui: ha: make vote warning shorter
>>>   ui: add PVE.menu.Item
>>>   ui: qemu: combine system changing buttons
>>>   ui: qemu: add HA manage menu item to panel
>>>   ui: lxc: add 'more' button with HA manage menu item to panel
>>
>> Now we have:
>> LXC:  [Start] [Shutdown] [More] [Migrate] [Console] [Help]
>> VM:   [Start] [Shutdown] [Migrate] [More] [Console] [Help]
>>
> 
> The different ordering is clearly an error of mine, sorry, LXC
> was intended to have the same ordering:
> 
>> LXC:  [Start] [Shutdown|Reset] [Migrate] [More] [Console] [Help]
>> VM:   [Start] [Shutdown|Reset] [Migrate] [More] [Console] [Help]
> 
>> I'd rather have:
>> Both: [Start] [Shutdown] [Migrate] [Console] [More] [Help]
>> Because a button named 'more' should be at the end rather than somewhere
>> in the middle.
>>
> 
> I initially did not want to change the position of the Console and
> Help button as they are there for a long time (at least Console).
> 
> But your proposal is OK for me too, Dominik/Emanuel any opinion
> on this?

it makes more sense to have the 'More' button at the end of list for
consistency of the ui with what most other ui do
(the number one rule in web design if I remember is that people are
spending most of their time on other websites than yours :)

your concern about not changing the position of the Console is
legitimate, and my own muscle memory makes me bring the mouse on the
right end of the button list when I want to get a console button..

However if is the button is a bit more on the left, or a bit more on the
right does not matter as the button is very close to its former position.


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] [PATCH manager 7/7] ui: lxc: add 'more' button with HA manage menu item to panel

2017-10-16 Thread Emmanuel Kasper
On 10/11/2017 12:09 PM, Thomas Lamprecht wrote:
> Move the remove button into the more button and add a 'Manage HA'
> button there, mirroring the changes from the qemu panel.
> 
> Allows to add an unmanaged CT to HA or to edit the HA settings of a
> managed one.
> 
> Fixes: #1518
> Signed-off-by: Thomas Lamprecht 
> ---
>  www/manager6/lxc/Config.js | 42 ++
>  1 file changed, 30 insertions(+), 12 deletions(-)
> 
> diff --git a/www/manager6/lxc/Config.js b/www/manager6/lxc/Config.js
> index d5a6ff7c..4dde5805 100644
> --- a/www/manager6/lxc/Config.js
> +++ b/www/manager6/lxc/Config.js
> @@ -98,16 +98,34 @@ Ext.define('PVE.lxc.Config', {
>   iconCls: 'fa fa-send-o'
>   });
>  
> - var removeBtn = Ext.create('PVE.button.Button', {
> - text: gettext('Remove'),
> - disabled: !caps.vms['VM.Allocate'],
> - handler: function() {
> - Ext.create('PVE.window.SafeDestroy', {
> - url: base_url,
> - item: { type: 'CT', id: vmid }
> - }).show();
> - },
> - iconCls: 'fa fa-trash-o'
> + var moreBtn = Ext.create('PVE.button.Button', {
> + text: gettext('More'),
> + menu: { items: [
> + {
> + iconCls: 'fa fa-heartbeat ',
> + hidden: !caps.nodes['Sys.Console'],
> + text: gettext('Manage HA'),
> + handler: function() {
> + var ha = me.pveSelNode.data.hastate;
> + Ext.create('PVE.ha.VMResourceEdit', {
> + vmid: vmid,
> + isCreate: (!ha || ha === 'unmanaged')
> + }).show();
> + }
> + },

I think that in 6/7 and 7/7 we're missing a guestType parameter to pass.

This has the effect that all new created HA resources have the label
'VM' next to their pveGuestIDSelector, including containers.


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] [PATCH manager 1/2] ui: pveWindowEdit: allow sane onlineHelp specification for edit windows

2017-10-17 Thread Emmanuel Kasper
On 10/17/2017 02:29 PM, Thomas Lamprecht wrote:
> instead of heuristically choosing the onlineHelp entry from our first
> item prefer the one we have in our config, if noone the fallback to
> the old heuristic.
> 
> Signed-off-by: Thomas Lamprecht 
> ---
>  www/manager6/window/Edit.js | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/www/manager6/window/Edit.js b/www/manager6/window/Edit.js
> index 9a026683..356946ed 100644
> --- a/www/manager6/window/Edit.js
> +++ b/www/manager6/window/Edit.js
> @@ -272,10 +272,11 @@ Ext.define('PVE.window.Edit', {
>   me.buttons = [ submitBtn, resetBtn ];
>   }
>  
> - if (items[0].onlineHelp) {
> + var onlineHelp = me.onlineHelp || items[0].onlineHelp;

if you had  'onlineHelp' as a new PVE.window.Edit property, then we
should document it in the Window Edit body with a default value,
similar to other PVE enhancements we have there

// set to true if you want an Remove button (instead of Create)
isRemove: false

otherwise users of the Class can only see which it's possible to set an
onlineHelpe by looking at initComponent, which is long here



___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


<    1   2   3   4   5   6   7   8   9   10   >