public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH cluster 0/2] fix #5461: qdevice cluster mgmt
@ 2024-05-15 10:32 Aaron Lauterer
  2024-05-15 10:32 ` [pve-devel] [PATCH cluster 1/2] fix #5461: pvecm: ssh: adapt intra cluster ssh options Aaron Lauterer
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Aaron Lauterer @ 2024-05-15 10:32 UTC (permalink / raw)
  To: pve-devel

on clusters where the ssh known hosts info is only stored in the pmxcfs,
it broke the mgmt of the qdevice. By adding the necessary ssh options on
each intra cluster ssh call, we can fix this.

The second patch is optional and adjusts the touched code to fit better
into the max line lenghts.
I put it into a separate patch as I wasn't 100% sure how to format it,
  especially the first instance in that patch.


Aaron Lauterer (2):
  fix #5461: pvecm: ssh: adapt intra cluster ssh options
  pvecm: qdevice: adjust line lengths

 src/PVE/CLI/pvecm.pm | 36 ++++++++++++++++++++++++------------
 1 file changed, 24 insertions(+), 12 deletions(-)

-- 
2.39.2



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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [pve-devel] [PATCH cluster 1/2] fix #5461: pvecm: ssh: adapt intra cluster ssh options
  2024-05-15 10:32 [pve-devel] [PATCH cluster 0/2] fix #5461: qdevice cluster mgmt Aaron Lauterer
@ 2024-05-15 10:32 ` Aaron Lauterer
  2024-05-16 10:17   ` Fabian Grünbichler
  2024-05-15 10:32 ` [pve-devel] [PATCH cluster 2/2] pvecm: qdevice: adjust line lengths Aaron Lauterer
  2024-05-21  7:12 ` [pve-devel] [PATCH cluster 0/2] fix #5461: qdevice cluster mgmt Aaron Lauterer
  2 siblings, 1 reply; 7+ messages in thread
From: Aaron Lauterer @ 2024-05-15 10:32 UTC (permalink / raw)
  To: pve-devel

because otherwise the SSH calls to other nodes in the cluster will fail
on newer clusters that only have the ssh known host keys located in the
pmxcfs.

By utilizing SSHInfo::ssh_info_to_ssh_opts we can add the needed options
to the SSH call to have the node name aliased correctly and pointing SSH
to the correct known hosts file.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
---
 src/PVE/CLI/pvecm.pm | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/PVE/CLI/pvecm.pm b/src/PVE/CLI/pvecm.pm
index 0e8ca8f..5c285a9 100755
--- a/src/PVE/CLI/pvecm.pm
+++ b/src/PVE/CLI/pvecm.pm
@@ -18,6 +18,7 @@ use PVE::PTY;
 use PVE::API2::ClusterConfig;
 use PVE::Corosync;
 use PVE::Cluster::Setup;
+use PVE::SSHInfo;
 
 use base qw(PVE::CLIHandler);
 
@@ -173,9 +174,10 @@ __PACKAGE__->register_method ({
 	run_command([@$scp_cmd, "root\@\[$qnetd_addr\]:$ca_export_file", "/etc/pve/$ca_export_base"]);
 	$foreach_member->(sub {
 	    my ($node, $ip) = @_;
+	    my $ssh_options = PVE::SSHInfo::ssh_info_to_ssh_opts ({ ip => $ip, name => $node });
 	    my $outsub = sub { print "\nnode '$node': " . shift };
 	    run_command(
-		[@$ssh_cmd, $ip, $qdevice_certutil, "-i", "-c", "/etc/pve/$ca_export_base"],
+		[@$ssh_cmd, @$ssh_options, $ip, $qdevice_certutil, "-i", "-c", "/etc/pve/$ca_export_base"],
 		noerr => 1, outfunc => \&$outsub
 	    );
 	});
@@ -206,9 +208,10 @@ __PACKAGE__->register_method ({
 	run_command([@$scp_cmd, "$db_dir_node/$p12_file_base", "/etc/pve/"]);
 	$foreach_member->(sub {
 	    my ($node, $ip) = @_;
+	    my $ssh_options = PVE::SSHInfo::ssh_info_to_ssh_opts ({ ip => $ip, name => $node });
 	    my $outsub = sub { print "\nnode '$node': " . shift };
 	    run_command([
-		    @$ssh_cmd, $ip, "$qdevice_certutil", "-m", "-c",
+		    @$ssh_cmd, @$ssh_options, $ip, "$qdevice_certutil", "-m", "-c",
 		    "/etc/pve/$p12_file_base"], outfunc => \&$outsub
 		);
 	});
@@ -243,10 +246,11 @@ __PACKAGE__->register_method ({
 
 	$foreach_member->(sub {
 	    my ($node, $ip) = @_;
+	    my $ssh_options = PVE::SSHInfo::ssh_info_to_ssh_opts ({ ip => $ip, name => $node });
 	    my $outsub = sub { print "\nnode '$node': " . shift };
 	    print "\nINFO: start and enable corosync qdevice daemon on node '$node'...\n";
-	    run_command([@$ssh_cmd, $ip, 'systemctl', 'start', 'corosync-qdevice'], outfunc => \&$outsub);
-	    run_command([@$ssh_cmd, $ip, 'systemctl', 'enable', 'corosync-qdevice'], outfunc => \&$outsub);
+	    run_command([@$ssh_cmd, @$ssh_options, $ip, 'systemctl', 'start', 'corosync-qdevice'], outfunc => \&$outsub);
+	    run_command([@$ssh_cmd, @$ssh_options, $ip, 'systemctl', 'enable', 'corosync-qdevice'], outfunc => \&$outsub);
 	});
 
 	run_command(['corosync-cfgtool', '-R']); # do cluster wide config reload
@@ -291,8 +295,9 @@ __PACKAGE__->register_method ({
 	    # cleanup qdev state (cert storage)
 	    my $qdev_state_dir =  "/etc/corosync/qdevice";
 	    $foreach_member->(sub {
-		my (undef, $ip) = @_;
-		run_command([@$ssh_cmd, $ip, '--', 'rm', '-rf', $qdev_state_dir]);
+		my ($node, $ip) = @_;
+		my $ssh_options = PVE::SSHInfo::ssh_info_to_ssh_opts ({ ip => $ip, name => $node });
+		run_command([@$ssh_cmd, @$ssh_options, $ip, '--', 'rm', '-rf', $qdev_state_dir]);
 	    });
 	};
 
@@ -300,9 +305,10 @@ __PACKAGE__->register_method ({
 	die $@ if $@;
 
 	$foreach_member->(sub {
-	    my (undef, $ip) = @_;
-	    run_command([@$ssh_cmd, $ip, 'systemctl', 'stop', 'corosync-qdevice']);
-	    run_command([@$ssh_cmd, $ip, 'systemctl', 'disable', 'corosync-qdevice']);
+	    my ($node, $ip) = @_;
+	    my $ssh_options = PVE::SSHInfo::ssh_info_to_ssh_opts ({ ip => $ip, name => $node });
+	    run_command([@$ssh_cmd, @$ssh_options, $ip, 'systemctl', 'stop', 'corosync-qdevice']);
+	    run_command([@$ssh_cmd, @$ssh_options, $ip, 'systemctl', 'disable', 'corosync-qdevice']);
 	});
 
 	run_command(['corosync-cfgtool', '-R']);
-- 
2.39.2



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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [pve-devel] [PATCH cluster 2/2] pvecm: qdevice: adjust line lengths
  2024-05-15 10:32 [pve-devel] [PATCH cluster 0/2] fix #5461: qdevice cluster mgmt Aaron Lauterer
  2024-05-15 10:32 ` [pve-devel] [PATCH cluster 1/2] fix #5461: pvecm: ssh: adapt intra cluster ssh options Aaron Lauterer
@ 2024-05-15 10:32 ` Aaron Lauterer
  2024-05-16  9:45   ` Fabian Grünbichler
  2024-05-21  7:12 ` [pve-devel] [PATCH cluster 0/2] fix #5461: qdevice cluster mgmt Aaron Lauterer
  2 siblings, 1 reply; 7+ messages in thread
From: Aaron Lauterer @ 2024-05-15 10:32 UTC (permalink / raw)
  To: pve-devel

The first instance had the line break mid array. It now is a bit over
the limit, but follows the style guide closely: putting each argument to
the function in a newline.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
---
 src/PVE/CLI/pvecm.pm | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/PVE/CLI/pvecm.pm b/src/PVE/CLI/pvecm.pm
index 5c285a9..53e9cac 100755
--- a/src/PVE/CLI/pvecm.pm
+++ b/src/PVE/CLI/pvecm.pm
@@ -210,10 +210,10 @@ __PACKAGE__->register_method ({
 	    my ($node, $ip) = @_;
 	    my $ssh_options = PVE::SSHInfo::ssh_info_to_ssh_opts ({ ip => $ip, name => $node });
 	    my $outsub = sub { print "\nnode '$node': " . shift };
-	    run_command([
-		    @$ssh_cmd, @$ssh_options, $ip, "$qdevice_certutil", "-m", "-c",
-		    "/etc/pve/$p12_file_base"], outfunc => \&$outsub
-		);
+	    run_command(
+		[@$ssh_cmd, @$ssh_options, $ip, "$qdevice_certutil", "-m", "-c", "/etc/pve/$p12_file_base"],
+		outfunc => \&$outsub
+	    );
 	});
 	unlink "/etc/pve/$p12_file_base";
 
@@ -249,8 +249,14 @@ __PACKAGE__->register_method ({
 	    my $ssh_options = PVE::SSHInfo::ssh_info_to_ssh_opts ({ ip => $ip, name => $node });
 	    my $outsub = sub { print "\nnode '$node': " . shift };
 	    print "\nINFO: start and enable corosync qdevice daemon on node '$node'...\n";
-	    run_command([@$ssh_cmd, @$ssh_options, $ip, 'systemctl', 'start', 'corosync-qdevice'], outfunc => \&$outsub);
-	    run_command([@$ssh_cmd, @$ssh_options, $ip, 'systemctl', 'enable', 'corosync-qdevice'], outfunc => \&$outsub);
+	    run_command(
+		[@$ssh_cmd, @$ssh_options, $ip, 'systemctl', 'start', 'corosync-qdevice'],
+		outfunc => \&$outsub
+	    );
+	    run_command(
+		[@$ssh_cmd, @$ssh_options, $ip, 'systemctl', 'enable', 'corosync-qdevice'],
+		outfunc => \&$outsub
+	    );
 	});
 
 	run_command(['corosync-cfgtool', '-R']); # do cluster wide config reload
-- 
2.39.2



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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [pve-devel] [PATCH cluster 2/2] pvecm: qdevice: adjust line lengths
  2024-05-15 10:32 ` [pve-devel] [PATCH cluster 2/2] pvecm: qdevice: adjust line lengths Aaron Lauterer
@ 2024-05-16  9:45   ` Fabian Grünbichler
  0 siblings, 0 replies; 7+ messages in thread
From: Fabian Grünbichler @ 2024-05-16  9:45 UTC (permalink / raw)
  To: Proxmox VE development discussion

On May 15, 2024 12:32 pm, Aaron Lauterer wrote:
> The first instance had the line break mid array. It now is a bit over
> the limit, but follows the style guide closely: putting each argument to
> the function in a newline.
> 
> Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
> ---
>  src/PVE/CLI/pvecm.pm | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/src/PVE/CLI/pvecm.pm b/src/PVE/CLI/pvecm.pm
> index 5c285a9..53e9cac 100755
> --- a/src/PVE/CLI/pvecm.pm
> +++ b/src/PVE/CLI/pvecm.pm
> @@ -210,10 +210,10 @@ __PACKAGE__->register_method ({
>  	    my ($node, $ip) = @_;
>  	    my $ssh_options = PVE::SSHInfo::ssh_info_to_ssh_opts ({ ip => $ip, name => $node });
>  	    my $outsub = sub { print "\nnode '$node': " . shift };
> -	    run_command([
> -		    @$ssh_cmd, @$ssh_options, $ip, "$qdevice_certutil", "-m", "-c",
> -		    "/etc/pve/$p12_file_base"], outfunc => \&$outsub
> -		);
> +	    run_command(
> +		[@$ssh_cmd, @$ssh_options, $ip, "$qdevice_certutil", "-m", "-c", "/etc/pve/$p12_file_base"],
> +		outfunc => \&$outsub

this would then be even shorter if the options can be dropped
altogether. and while we are at it:

outfunc => $outsub

no need for symbol salad here :)

I don't mind the arg-per-line even if it would be below the limit then,
but as an alternative, you can always construct the full command first
to make the run_command line shorter.

e.g.:

my $cluster_ssh_cmd = PVE::SSHInfo::ssh_info_to_command({ ip => $ip, name => $node });
my $cmd = [@$cluster_ssh_cmd, '--', $qdevice_certutil, '-m', '-c', "/etc/pve/$p12_file_base"];
run_command($cmd, outfunc => $outsub);

but that is mainly a matter of taste I'd say.

> +	    );
>  	});
>  	unlink "/etc/pve/$p12_file_base";
>  
> @@ -249,8 +249,14 @@ __PACKAGE__->register_method ({
>  	    my $ssh_options = PVE::SSHInfo::ssh_info_to_ssh_opts ({ ip => $ip, name => $node });
>  	    my $outsub = sub { print "\nnode '$node': " . shift };
>  	    print "\nINFO: start and enable corosync qdevice daemon on node '$node'...\n";
> -	    run_command([@$ssh_cmd, @$ssh_options, $ip, 'systemctl', 'start', 'corosync-qdevice'], outfunc => \&$outsub);
> -	    run_command([@$ssh_cmd, @$ssh_options, $ip, 'systemctl', 'enable', 'corosync-qdevice'], outfunc => \&$outsub);
> +	    run_command(
> +		[@$ssh_cmd, @$ssh_options, $ip, 'systemctl', 'start', 'corosync-qdevice'],
> +		outfunc => \&$outsub
> +	    );
> +	    run_command(
> +		[@$ssh_cmd, @$ssh_options, $ip, 'systemctl', 'enable', 'corosync-qdevice'],
> +		outfunc => \&$outsub
> +	    );

same as above applies here as well

>  	});
>  
>  	run_command(['corosync-cfgtool', '-R']); # do cluster wide config reload
> -- 
> 2.39.2
> 
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [pve-devel] [PATCH cluster 1/2] fix #5461: pvecm: ssh: adapt intra cluster ssh options
  2024-05-15 10:32 ` [pve-devel] [PATCH cluster 1/2] fix #5461: pvecm: ssh: adapt intra cluster ssh options Aaron Lauterer
@ 2024-05-16 10:17   ` Fabian Grünbichler
  2024-05-16 10:38     ` Aaron Lauterer
  0 siblings, 1 reply; 7+ messages in thread
From: Fabian Grünbichler @ 2024-05-16 10:17 UTC (permalink / raw)
  To: Proxmox VE development discussion

On May 15, 2024 12:32 pm, Aaron Lauterer wrote:
> because otherwise the SSH calls to other nodes in the cluster will fail
> on newer clusters that only have the ssh known host keys located in the
> pmxcfs.
> 
> By utilizing SSHInfo::ssh_info_to_ssh_opts we can add the needed options
> to the SSH call to have the node name aliased correctly and pointing SSH
> to the correct known hosts file.

couldn't this completely be switched over to use ssh_info_to_command ?
then we'd also benefit from other existing and future additions there

ssh_info_to_ssh_opts is basically the escape hatch for cases where that
does not work, like scp ;)

> Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
> ---
>  src/PVE/CLI/pvecm.pm | 24 +++++++++++++++---------
>  1 file changed, 15 insertions(+), 9 deletions(-)
> 
> diff --git a/src/PVE/CLI/pvecm.pm b/src/PVE/CLI/pvecm.pm
> index 0e8ca8f..5c285a9 100755
> --- a/src/PVE/CLI/pvecm.pm
> +++ b/src/PVE/CLI/pvecm.pm
> @@ -18,6 +18,7 @@ use PVE::PTY;
>  use PVE::API2::ClusterConfig;
>  use PVE::Corosync;
>  use PVE::Cluster::Setup;
> +use PVE::SSHInfo;
>  
>  use base qw(PVE::CLIHandler);
>  
> @@ -173,9 +174,10 @@ __PACKAGE__->register_method ({
>  	run_command([@$scp_cmd, "root\@\[$qnetd_addr\]:$ca_export_file", "/etc/pve/$ca_export_base"]);
>  	$foreach_member->(sub {
>  	    my ($node, $ip) = @_;
> +	    my $ssh_options = PVE::SSHInfo::ssh_info_to_ssh_opts ({ ip => $ip, name => $node });
>  	    my $outsub = sub { print "\nnode '$node': " . shift };
>  	    run_command(
> -		[@$ssh_cmd, $ip, $qdevice_certutil, "-i", "-c", "/etc/pve/$ca_export_base"],
> +		[@$ssh_cmd, @$ssh_options, $ip, $qdevice_certutil, "-i", "-c", "/etc/pve/$ca_export_base"],
>  		noerr => 1, outfunc => \&$outsub
>  	    );
>  	});
> @@ -206,9 +208,10 @@ __PACKAGE__->register_method ({
>  	run_command([@$scp_cmd, "$db_dir_node/$p12_file_base", "/etc/pve/"]);
>  	$foreach_member->(sub {
>  	    my ($node, $ip) = @_;
> +	    my $ssh_options = PVE::SSHInfo::ssh_info_to_ssh_opts ({ ip => $ip, name => $node });
>  	    my $outsub = sub { print "\nnode '$node': " . shift };
>  	    run_command([
> -		    @$ssh_cmd, $ip, "$qdevice_certutil", "-m", "-c",
> +		    @$ssh_cmd, @$ssh_options, $ip, "$qdevice_certutil", "-m", "-c",
>  		    "/etc/pve/$p12_file_base"], outfunc => \&$outsub
>  		);
>  	});
> @@ -243,10 +246,11 @@ __PACKAGE__->register_method ({
>  
>  	$foreach_member->(sub {
>  	    my ($node, $ip) = @_;
> +	    my $ssh_options = PVE::SSHInfo::ssh_info_to_ssh_opts ({ ip => $ip, name => $node });
>  	    my $outsub = sub { print "\nnode '$node': " . shift };
>  	    print "\nINFO: start and enable corosync qdevice daemon on node '$node'...\n";
> -	    run_command([@$ssh_cmd, $ip, 'systemctl', 'start', 'corosync-qdevice'], outfunc => \&$outsub);
> -	    run_command([@$ssh_cmd, $ip, 'systemctl', 'enable', 'corosync-qdevice'], outfunc => \&$outsub);
> +	    run_command([@$ssh_cmd, @$ssh_options, $ip, 'systemctl', 'start', 'corosync-qdevice'], outfunc => \&$outsub);
> +	    run_command([@$ssh_cmd, @$ssh_options, $ip, 'systemctl', 'enable', 'corosync-qdevice'], outfunc => \&$outsub);
>  	});
>  
>  	run_command(['corosync-cfgtool', '-R']); # do cluster wide config reload
> @@ -291,8 +295,9 @@ __PACKAGE__->register_method ({
>  	    # cleanup qdev state (cert storage)
>  	    my $qdev_state_dir =  "/etc/corosync/qdevice";
>  	    $foreach_member->(sub {
> -		my (undef, $ip) = @_;
> -		run_command([@$ssh_cmd, $ip, '--', 'rm', '-rf', $qdev_state_dir]);
> +		my ($node, $ip) = @_;
> +		my $ssh_options = PVE::SSHInfo::ssh_info_to_ssh_opts ({ ip => $ip, name => $node });
> +		run_command([@$ssh_cmd, @$ssh_options, $ip, '--', 'rm', '-rf', $qdev_state_dir]);
>  	    });
>  	};
>  
> @@ -300,9 +305,10 @@ __PACKAGE__->register_method ({
>  	die $@ if $@;
>  
>  	$foreach_member->(sub {
> -	    my (undef, $ip) = @_;
> -	    run_command([@$ssh_cmd, $ip, 'systemctl', 'stop', 'corosync-qdevice']);
> -	    run_command([@$ssh_cmd, $ip, 'systemctl', 'disable', 'corosync-qdevice']);
> +	    my ($node, $ip) = @_;
> +	    my $ssh_options = PVE::SSHInfo::ssh_info_to_ssh_opts ({ ip => $ip, name => $node });
> +	    run_command([@$ssh_cmd, @$ssh_options, $ip, 'systemctl', 'stop', 'corosync-qdevice']);
> +	    run_command([@$ssh_cmd, @$ssh_options, $ip, 'systemctl', 'disable', 'corosync-qdevice']);
>  	});
>  
>  	run_command(['corosync-cfgtool', '-R']);
> -- 
> 2.39.2
> 
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [pve-devel] [PATCH cluster 1/2] fix #5461: pvecm: ssh: adapt intra cluster ssh options
  2024-05-16 10:17   ` Fabian Grünbichler
@ 2024-05-16 10:38     ` Aaron Lauterer
  0 siblings, 0 replies; 7+ messages in thread
From: Aaron Lauterer @ 2024-05-16 10:38 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fabian Grünbichler

I'll give it a try and will send a v2 :)

On  2024-05-16  12:17, Fabian Grünbichler wrote:
> On May 15, 2024 12:32 pm, Aaron Lauterer wrote:
>> because otherwise the SSH calls to other nodes in the cluster will fail
>> on newer clusters that only have the ssh known host keys located in the
>> pmxcfs.
>>
>> By utilizing SSHInfo::ssh_info_to_ssh_opts we can add the needed options
>> to the SSH call to have the node name aliased correctly and pointing SSH
>> to the correct known hosts file.
> 
> couldn't this completely be switched over to use ssh_info_to_command ?
> then we'd also benefit from other existing and future additions there
> 
> ssh_info_to_ssh_opts is basically the escape hatch for cases where that
> does not work, like scp ;)
> 
>> Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
>> ---
>>   src/PVE/CLI/pvecm.pm | 24 +++++++++++++++---------
>>   1 file changed, 15 insertions(+), 9 deletions(-)
>>
>> diff --git a/src/PVE/CLI/pvecm.pm b/src/PVE/CLI/pvecm.pm
>> index 0e8ca8f..5c285a9 100755
>> --- a/src/PVE/CLI/pvecm.pm
>> +++ b/src/PVE/CLI/pvecm.pm
>> @@ -18,6 +18,7 @@ use PVE::PTY;
>>   use PVE::API2::ClusterConfig;
>>   use PVE::Corosync;
>>   use PVE::Cluster::Setup;
>> +use PVE::SSHInfo;
>>   
>>   use base qw(PVE::CLIHandler);
>>   
>> @@ -173,9 +174,10 @@ __PACKAGE__->register_method ({
>>   	run_command([@$scp_cmd, "root\@\[$qnetd_addr\]:$ca_export_file", "/etc/pve/$ca_export_base"]);
>>   	$foreach_member->(sub {
>>   	    my ($node, $ip) = @_;
>> +	    my $ssh_options = PVE::SSHInfo::ssh_info_to_ssh_opts ({ ip => $ip, name => $node });
>>   	    my $outsub = sub { print "\nnode '$node': " . shift };
>>   	    run_command(
>> -		[@$ssh_cmd, $ip, $qdevice_certutil, "-i", "-c", "/etc/pve/$ca_export_base"],
>> +		[@$ssh_cmd, @$ssh_options, $ip, $qdevice_certutil, "-i", "-c", "/etc/pve/$ca_export_base"],
>>   		noerr => 1, outfunc => \&$outsub
>>   	    );
>>   	});
>> @@ -206,9 +208,10 @@ __PACKAGE__->register_method ({
>>   	run_command([@$scp_cmd, "$db_dir_node/$p12_file_base", "/etc/pve/"]);
>>   	$foreach_member->(sub {
>>   	    my ($node, $ip) = @_;
>> +	    my $ssh_options = PVE::SSHInfo::ssh_info_to_ssh_opts ({ ip => $ip, name => $node });
>>   	    my $outsub = sub { print "\nnode '$node': " . shift };
>>   	    run_command([
>> -		    @$ssh_cmd, $ip, "$qdevice_certutil", "-m", "-c",
>> +		    @$ssh_cmd, @$ssh_options, $ip, "$qdevice_certutil", "-m", "-c",
>>   		    "/etc/pve/$p12_file_base"], outfunc => \&$outsub
>>   		);
>>   	});
>> @@ -243,10 +246,11 @@ __PACKAGE__->register_method ({
>>   
>>   	$foreach_member->(sub {
>>   	    my ($node, $ip) = @_;
>> +	    my $ssh_options = PVE::SSHInfo::ssh_info_to_ssh_opts ({ ip => $ip, name => $node });
>>   	    my $outsub = sub { print "\nnode '$node': " . shift };
>>   	    print "\nINFO: start and enable corosync qdevice daemon on node '$node'...\n";
>> -	    run_command([@$ssh_cmd, $ip, 'systemctl', 'start', 'corosync-qdevice'], outfunc => \&$outsub);
>> -	    run_command([@$ssh_cmd, $ip, 'systemctl', 'enable', 'corosync-qdevice'], outfunc => \&$outsub);
>> +	    run_command([@$ssh_cmd, @$ssh_options, $ip, 'systemctl', 'start', 'corosync-qdevice'], outfunc => \&$outsub);
>> +	    run_command([@$ssh_cmd, @$ssh_options, $ip, 'systemctl', 'enable', 'corosync-qdevice'], outfunc => \&$outsub);
>>   	});
>>   
>>   	run_command(['corosync-cfgtool', '-R']); # do cluster wide config reload
>> @@ -291,8 +295,9 @@ __PACKAGE__->register_method ({
>>   	    # cleanup qdev state (cert storage)
>>   	    my $qdev_state_dir =  "/etc/corosync/qdevice";
>>   	    $foreach_member->(sub {
>> -		my (undef, $ip) = @_;
>> -		run_command([@$ssh_cmd, $ip, '--', 'rm', '-rf', $qdev_state_dir]);
>> +		my ($node, $ip) = @_;
>> +		my $ssh_options = PVE::SSHInfo::ssh_info_to_ssh_opts ({ ip => $ip, name => $node });
>> +		run_command([@$ssh_cmd, @$ssh_options, $ip, '--', 'rm', '-rf', $qdev_state_dir]);
>>   	    });
>>   	};
>>   
>> @@ -300,9 +305,10 @@ __PACKAGE__->register_method ({
>>   	die $@ if $@;
>>   
>>   	$foreach_member->(sub {
>> -	    my (undef, $ip) = @_;
>> -	    run_command([@$ssh_cmd, $ip, 'systemctl', 'stop', 'corosync-qdevice']);
>> -	    run_command([@$ssh_cmd, $ip, 'systemctl', 'disable', 'corosync-qdevice']);
>> +	    my ($node, $ip) = @_;
>> +	    my $ssh_options = PVE::SSHInfo::ssh_info_to_ssh_opts ({ ip => $ip, name => $node });
>> +	    run_command([@$ssh_cmd, @$ssh_options, $ip, 'systemctl', 'stop', 'corosync-qdevice']);
>> +	    run_command([@$ssh_cmd, @$ssh_options, $ip, 'systemctl', 'disable', 'corosync-qdevice']);
>>   	});
>>   
>>   	run_command(['corosync-cfgtool', '-R']);
>> -- 
>> 2.39.2
>>
>>
>>
>> _______________________________________________
>> pve-devel mailing list
>> pve-devel@lists.proxmox.com
>> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>>
>>
>>
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [pve-devel] [PATCH cluster 0/2] fix #5461: qdevice cluster mgmt
  2024-05-15 10:32 [pve-devel] [PATCH cluster 0/2] fix #5461: qdevice cluster mgmt Aaron Lauterer
  2024-05-15 10:32 ` [pve-devel] [PATCH cluster 1/2] fix #5461: pvecm: ssh: adapt intra cluster ssh options Aaron Lauterer
  2024-05-15 10:32 ` [pve-devel] [PATCH cluster 2/2] pvecm: qdevice: adjust line lengths Aaron Lauterer
@ 2024-05-21  7:12 ` Aaron Lauterer
  2 siblings, 0 replies; 7+ messages in thread
From: Aaron Lauterer @ 2024-05-21  7:12 UTC (permalink / raw)
  To: pve-devel

v2 is available 
https://lists.proxmox.com/pipermail/pve-devel/2024-May/063878.html

On  2024-05-15  12:32, Aaron Lauterer wrote:
> on clusters where the ssh known hosts info is only stored in the pmxcfs,
> it broke the mgmt of the qdevice. By adding the necessary ssh options on
> each intra cluster ssh call, we can fix this.
> 
> The second patch is optional and adjusts the touched code to fit better
> into the max line lenghts.
> I put it into a separate patch as I wasn't 100% sure how to format it,
>    especially the first instance in that patch.
> 
> 
> Aaron Lauterer (2):
>    fix #5461: pvecm: ssh: adapt intra cluster ssh options
>    pvecm: qdevice: adjust line lengths
> 
>   src/PVE/CLI/pvecm.pm | 36 ++++++++++++++++++++++++------------
>   1 file changed, 24 insertions(+), 12 deletions(-)
> 


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-05-21  7:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-15 10:32 [pve-devel] [PATCH cluster 0/2] fix #5461: qdevice cluster mgmt Aaron Lauterer
2024-05-15 10:32 ` [pve-devel] [PATCH cluster 1/2] fix #5461: pvecm: ssh: adapt intra cluster ssh options Aaron Lauterer
2024-05-16 10:17   ` Fabian Grünbichler
2024-05-16 10:38     ` Aaron Lauterer
2024-05-15 10:32 ` [pve-devel] [PATCH cluster 2/2] pvecm: qdevice: adjust line lengths Aaron Lauterer
2024-05-16  9:45   ` Fabian Grünbichler
2024-05-21  7:12 ` [pve-devel] [PATCH cluster 0/2] fix #5461: qdevice cluster mgmt Aaron Lauterer

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