--- 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']);