Commit 1c0038f5 authored by U-CASSANDRA\duerig's avatar U-CASSANDRA\duerig
Browse files

Resolved conflicts in flash client code.

Merge branch 'mapflashbranch' of git-public.flux.utah.edu:/flux/git/users/mstrum/emulab-devel into mapflashbranch

Conflicts:
	protogeni/demo/src/Console.as
	protogeni/demo/src/MenuSliceCreate.as
	protogeni/demo/src/MenuSliceDetail.as
parents 4343a5a4 9102c8e6
......@@ -553,7 +553,7 @@ my $nextfake = 0;
#
# Lookup by node_id,unit
#
sub Lookup($$$$)
sub Lookup($$$)
{
my ($class, $nodeid, $unit) = @_;
......@@ -592,6 +592,30 @@ sub bandwidth($) { return field($_[0], 'bandwidth'); }
# The virtual iface name is $type$unit
sub viface($) { return $_[0]->type() . $_[0]->unit(); }
#
# Lookup by the experiment/virtlan/vnode
#
sub LookupByVirtLan($$$$)
{
my ($class, $experiment, $virtlan, $vnode) = @_;
my $exptidx = $experiment->idx();
$virtlan = DBQuoteSpecial($virtlan);
$vnode = DBQuoteSpecial($vnode);
my $query_result =
DBQueryWarn("select node_id,unit from vinterfaces as vif ".
"left join virt_lans as vl on vl.exptidx=vif.exptidx and ".
" vl.ip=vif.IP ".
"where vif.exptidx='$exptidx' and ".
" vl.vname=$virtlan and vl.vnode=$vnode");
return undef
if (!defined($query_result) || !$query_result->numrows);
my ($node_id,$unit) = $query_result->fetchrow_array();
return Interface::VInterface->Lookup($node_id, $unit);
}
#
# Create a new vinterface
......@@ -682,6 +706,62 @@ sub ReserveSharedBandwidth($$)
return 0;
}
#
# Refresh instance by reloading from the DB.
#
sub Refresh($)
{
my ($self) = @_;
return -1
if (! ref($self));
my $nodeid = $self->node_id();
my $unit = $self->unit();
my $query_result =
DBQueryWarn("select * from vinterfaces ".
"where node_id='$nodeid' and unit='$unit'");
return undef
if (!$query_result || !$query_result->numrows);
$self->{"DBROW"} = $query_result->fetchrow_hashref();
return 0;
}
#
# Perform some updates ...
#
sub Update($$)
{
my ($self, $argref) = @_;
# Must be a real reference.
return -1
if (! ref($self));
my $nodeid = $self->node_id();
my $unit = $self->unit();
my @sets = ();
foreach my $key (keys(%{$argref})) {
my $val = $argref->{$key};
# Treat NULL special.
push (@sets, "${key}=" . ($val eq "NULL" ?
"NULL" : DBQuoteSpecial($val)));
}
my $query = "update vinterfaces set " . join(",", @sets) .
" where node_id='$nodeid' and unit='$unit'";
return -1
if (! DBQueryWarn($query));
return Refresh($self);
}
# _Always_ make sure that this 1 is at the end of the file...
1;
......@@ -29,6 +29,7 @@ use Experiment;
use OSinfo;
use GeniEmulab;
use GeniResource;
use GeniResponse;
use English;
use Socket;
use XML::Simple;
......@@ -475,7 +476,7 @@ sub MapNodes($$)
my $iface_id = $ifaceref->{'virtual_interface_id'};
my $MAC = $ifaceref->{'MAC'};
my ($node, $compid) = @{ $ifacemap{$iface_id} };
my $iface;
my ($iface,$interface);
if (GeniHRN::IsValid($compid)) {
(undef,undef,$iface) = GeniHRN::ParseInterface($compid);
......@@ -489,12 +490,29 @@ sub MapNodes($$)
print STDERR Dumper($manifest);
return -1;
}
my $interface = Interface->LookupByIface($node,$iface);
#
# We do not need to do this for virtual nodes.
#
if ($node->isvirtnode()) {
$interface =
Interface::VInterface->LookupByVirtLan($experiment,
$linkname,
$vname);
$MAC = $ifaceref->{'VMAC'};
}
else {
$interface = Interface->LookupByIface($node,$iface);
}
if (!defined($interface)) {
print STDERR "Could not map iface for $node,$iface\n";
print STDERR Dumper($manifest);
return -1;
}
if (!defined($MAC)) {
print STDERR "No mac (or vmac) for $node,$iface\n";
print STDERR Dumper($manifest);
return -1;
}
if (! ($MAC =~ /^[\w]*$/)) {
print STDERR "Bad mac '$MAC' for $node,$iface\n";
print STDERR Dumper($manifest);
......@@ -540,8 +558,18 @@ sub StartSlivers($$)
my ($resource) = @_;
print STDERR "Starting ($$) sliver $resource\n";
return $resource->StartSliver($user);
while (1) {
my $retval = $resource->StartSliver($user);
last
if (!$retval);
return -1
if (!$resource->last_rpcerror() ||
$resource->last_rpcerror() != GENIRESPONSE_BUSY());
sleep(10);
}
return 0;
};
if (ParRun(undef, \@results, $coderef, @resources)) {
print STDERR "*** StartSlivers: Internal error starting slivers.\n";
......@@ -758,19 +786,36 @@ sub DeleteAllSlivers($$)
if (! @resources) {
return 0;
}
#
# Delete slivers in parallel.
#
my @results = ();
my $coderef = sub {
my ($resource) = @_;
foreach my $resource (@resources) {
print STDERR "Deleting sliver for $resource\n";
if ($resource->Clear($user)) {
print STDERR "DeleteSlivers: Could not clear $resource\n";
return -1;
print STDERR "Deleting ($$) sliver for $resource\n";
while (1) {
my $retval = $resource->Clear($user);
last
if (!$retval);
return -1
if (!$resource->last_rpcerror() ||
$resource->last_rpcerror() != GENIRESPONSE_BUSY());
sleep(10);
}
if ($resource->Delete()) {
print STDERR "DeleteSlivers: Could not delete $resource\n";
return -1;
}
return 0;
};
if (ParRun(undef, \@results, $coderef, @resources)) {
print STDERR
"*** DeleteAllSlivers: Internal error deleting slivers.\n";
return -1;
}
return 0;
}
......
......@@ -13,11 +13,12 @@ INITRAMFS = $(BOOT_PATH)/initramfs.gz
#FAKEROOT_BIN = $(STAGING_DIR)/usr/bin/fakeroot
FAKEROOT_BIN = fakeroot
MODULES := busybox zlib linux dropbear testbed hdparm target_template sudo e2fsprogs openssl wget perl portmap file
MODULES := busybox zlib linux dropbear testbed hdparm target_template sudo e2fsprogs openssl wget perl portmap file ethtool
#MODULES := busybox zlib linux dropbear testbed hdparm target_template sudo e2fsprogs openssl wget portmap file
INSTALL_MODULES := $(addsuffix -install,$(MODULES))
EXTRACT_MODULES := $(addsuffix -extract,$(MODULES) toolchain)
PATCH_MODULES := $(addsuffix -patch,$(MODULES) toolchain)
CONFIG_MODULES := $(addsuffix -config,$(MODULES) toolchain)
CLEAN_MODULES := $(addsuffix -clean,$(MODULES) toolchain)
.PHONY: all clean install root-template-install devices \
......@@ -54,6 +55,9 @@ $(EXTRACT_MODULES):
$(PATCH_MODULES):
$(MAKE) -C $(SOURCE_PATH)/$(subst -patch,,$@) patch
$(CONFIG_MODULES):
$(MAKE) -C $(SOURCE_PATH)/$(subst -config,,$@) config
$(INSTALL_MODULES):
$(MAKE) -C $(SOURCE_PATH)/$(subst -install,,$@) install
......
......@@ -11,7 +11,7 @@ chmod 1777 "$target_dir/tmp"
chmod 1777 "$target_dir/var/tmp"
chmod 1777 "$target_dir/var/lock"
chmod 0700 "$target_dir/root/.ssh"
chmod 0600 "$target_dir/root/.ssh/*"
chmod 0600 "$target_dir/root/.ssh/authorized_keys"
chmod 0600 "$target_dir/etc/shadow"
chmod u+s "$target_dir/bin/busybox"
chmod u+s "$target_dir/usr/bin/sudo"
......
......@@ -19,25 +19,25 @@ if [ ! -d "${patchdir}" ] ; then
echo "Aborting. '${patchdir}' is not a directory."
exit 1
fi
for i in `cd ${patchdir}; ls -d ${patchpattern} 2> /dev/null` ; do
for i in `cd ${patchdir}; ls -d ${patchpattern} 2> /dev/null` ; do
case "$i" in
*.gz)
type="gzip"; uncomp="gunzip -dc"; ;;
type="gzip"; uncomp="gunzip -dc"; ;;
*.bz)
type="bzip"; uncomp="bunzip -dc"; ;;
type="bzip"; uncomp="bunzip -dc"; ;;
*.bz2)
type="bzip2"; uncomp="bunzip2 -dc"; ;;
type="bzip2"; uncomp="bunzip2 -dc"; ;;
*.zip)
type="zip"; uncomp="unzip -d"; ;;
type="zip"; uncomp="unzip -d"; ;;
*.Z)
type="compress"; uncomp="uncompress -c"; ;;
type="compress"; uncomp="uncompress -c"; ;;
*)
type="plaintext"; uncomp="cat"; ;;
type="plaintext"; uncomp="cat"; ;;
esac
echo ""
echo "Applying ${i} using ${type}: "
${uncomp} ${patchdir}/${i} | patch -p1 -E -d ${targetdir}
echo "Applying ${i} using ${type}: "
${uncomp} ${patchdir}/${i} | patch -p1 -E -d ${targetdir}
if [ $? != 0 ] ; then
echo "Patch failed! Please fix $i!"
exit 1
......@@ -51,4 +51,4 @@ if [ "`find $targetdir/ '(' -name '*.rej' -o -name '.*.rej' ')' -print`" ] ; the
fi
# Remove backup files
find $targetdir/ '(' -name '*.orig' -o -name '.*.orig' ')' -exec rm -f {} \;
find $targetdir/ -type f '(' -name '*.orig' -o -name '.*.orig' ')' -exec rm -f {} \;
......@@ -115,8 +115,8 @@ $(TARGET_PATH)/sbin/e2fsck: $(E2FSPROGS_PATH)/e2fsck/e2fsck
install -m 755 $< \
$(TARGET_PATH)/sbin/e2fsck
$(STRIPCMD) --strip-unneeded $(TARGET_PATH)/sbin/e2fsck
ln -sf $@ $(dir $@)/fsck.ext2
ln -sf $@ $(dir $@)/fsck.ext3
ln -sf $(notdir $@) $(dir $@)/fsck.ext2
ln -sf $(notdir $@) $(dir $@)/fsck.ext3
touch -c $@
$(TARGET_PATH)/sbin/tune2fs: $(E2FSPROGS_PATH)/misc/tune2fs
......
include ../../variables.mk
ETHTOOL_VERSION = 6+20091202.orig
ETHTOOL_PATH = $(TARGET_BUILD_PATH)/ethtool-$(ETHTOOL_VERSION)
.PHONY: extract patch config \
ethtool install clean all
all: ethtool
extract: $(ETHTOOL_PATH)/.extract-stamp
patch: $(ETHTOOL_PATH)/.patch-stamp
config: $(ETHTOOL_PATH)/.config-stamp
ethtool: $(ETHTOOL_PATH)/ethtool
install: $(TARGET_PATH)/usr/sbin/ethtool
clean:
rm -rf $(ETHTOOL_PATH)
$(ETHTOOL_PATH)/.extract-stamp:
mkdir -p $(TARGET_BUILD_PATH)
cd $(TARGET_BUILD_PATH); tar xzf $(TARBALL_PATH)/ethtool-$(ETHTOOL_VERSION).tar.gz
touch $@
$(ETHTOOL_PATH)/.patch-stamp: $(ETHTOOL_PATH)/.extract-stamp
$(SCRIPTS_PATH)/patch-kernel.sh $(ETHTOOL_PATH) $(SOURCE_PATH)/ethtool/ '*.patch'
touch $@
$(ETHTOOL_PATH)/.config-stamp: $(ETHTOOL_PATH)/.patch-stamp
rm -f $(ETHTOOL_PATH)/config.cache
(cd $(ETHTOOL_PATH); \
PATH=$(STAGING_DIR)/usr/bin:$(PATH) \
$(HOST_CONFIGURE_OPTS) \
./autogen.sh; \
PATH=$(STAGING_DIR)/usr/bin:$(PATH) \
$(HOST_CONFIGURE_OPTS) \
./configure \
--target=$(MFS_ARCH)-linux-uclibc \
--host=$(MFS_ARCH)-linux-uclibc \
--build=$(MFS_ARCH)-linux-gnu \
--prefix=/usr \
--exec-prefix=/usr \
--bindir=/usr/bin \
--sbindir=/usr/sbin \
--libdir=/lib \
--libexecdir=/usr/lib \
--sysconfdir=/etc \
--datadir=/usr/share \
--localstatedir=/var \
--mandir=/usr/man \
--infodir=/usr/info \
$(ETHTOOL_EXTRA_CONFIG) \
)
touch $@
#--enable-elf-shlibs --enable-dynamic-e2fsck --disable-swapfs \
#--enable-elf-shlibs \
$(ETHTOOL_PATH)/ethtool: $(ETHTOOL_PATH)/.config-stamp
PATH=$(STAGING_DIR)/usr/bin:$(PATH) \
CC=$(TARGET_CC) \
$(MAKE) -C $(ETHTOOL_PATH) \
$(TARGET_CONFIGURE_OPTS) LD=$(MFS_ARCH)-linux-uclibc-gcc
touch $@
$(TARGET_PATH)/usr/sbin/ethtool: $(ETHTOOL_PATH)/ethtool
install -d -m 755 $(TARGET_PATH)/usr
install -d -m 755 $(TARGET_PATH)/usr/bin
install -m 755 $(ETHTOOL_PATH)/ethtool \
$(TARGET_PATH)/usr/sbin/ethtool
$(STRIPCMD) --strip-unneeded $(TARGET_PATH)/usr/sbin/ethtool
touch -c $@
......@@ -67,14 +67,13 @@ stop() {
[ $iface = 'lo' ] && continue
ifconfig $iface 0.0.0.0 down
done
rmdir $LOCKDIR
rm -f $SUCCESS_FLAG
cat /dev/null > /etc/resolv.conf
}
restart() {
stop
start
}
}
case "$1" in
start)
......
......@@ -20,20 +20,20 @@ start() {
case $mode in
admin)
script=$BINDIR/rc.mfs
script=$BINDIR/rc/rc.mfs
;;
newnode)
script=$BINDIR/newclient
;;
frisbee)
script=$BINDIR/rc.frisbee
script=$BINDIR/rc/rc.frisbee
;;
*)
echo "Invalid mode \"$mode\"" 1>&2
script=$BINDIR/rc.mfs
script=$BINDIR/rc/rc.mfs
;;
esac
echo "Starting ${script##*/}..."
exec $script
......@@ -44,7 +44,7 @@ stop() {
}
restart() {
:
}
}
case "$1" in
start)
......
......@@ -53,6 +53,14 @@ case "$1" in
echo adding dns $i
echo nameserver $i >> $RESOLV_CONF
done
if [ -n "$hostname" ]; then
hostname $hostname
if [ -x /usr/share/udhcpc/sethostname.dhclient ]; then
/usr/share/udhcpc/sethostname.dhclient
fi
fi
# XXX For now assume that this is the control net.
# The 'true' below should be changed to actually test
# whether this actually is the control net.
......
......@@ -56,9 +56,10 @@ script-install:
mkdir -p $(TARGET_PATH)/var/emulab/boot
mkdir -p $(TARGET_PATH)/var/emulab/db
ln -sf /etc/testbed $(TARGET_PATH)/usr/local/etc/emulab
install -m 755 $(TESTBEDOBJ_PATH)/tmcd/linux/sethostname.dhclient $(TARGET_PATH)/usr/share/udhcpc
install -m 755 $(TMCD_PATH)/linux/control_interface $(TARGET_PATH)/etc/testbed
install -m 755 $(TMCD_PATH)/linux/rc.frisbee $(TARGET_PATH)/etc/testbed
install -m 755 $(TMCD_PATH)/linux/rc.ipod $(TARGET_PATH)/etc/testbed
install -m 755 $(TMCD_PATH)/linux/rc.frisbee $(TARGET_PATH)/etc/testbed/rc
install -m 755 $(TMCD_PATH)/linux/rc.ipod $(TARGET_PATH)/etc/testbed/rc
install -m 755 $(TMCD_PATH)/linux/slicefix $(TARGET_PATH)/etc/testbed
install -m 755 $(TMCD_PATH)/linux/freebsd_to_linux_disk $(TARGET_PATH)/etc/testbed
install -m 755 $(TMCD_PATH)/linux/mount_bsd_slice $(TARGET_PATH)/etc/testbed
......@@ -83,7 +84,7 @@ script-install:
ln -sf /usr/bin/tmcc $(TARGET_PATH)/etc/testbed/tmcc
install -m 755 $(TMCD_PATH)/common/config/librc.pm $(TARGET_PATH)/etc/testbed
install -m 755 $(TMCD_PATH)/common/config/rc.config $(TARGET_PATH)/etc/testbed/rc
install -m 755 $(TMCD_PATH)/linux/rc.mfs $(TARGET_PATH)/etc/testbed
install -m 755 $(TMCD_PATH)/linux/rc.mfs $(TARGET_PATH)/etc/testbed/rc
install -m 755 $(TMCD_PATH)/common/config/rc.misc $(TARGET_PATH)/etc/testbed/rc
install -m 755 $(TMCD_PATH)/common/config/rc.localize $(TARGET_PATH)/etc/testbed/rc
install -m 755 $(TMCD_PATH)/common/config/rc.mounts $(TARGET_PATH)/etc/testbed/rc
......
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