mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-09-04 20:17:55 +00:00
refactor(debian): remove dead NFS export helpers
Remove the unreferenced Debian-local copies of setupNFSTree and setupStatemnt. Debian, Anaconda, and SLES callers already use xCAT::SvrUtils, and xCAT plugin dispatch does not expose these private symbols. Signed-off-by: Vinícius Ferrão <2031761+viniciusferrao@users.noreply.github.com>
This commit is contained in:
@@ -1796,91 +1796,4 @@ sub subVars()
|
||||
return $fdir;
|
||||
}
|
||||
|
||||
sub setupNFSTree {
|
||||
my $node = shift;
|
||||
my $sip = shift;
|
||||
my $callback = shift;
|
||||
|
||||
my $cmd = "litetree $node";
|
||||
my @uris = xCAT::Utils->runcmd($cmd, 0);
|
||||
|
||||
foreach my $uri (@uris) {
|
||||
|
||||
# parse the result
|
||||
# the result looks like "nodename: nfsserver:directory";
|
||||
$uri =~ m/\Q$node\E:\s+(.+):(.+)$/;
|
||||
my $nfsserver = $1;
|
||||
my $nfsdirectory = $2;
|
||||
|
||||
if ($nfsserver eq $sip) { # on the service node
|
||||
unless (-d $nfsdirectory) {
|
||||
if (-e $nfsdirectory) {
|
||||
unlink $nfsdirectory;
|
||||
}
|
||||
mkpath $nfsdirectory;
|
||||
}
|
||||
|
||||
|
||||
$cmd = "showmount -e $nfsserver";
|
||||
my @entries = xCAT::Utils->runcmd($cmd, 0);
|
||||
shift @entries;
|
||||
if (grep /\Q$nfsdirectory\E/, @entries) {
|
||||
$callback->({ data => ["$nfsdirectory has been exported already!"] });
|
||||
} else {
|
||||
$cmd = "/usr/sbin/exportfs :$nfsdirectory -o rw,no_root_squash,sync,no_subtree_check,insecure";
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
$callback->({ data => ["now $nfsdirectory is exported!"] });
|
||||
}
|
||||
|
||||
if (xCAT::SvrUtils->ensure_nfs_export_option($nfsdirectory, 'insecure')) {
|
||||
xCAT::Utils->runcmd("/usr/sbin/exportfs -r", 0);
|
||||
$callback->({ data => ["added insecure to existing $nfsdirectory export"] });
|
||||
} elsif (!xCAT::SvrUtils->nfs_export_exists($nfsdirectory)) {
|
||||
$cmd = qq{echo "$nfsdirectory *(rw,no_root_squash,sync,no_subtree_check,insecure)" >> /etc/exports};
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
$callback->({ data => ["$nfsdirectory is added to /etc/exports with default option"] });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub setupStatemnt {
|
||||
my $sip = shift;
|
||||
my $statemnt = shift;
|
||||
my $callback = shift;
|
||||
|
||||
$statemnt =~ m/^(.+):(.+)$/;
|
||||
my $nfsserver = $1;
|
||||
my $nfsdirectory = $2;
|
||||
|
||||
if ($sip eq inet_ntoa(inet_aton($nfsserver))) {
|
||||
unless (-d $nfsdirectory) {
|
||||
if (-e $nfsdirectory) {
|
||||
unlink $nfsdirectory;
|
||||
}
|
||||
mkpath $nfsdirectory;
|
||||
}
|
||||
|
||||
my $cmd = "showmount -e $nfsserver";
|
||||
my @entries = xCAT::Utils->runcmd($cmd, 0);
|
||||
shift @entries;
|
||||
if (grep /\Q$nfsdirectory\E/, @entries) {
|
||||
$callback->({ data => ["$nfsdirectory has been exported already!"] });
|
||||
} else {
|
||||
$cmd = "/usr/sbin/exportfs :$nfsdirectory -o rw,no_root_squash,sync,no_subtree_check,insecure";
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
$callback->({ data => ["now $nfsdirectory is exported!"] });
|
||||
}
|
||||
|
||||
if (xCAT::SvrUtils->ensure_nfs_export_option($nfsdirectory, 'insecure')) {
|
||||
xCAT::Utils->runcmd("/usr/sbin/exportfs -r", 0);
|
||||
$callback->({ data => ["added insecure to existing $nfsdirectory export"] });
|
||||
} elsif (!xCAT::SvrUtils->nfs_export_exists($nfsdirectory)) {
|
||||
xCAT::Utils->runcmd(qq{echo "$nfsdirectory *(rw,no_root_squash,sync,no_subtree_check,insecure)" >> /etc/exports}, 0);
|
||||
$callback->({ data => ["$nfsdirectory is added into /etc/exports with default options"] });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
Reference in New Issue
Block a user