* [pve-devel] [PATCH manager v3 0/2] fix #474: allow transfer from container/vms
@ 2023-08-09 14:49 Philipp Hufnagl
2023-08-09 14:49 ` [pve-devel] [PATCH manager v3 1/2] fix #474: backend: " Philipp Hufnagl
2023-08-09 14:49 ` [pve-devel] [PATCH manager v3 2/2] fix #474: frontend: " Philipp Hufnagl
0 siblings, 2 replies; 3+ messages in thread
From: Philipp Hufnagl @ 2023-08-09 14:49 UTC (permalink / raw)
To: pve-devel
changes to v3:
fix subject typo
at version log
changes to v2:
split patch in front and backend
When a member of 2 pools wants to transfer a
vm/container to an other pool they can not do that. The vm/container would
have first to be removed form the current pool resulting in a loss of
privileges of the pool member for this vm/contianer. This feature introduces
a way to transfer a vm between pools, guarded by a checkbox from accidental
transfers
Philipp Hufnagl (2):
fix #474: backend allow transfer from container/vms
fix #474: backend allow transfer from container/vms
PVE/API2/Pool.pm | 15 +++++++++++++--
www/manager6/grid/PoolMembers.js | 17 ++++++++++++++---
2 files changed, 27 insertions(+), 5 deletions(-)
--
2.39.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pve-devel] [PATCH manager v3 1/2] fix #474: backend: allow transfer from container/vms
2023-08-09 14:49 [pve-devel] [PATCH manager v3 0/2] fix #474: allow transfer from container/vms Philipp Hufnagl
@ 2023-08-09 14:49 ` Philipp Hufnagl
2023-08-09 14:49 ` [pve-devel] [PATCH manager v3 2/2] fix #474: frontend: " Philipp Hufnagl
1 sibling, 0 replies; 3+ messages in thread
From: Philipp Hufnagl @ 2023-08-09 14:49 UTC (permalink / raw)
To: pve-devel
When a member of 2 pools wants to transfer a
vm/container to an other pool they can not do that. The vm/container would
have first to be removed form the current pool resulting in a loss of
privileges of the pool member for this vm/contianer. This feature introduces
a way to transfer a vm between pools, guarded by a checkbox from accidental
transfers
This is the patch for the backend changes
Signed-off-by: Philipp Hufnagl <p.hufnagl@proxmox.com>
---
PVE/API2/Pool.pm | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/PVE/API2/Pool.pm b/PVE/API2/Pool.pm
index 007fc815..80e4e7b0 100644
--- a/PVE/API2/Pool.pm
+++ b/PVE/API2/Pool.pm
@@ -131,6 +131,11 @@ __PACKAGE__->register_method ({
type => 'string', format => 'pve-storage-id-list',
optional => 1,
},
+ transfer => {
+ description => "Allow transferring VMs to another pool.",
+ type => 'boolean',
+ optional => 1,
+ },
delete => {
description => "Remove vms/storage (instead of adding it).",
type => 'boolean',
@@ -165,8 +170,14 @@ __PACKAGE__->register_method ({
} else {
die "VM $vmid is already a pool member\n" if $pool_config->{vms}->{$vmid};
my $existing_pool = $usercfg->{vms}->{$vmid};
- die "VM $vmid belongs already to pool '$existing_pool'\n" if defined($existing_pool);
-
+ if (defined($existing_pool)) {
+ if ($param->{transfer}) {
+ my $existing_pool_config = $usercfg->{pools}->{$existing_pool};
+ delete $existing_pool_config->{vms}->{$vmid};
+ } else {
+ die "VM $vmid belongs already to pool '$existing_pool' and transfer is not set\n";
+ }
+ }
$pool_config->{vms}->{$vmid} = 1;
$usercfg->{vms}->{$vmid} = $pool;
}
--
2.39.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pve-devel] [PATCH manager v3 2/2] fix #474: frontend: allow transfer from container/vms
2023-08-09 14:49 [pve-devel] [PATCH manager v3 0/2] fix #474: allow transfer from container/vms Philipp Hufnagl
2023-08-09 14:49 ` [pve-devel] [PATCH manager v3 1/2] fix #474: backend: " Philipp Hufnagl
@ 2023-08-09 14:49 ` Philipp Hufnagl
1 sibling, 0 replies; 3+ messages in thread
From: Philipp Hufnagl @ 2023-08-09 14:49 UTC (permalink / raw)
To: pve-devel
When a member of 2 pools wants to transfer a
vm/container to an other pool they can not do that. The vm/container would
have first to be removed form the current pool resulting in a loss of
privileges of the pool member for this vm/contianer. This feature introduces
a way to transfer a vm between pools, guarded by a checkbox from accidental
transfers
This is the patch for the frontend changes
Signed-off-by: Philipp Hufnagl <p.hufnagl@proxmox.com>
---
www/manager6/grid/PoolMembers.js | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/www/manager6/grid/PoolMembers.js b/www/manager6/grid/PoolMembers.js
index 6acb622d..224daca3 100644
--- a/www/manager6/grid/PoolMembers.js
+++ b/www/manager6/grid/PoolMembers.js
@@ -1,7 +1,7 @@
Ext.define('PVE.pool.AddVM', {
extend: 'Proxmox.window.Edit',
width: 600,
- height: 400,
+ height: 420,
isAdd: true,
isCreate: true,
initComponent: function() {
@@ -30,7 +30,7 @@ Ext.define('PVE.pool.AddVM', {
],
filters: [
function(item) {
- return (item.data.type === 'lxc' || item.data.type === 'qemu') && item.data.pool === '';
+ return (item.data.type === 'lxc' || item.data.type === 'qemu') &&item.data.pool !== me.pool;
},
],
});
@@ -63,6 +63,10 @@ Ext.define('PVE.pool.AddVM', {
header: gettext('Node'),
dataIndex: 'node',
},
+ {
+ header: gettext('Pool'),
+ dataIndex: 'pool',
+ },
{
header: gettext('Status'),
dataIndex: 'uptime',
@@ -85,9 +89,16 @@ Ext.define('PVE.pool.AddVM', {
},
],
});
+
+ let transfer = Ext.create('Ext.form.field.Checkbox', {
+ name: 'transfer',
+ boxLabel: gettext('Allow Transfer'),
+ inputValue: 1,
+ value: 0,
+ });
Ext.apply(me, {
subject: gettext('Virtual Machine'),
- items: [vmsField, vmGrid],
+ items: [vmsField, vmGrid, transfer],
});
me.callParent();
--
2.39.2
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-09 14:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-09 14:49 [pve-devel] [PATCH manager v3 0/2] fix #474: allow transfer from container/vms Philipp Hufnagl
2023-08-09 14:49 ` [pve-devel] [PATCH manager v3 1/2] fix #474: backend: " Philipp Hufnagl
2023-08-09 14:49 ` [pve-devel] [PATCH manager v3 2/2] fix #474: frontend: " Philipp Hufnagl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox