From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
	by lore.proxmox.com (Postfix) with ESMTPS id F0D981FF195
	for <inbox@lore.proxmox.com>; Fri,  7 Mar 2025 15:33:10 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 6E8BA1D96C;
	Fri,  7 Mar 2025 15:33:04 +0100 (CET)
Message-ID: <ec4d20a6-c566-4b4f-b0d6-ba28aeddbc37@proxmox.com>
Date: Fri, 7 Mar 2025 15:33:00 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
 Dominik Csapak <d.csapak@proxmox.com>
References: <20250213131716.3062383-1-d.csapak@proxmox.com>
 <20250213131716.3062383-19-d.csapak@proxmox.com>
Content-Language: en-US
From: Fiona Ebner <f.ebner@proxmox.com>
In-Reply-To: <20250213131716.3062383-19-d.csapak@proxmox.com>
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.043 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: Re: [pve-devel] [PATCH manager v6 5/5] fix #5175: ui: allow
 configuring and live migration of mapped pci resources
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

Am 13.02.25 um 14:17 schrieb Dominik Csapak:
> if the hardware/driver is capable, the admin can now mark a pci device
> as 'live-migration-capable', which then tries enabling live migration
> for such devices.
> 
> mark it as experimental when configuring and in the migrate window
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>

Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>

> ---
> no changes in v6
>  www/manager6/window/Migrate.js    | 25 ++++++++++++++++++++-----
>  www/manager6/window/PCIMapEdit.js | 12 ++++++++++++
>  2 files changed, 32 insertions(+), 5 deletions(-)
> 
> diff --git a/www/manager6/window/Migrate.js b/www/manager6/window/Migrate.js
> index 604b63e7..46fc0cf3 100644
> --- a/www/manager6/window/Migrate.js
> +++ b/www/manager6/window/Migrate.js
> @@ -244,10 +244,10 @@ Ext.define('PVE.window.Migrate', {
>  	    }
>  
>  	    let blockingResources = [];
> -	    let mappedResources = migrateStats['mapped-resources'] ?? [];
> +	    let mappedResources = migrateStats['mapped-resource-info'] ?? {};
>  
>  	    for (const res of migrateStats.local_resources) {
> -		if (mappedResources.indexOf(res) === -1) {
> +		if (!mappedResources[res]) {
>  		    blockingResources.push(res);
>  		}
>  	    }
> @@ -271,14 +271,29 @@ Ext.define('PVE.window.Migrate', {
>  		}
>  	    }
>  
> -	    if (mappedResources && mappedResources.length) {
> -		if (vm.get('running')) {
> +	    if (mappedResources && vm.get('running')) {

Correct me if I'm wrong, but doesn't mappedResources always evaluate to
true because it's {} (and same was true for [])? To get the same as
before, don't you need to check the number of keys now? But I suppose
the code handles the case where it's empty just fine, so we could also
skip that check.

> +		let allowed = [];
> +		let notAllowed = [];
> +		for (const [key, resource] of Object.entries(mappedResources)) {
> +		    if (resource['live-migration']) {
> +			allowed.push(key);
> +		    } else {
> +			notAllowed.push(key);
> +		    }
> +		}
> +		if (notAllowed.length > 0) {
>  		    migration.possible = false;
>  		    migration.preconditions.push({
>  			text: Ext.String.format('Can\'t migrate running VM with mapped resources: {0}',
> -			mappedResources.join(', ')),
> +			notAllowed.join(', ')),
>  			severity: 'error',
>  		    });
> +		} else if (allowed.length > 0) {
> +		    migration.preconditions.push({
> +			text: Ext.String.format('Live-migrating running VM with mapped resources (Experimental): {0}',
> +			allowed.join(', ')),
> +			severity: 'warning',
> +		    });
>  		}
>  	    }
>  
> diff --git a/www/manager6/window/PCIMapEdit.js b/www/manager6/window/PCIMapEdit.js
> index faf58255..9f2ea651 100644
> --- a/www/manager6/window/PCIMapEdit.js
> +++ b/www/manager6/window/PCIMapEdit.js
> @@ -244,6 +244,18 @@ Ext.define('PVE.window.PCIMapEditWindow', {
>  			disabled: '{hideComment}',
>  		    },
>  		},
> +		{
> +		    xtype: 'proxmoxcheckbox',
> +		    fieldLabel: gettext('Live Migration Capable'),
> +		    labelWidth: 200,
> +		    boxLabel: `<i class="fa fa-exclamation-triangle warning"></i> ${gettext('Experimental')}`,
> +		    reference: 'live-migration-capable',
> +		    name: 'live-migration-capable',
> +		    cbind: {
> +			deleteEmpty: '{!isCreate}',
> +			disabled: '{hideComment}',

Pre-existing above, but might be better to rename the 'hideComment' if
we reuse it for different things.

> +		    },
> +		},
>  	    ],
>  
>  	    columnB: [



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