Commit 490d011a authored by Mike Hibler's avatar Mike Hibler

Support for FreeNAS 9.3.

This REPLACES FreeNAS 9.2 support. The two are incompatible.

This new code uses the REST API whereever possible (i.e., when it is
implemented and works). There is some client-side reorg going on too.
parent 45212eb1
#
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
# Copyright (c) 2000-2015 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -41,7 +41,7 @@ include $(TESTBED_SRCDIR)/GNUmakerules
FBSDBASEDIR = freebsd9
OETCDIR = $(DESTDIR)$(CLIENT_ETCDIR)
NETCDIR = $(DESTDIR)/cfg/emulab
NETCDIR = $(DESTDIR)/conf/base/etc/emulab
OBINDIR = $(DESTDIR)$(CLIENT_BINDIR)
NBINDIR = $(DESTDIR)/usr/local/emulab
OVARDIR = $(DESTDIR)$(CLIENT_VARDIR)
......@@ -70,11 +70,21 @@ basefbsd-install:
# filesystem (e.g., "rm -rf /etc" below). So DO NOT remove the destdircheck.
#
install client-install: destdircheck basefbsd-install
echo "Tweaking FreeBSD 8.3 installed files for FreeNAS..."
mkdir -p $(DESTDIR)/cfg $(DESTDIR)/cfg/rc.d $(DESTDIR)/cfg/local
echo "Tweaking FreeBSD 9.3 installed files for FreeNAS..."
mkdir -p $(DESTDIR)/conf/base/etc/rc.d $(DESTDIR)/conf/base/etc/local
mkdir -p $(DESTDIR)/data $(DESTDIR)/local $(DESTDIR)/conf/base/var
rm -f $(OETCDIR)/master.passwd $(OETCDIR)/passwd $(OETCDIR)/group
rm -f $(OETCDIR)/hosts $(OETCDIR)/prepare.sh
mv $(OETCDIR) $(NETCDIR)
rm -f $(ORCDIR)/rc.kname $(ORCDIR)/rc.canaryd $(ORCDIR)/rc.linktest
rm -f $(ORCDIR)/rc.mkelab $(ORCDIR)/rc.motelog $(ORCDIR)/rc.trace
rm -f $(ORCDIR)/rc.inelab $(ORCDIR)/rc.healthd $(ORCDIR)/rc.nodecheck
rm -f $(ORCDIR)/rc.pgeni $(ORCDIR)/rc.tpmsetup $(ORCDIR)/rc.trafgen
rm -f $(ORCDIR)/rc.slothd
rm -f $(OBINDIR)/checknode $(OBINDIR)/checkutils.sh
rm -f $(OBINDIR)/diskcheck $(OBINDIR)/hbis.sh $(OBINDIR)/cpucheck
rm -f $(OBINDIR)/healthd.conf $(OBINDIR)/ixpboot $(OBINDIR)/memcheck
rm -f $(OBINDIR)/niccheck $(OBINDIR)/tdd $(OBINDIR)/timecheck
mv $(OBINDIR) $(DESTDIR)/local/emulab
mv $(OVARDIR) $(NVARDIR)
ln -sf /data/emulab $(DESTDIR)/conf/base/var/emulab
......@@ -84,10 +94,10 @@ install client-install: destdircheck basefbsd-install
rm -rf $(DESTDIR)/boot $(DESTDIR)/etc $(DESTDIR)/root $(DESTDIR)/sbin
rm -rf $(DESTDIR)/usr/* $(DESTDIR)/var
mv $(DESTDIR)/local $(DESTDIR)/usr/local
ln -sf /usr/local/emulab $(DESTDIR)/cfg/local/emulab
ln -sf /usr/local/emulab $(DESTDIR)/conf/base/etc/local/emulab
echo "Installing FreeNAS files..."
$(INSTALL) -m 644 $(SRCDIR)/genvmtype $(NETCDIR)/
$(INSTALL) -m 755 $(SRCDIR)/testbed $(DESTDIR)/cfg/rc.d/
$(INSTALL) -m 755 $(SRCDIR)/testbed $(DESTDIR)/conf/base/etc/rc.d/
$(INSTALL) -m 755 $(SRCDIR)/bscontrol.proxy.pl $(NBINDIR)/bscontrol.proxy
$(INSTALL) -m 755 $(SRCDIR)/freenas-config $(NBINDIR)/
$(INSTALL) -m 644 $(SRCDIR)/libfreenas.pm $(NBINDIR)/
......
......@@ -49,6 +49,13 @@ sub usage()
print STDERR " Destroy snapshot <vol>/<pool>@<tstamp>; if <tstamp> is not given, destroy all snapshots\n";
print STDERR " declone <pool> <vol>\n";
print STDERR " Destroy clone <vol> in <pool>; also destroys associated snapshot if this is the last clone\n";
print STDERR "iSCSI-related debugging commands:\n";
print STDERR " slices Print info about Emulab slices\n";
print STDERR " targets Print info about iSCSI targets\n";
print STDERR " extents Print info about iSCSI extents\n";
print STDERR " assocs Print info about iSCSI target/extent assocs\n";
print STDERR " authinit Print info about iSCSI authorized initiators\n";
print STDERR " nextaitag Print next available initiator tag\n";
exit(-1);
}
my $optlist = "hd";
......@@ -78,6 +85,12 @@ my %cmds = (
"destroy" => \&destroy,
"desnapshot" => \&desnapshot,
"declone" => \&declone,
"slices" => \&slices,
"extents" => \&extents,
"authinit" => \&authinit,
"nextaitag" => \&nexttag,
"targets" => \&targets,
"assocs" => \&assocs,
);
#
......@@ -152,6 +165,124 @@ sub volumes()
return 0;
}
#
# Print uninterpreted Emulab slice info.
#
sub slices()
{
my $eref = freenasSliceList();
foreach my $ext (keys %{$eref}) {
foreach my $key ("pid", "eid", "volname", "bsid", "vnode_id", "size", "type") {
my $val = $eref->{$ext}->{$key};
$val = lc($val)
if ($key eq "type");
print "$key=$val "
if (defined($val));
}
print "\n";
}
return 0;
}
#
# Print uninterpreted iSCSI extent info.
#
sub extents()
{
my $eref = freenasExtentList(0);
foreach my $ext (keys %{$eref}) {
foreach my $key ("id", "name", "path", "type", "blocksize", "filesize", "naa") {
my $val = $eref->{$ext}->{$key};
$val = lc($val)
if ($key eq "type");
print "$key=$val "
if (defined($val));
}
print "\n";
}
return 0;
}
#
# Print uninterpreted iSCSI target info.
#
sub targets()
{
my $airef = freenasTargetList(0);
foreach my $ai (keys %{$airef}) {
foreach my $key ("id", "name", "alias", "serial", "portalgroup", "authgroup", "authtype", "initiatorgroup") {
my $val = $airef->{$ai}->{$key};
print "$key=$val "
if (defined($val));
}
print "\n";
}
return 0;
}
#
# Print uninterpreted iSCSI target/extent association info.
#
sub assocs()
{
my $aref = freenasAssocList();
foreach my $a (keys %{$aref}) {
foreach my $key ("id", "target", "target_name", "extent", "extent_name") {
my $val = $aref->{$a}->{$key};
print "$key=$val "
if (defined($val));
}
print "\n";
}
return 0;
}
#
# Print uninterpreted iSCSI authorized initiator info.
#
sub authinit()
{
my $airef = freenasAuthInitList();
foreach my $ai (keys %{$airef}) {
foreach my $key ("id", "tag", "auth_network", "comment") {
my $val = $airef->{$ai}->{$key};
print "$key=$val "
if (defined($val));
}
print "\n";
}
return 0;
}
#
# Print next available authinit tag
#
sub nexttag() {
my $aiinfo = freenasAuthInitList();
my @taglist = ();
foreach my $ai (keys %{$aiinfo}) {
my $tag = $aiinfo->{$ai}->{'tag'};
if (defined($tag) && $tag =~ /^(\d+)$/) {
push(@taglist, $1);
}
}
my $freetag = 1;
foreach my $curtag (sort {$a <=> $b} @taglist) {
last
if ($freetag < $curtag);
$freetag++;
}
print "nexttag=$freetag\n";
}
sub create($$$;$)
{
my ($pool,$vol,$size,$fstype) = @_;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment