Skip to content

Commit

Permalink
Merge pull request os-autoinst#17930 from alvarocarvajald/team8206
Browse files Browse the repository at this point in the history
Allow HA tests on non MM setup to use a FQHN as iSCSI server
  • Loading branch information
a-kpappas authored Oct 9, 2023
2 parents 6489971 + 3f6cd08 commit 5dc5f47
Showing 1 changed file with 10 additions and 1 deletion.
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

0 comments on commit 5dc5f47

Please sign in to comment.