public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Michael Köppl" <m.koeppl@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Daniel Kral <d.kral@proxmox.com>
Subject: Re: [pve-devel] [RFC ha-manager v3 15/15] manager: persistently migrate ha groups to ha rules
Date: Tue, 22 Jul 2025 18:38:11 +0200	[thread overview]
Message-ID: <bfcad994-aa6e-4d3f-82ea-c902689ab3a5@proxmox.com> (raw)
In-Reply-To: <20250704181659.465441-17-d.kral@proxmox.com>

Left 2 comments inline.

On 7/4/25 20:16, Daniel Kral wrote:
> 
> diff --git a/src/PVE/HA/Config.pm b/src/PVE/HA/Config.pm
> index 424a6e1..59bafd7 100644
> --- a/src/PVE/HA/Config.pm
> +++ b/src/PVE/HA/Config.pm
> @@ -234,6 +234,11 @@ sub read_group_config {
>      return cfs_read_file($ha_groups_config);
>  }
>  
> +sub delete_group_config {
> +
> +    unlink $ha_groups_config or die "failed to remove group config: $!\n";

This results in the following error:
	Abort HA group migration: failed to remove group config: No such file
or directory

The value in $ha_groups_config is only part of the path to the
groups.cfg file. It works for the remaining functions here because the
cfs_write_file() and cfs_read_file() functions append prepend "/etc/pve/".

Could be fixed by:
    my $group_config_file = "/etc/pve/" . $ha_groups_config;

    unlink $group_config_file or die "failed to remove group config: $!\n";

or something similar.

> +}
> +
>  sub write_group_config {
>      my ($cfg) = @_;
>  
> diff --git a/src/PVE/HA/Env.pm b/src/PVE/HA/Env.pm
> index 5cee7b3..1325676 100644
> --- a/src/PVE/HA/Env.pm
> +++ b/src/PVE/HA/Env.pm
> @@ -100,6 +100,12 @@ sub update_service_config {
>      return $self->{plug}->update_service_config($sid, $param);
>  }
>  
> +sub write_service_config {
> +    my ($self, $conf) = @_;
> +
> +    $self->{plug}->write_service_config($conf);
> +}
> +
>  sub parse_sid {
>      my ($self, $sid) = @_;
>  
> @@ -137,12 +143,24 @@ sub read_rules_config {
>      return $self->{plug}->read_rules_config();
>  }
>  
> +sub write_rules_config {
> +    my ($self, $rules) = @_;
> +
> +    $self->{plug}->write_rules_config($rules);
> +}
> +
>  sub read_group_config {
>      my ($self) = @_;
>  
>      return $self->{plug}->read_group_config();
>  }
>  
> +sub delete_group_config {
> +    my ($self) = @_;
> +
> +    $self->{plug}->delete_group_config();
> +}
> +
>  # this should return a hash containing info
>  # what nodes are members and online.
>  sub get_node_info {
> @@ -288,4 +306,10 @@ sub get_static_node_stats {
>      return $self->{plug}->get_static_node_stats();
>  }
>  
> +sub get_node_version {
> +    my ($self, $node) = @_;
> +
> +    return $self->{plug}->get_node_version($node);
> +}
> +
>  1;
> diff --git a/src/PVE/HA/Env/PVE2.pm b/src/PVE/HA/Env/PVE2.pm
> index 58fd36e..aecffc0 100644
> --- a/src/PVE/HA/Env/PVE2.pm
> +++ b/src/PVE/HA/Env/PVE2.pm
> @@ -141,6 +141,12 @@ sub update_service_config {
>      return PVE::HA::Config::update_resources_config($sid, $param);
>  }
>  
> +sub write_service_config {
> +    my ($self, $conf) = @_;
> +
> +    return PVE::HA::Config::write_resources_config($conf);
> +}
> +
>  sub parse_sid {
>      my ($self, $sid) = @_;
>  
> @@ -201,12 +207,24 @@ sub read_rules_config {
>      return PVE::HA::Config::read_and_check_rules_config();
>  }
>  
> +sub write_rules_config {
> +    my ($self, $rules) = @_;
> +
> +    PVE::HA::Config::write_rules_config($rules);
> +}
> +
>  sub read_group_config {
>      my ($self) = @_;
>  
>      return PVE::HA::Config::read_group_config();
>  }
>  
> +sub delete_group_config {
> +    my ($self) = @_;
> +
> +    PVE::HA::Config::delete_group_config();
> +}
> +
>  # this should return a hash containing info
>  # what nodes are members and online.
>  sub get_node_info {
> @@ -489,4 +507,14 @@ sub get_static_node_stats {
>      return $stats;
>  }
>  
> +sub get_node_version {
> +    my ($self, $node) = @_;
> +
> +    my $version_info = PVE::Cluster::get_node_kv('version-info', $node);
> +
> +    return undef if !$version_info->{$node};
> +
> +    return $version_info->{$node}->{version};

This throws an error, stopping the migration since it depends on all
nodes having the correct version, because the value in
$version_info->{$node} is a string. Could be fixed by:

    my $node_version_info = eval { decode_json($version_info->{$node}) };
    return $node_version_info->{version};

> +}
> +
>  1;
> diff --git a/src/PVE/HA/Manager.pm b/src/PVE/HA/Manager.pm
> index 4357253..b2fd896 100644
> --- a/src/PVE/HA/Manager.pm
> +++ b/src/PVE/HA/Manager.pm
> @@ -464,6 +464,97 @@ sub update_crm_commands {
>  
>  }
>


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


  reply	other threads:[~2025-07-22 16:37 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-04 18:16 [pve-devel] [PATCH cluster/docs/ha-manager/manager v3 00/20] HA Rules Daniel Kral
2025-07-04 18:16 ` [pve-devel] [PATCH cluster v3 1/1] cfs: add 'ha/rules.cfg' to observed files Daniel Kral
2025-07-16 14:02   ` [pve-devel] applied: " Thomas Lamprecht
2025-07-04 18:16 ` [pve-devel] [PATCH ha-manager v3 01/15] tree-wide: make arguments for select_service_node explicit Daniel Kral
2025-07-04 18:16 ` [pve-devel] [PATCH ha-manager v3 02/15] manager: improve signature of select_service_node Daniel Kral
2025-07-04 18:16 ` [pve-devel] [PATCH ha-manager v3 03/15] introduce rules base plugin Daniel Kral
2025-07-04 18:16 ` [pve-devel] [PATCH ha-manager v3 04/15] rules: introduce node affinity rule plugin Daniel Kral
2025-07-04 18:16 ` [pve-devel] [PATCH ha-manager v3 05/15] config, env, hw: add rules read and parse methods Daniel Kral
2025-07-04 18:16 ` [pve-devel] [PATCH ha-manager v3 06/15] config: delete services from rules if services are deleted from config Daniel Kral
2025-07-04 18:16 ` [pve-devel] [PATCH ha-manager v3 07/15] manager: read and update rules config Daniel Kral
2025-07-04 18:16 ` [pve-devel] [PATCH ha-manager v3 08/15] test: ha tester: add test cases for future node affinity rules Daniel Kral
2025-07-04 18:16 ` [pve-devel] [PATCH ha-manager v3 09/15] resources: introduce failback property in ha resource config Daniel Kral
2025-07-04 18:16 ` [pve-devel] [PATCH ha-manager v3 10/15] manager: migrate ha groups to node affinity rules in-memory Daniel Kral
2025-07-22 16:38   ` Michael Köppl
2025-07-04 18:16 ` [pve-devel] [PATCH ha-manager v3 11/15] manager: apply node affinity rules when selecting service nodes Daniel Kral
2025-07-04 18:16 ` [pve-devel] [PATCH ha-manager v3 12/15] test: add test cases for rules config Daniel Kral
2025-07-04 18:16 ` [pve-devel] [PATCH ha-manager v3 13/15] api: introduce ha rules api endpoints Daniel Kral
2025-07-04 18:16 ` [pve-devel] [PATCH ha-manager v3 14/15] cli: expose ha rules api endpoints to ha-manager cli Daniel Kral
2025-07-04 18:16 ` [pve-devel] [RFC ha-manager v3 15/15] manager: persistently migrate ha groups to ha rules Daniel Kral
2025-07-22 16:38   ` Michael Köppl [this message]
2025-07-22 16:56     ` Michael Köppl
2025-07-04 18:16 ` [pve-devel] [PATCH docs v3 1/1] ha: add documentation about ha rules and ha node affinity rules Daniel Kral
2025-07-04 18:16 ` [pve-devel] [PATCH manager v3 1/3] api: ha: add ha rules api endpoints Daniel Kral
2025-07-04 18:16 ` [pve-devel] [PATCH manager v3 2/3] ui: ha: remove ha groups from ha resource components Daniel Kral
2025-07-04 18:16 ` [pve-devel] [PATCH manager v3 3/3] ui: ha: show failback flag in resources status view Daniel Kral
2025-07-22 16:38 ` [pve-devel] [PATCH cluster/docs/ha-manager/manager v3 00/20] HA Rules Michael Köppl
2025-07-23 15:36   ` Michael Köppl
2025-07-30 10:13 ` [pve-devel] superseded: " Daniel Kral

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bfcad994-aa6e-4d3f-82ea-c902689ab3a5@proxmox.com \
    --to=m.koeppl@proxmox.com \
    --cc=d.kral@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal