Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow HA tests on non MM setup to use a FQHN as iSCSI server #17930

Merged
merged 1 commit into from
Oct 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion tests/ha/setup_hosts_and_luns.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use strict;
use warnings;
use testapi;
use lockapi;
use Socket qw(inet_ntoa);
use utils qw(systemctl file_content_replace);
use hacluster qw(get_cluster_name get_hostname get_ip get_my_ip is_node choose_node exec_csync);

Expand All @@ -26,6 +27,14 @@ sub replace_text_in_ha_files {
}
}

sub iscsi_server_ip {
my ($host) = @_;
return $host if ($host =~ /^\d+\.\d+\.\d+\.\d+$/); # Arg it's already IPv4
return $host if ($host =~ /^[a-f\d]+:[a-f\d]+:[a-f\d]+:[a-f\d]+:[a-f\d]+:[a-f\d]+:[a-f\d]+:[a-f\d]+$/); # Arg it's IPv6
my $packed_ip = gethostbyname($host);
return inet_ntoa($packed_ip);
}

sub run {
my $nfs_share = get_required_var('NFS_SUPPORT_SHARE');
my $mountpt = '/support_fs';
Expand Down Expand Up @@ -113,7 +122,7 @@ sub run {
# prepare LUN files. only node 1 does this
if (is_node(1)) {
my $cluster = get_required_var('CLUSTER_INFOS');
my $iscsi_srv = get_required_var('ISCSI_SERVER');
my $iscsi_srv = iscsi_server_ip(get_required_var('ISCSI_SERVER'));
my $num_luns = (split(/:/, $cluster))[2];
my $lun_list_file = "$mountpt/$dir_id/$cluster_name-lun.list";
my $index = get_var('ISCSI_LUN_INDEX', 0);
Expand Down