Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
6ff50f6e
Commit
6ff50f6e
authored
Oct 25, 2010
by
Leigh B Stoller
Browse files
Merge branch 'master' of git-public.flux.utah.edu:/flux/git/emulab-devel
Conflicts: tbsetup/tbswap.in
parents
1d430992
94bcca5a
Changes
13
Hide whitespace changes
Inline
Side-by-side
mfs/linux_mfs/source/target_template/template/etc/init.d/S40network
View file @
6ff50f6e
...
...
@@ -56,6 +56,15 @@ parse_cached_pxe_lease() {
mac
=
"
$value
"
;
;;
esac
done
# elab-in-elab hack: if nameserver is 1.1.1.1, this
# is outer boss's lease. we should ignore it and
# request a new one.
if
[
-n
"
$nameservers
"
]
;
then
for
i
in
$nameservers
;
do
[
$i
=
1.1.1.1
]
&&
return
0
done
fi
for
a
in
/sys/class/net/
*
/address
;
do
addr
=
`
cat
$a
`
...
...
mfs/linux_mfs/source/target_template/template/usr/share/udhcpc/default.script
View file @
6ff50f6e
...
...
@@ -19,6 +19,19 @@ RESOLV_CONF="/etc/resolv.conf"
[
-n
"
$subnet
"
]
&&
NETMASK
=
"netmask
$subnet
"
case
"
$1
"
in
selecting
)
# XXX hack to check for inner boss vs. outer boss
# if the nameserver is 1.1.1.1, it's outer boss,
# and we should try again for a lease from the
# inner boss
if
[
-n
"
$dns
"
]
;
then
for
i
in
$dns
;
do
if
[
$i
=
1.1.1.1
]
;
then
exit
1
fi
done
fi
;;
deconfig
)
/sbin/ifconfig
$interface
0.0.0.0
;;
...
...
@@ -57,10 +70,12 @@ case "$1" in
echo
-n
>
$RESOLV_CONF
[
-n
"
$domain
"
]
&&
echo
search
$domain
>>
$RESOLV_CONF
for
i
in
$dns
;
do
echo
adding dns
$i
echo
nameserver
$i
>>
$RESOLV_CONF
done
if
[
-n
"
$dns
"
]
;
then
for
i
in
$dns
;
do
echo
adding dns
$i
echo
nameserver
$i
>>
$RESOLV_CONF
done
fi
if
[
-n
"
$hostname
"
]
;
then
hostname
$hostname
...
...
os/imagezip/GNUmakefile.in
View file @
6ff50f6e
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-200
9
University of Utah and the Flux Group.
# Copyright (c) 2000-20
1
0 University of Utah and the Flux Group.
# All rights reserved.
#
...
...
@@ -11,8 +11,8 @@ SUBDIR = os/imagezip
DISTFILES = global.h imagehdr.h queue.h sliceinfo.h \
imagedump.c imagedump.8 imagezip.c imagezip.8 \
imageunzip.c crc.c disksize.c imageunzip.8 \
extfs/*.[hc] ext4fs/*.[hc] fat/*.[hc] ffs/*.[hc]
ntfs/*.[hc] shd/*.[hc]
\
hashmap/*.[hc]
extfs/*.[hc] ext4fs/*.[hc] fat/*.[hc] ffs/*.[hc] \
ntfs/*.[hc]
hashmap/*.[hc]
EXPANDCOPYRIGHT = /usr/site/lib/copyright/expand-copyr
...
...
@@ -41,10 +41,6 @@ WITH_LTHREADS = 1
endif
endif
endif
# XXX special checkpoint/shadow device support
WITH_SHD = 0
endif
# Linux specific goop
...
...
@@ -145,14 +141,6 @@ SUBDIRS += fat
ZIPLIBS += fat/libfat.a
endif
# with SHD
ifeq ($(WITH_SHD),1)
CFLAGS += -DWITH_SHD
SUBDIRS += shd
ZIPLIBS += shd/libshd.a
SHDLIBS += shd/libshd.a
endif
# with HASH
ifeq ($(WITH_HASH),1)
CFLAGS += -DWITH_HASH -DHASHSTATS
...
...
@@ -185,8 +173,8 @@ imageunzip: imageunzip.o disksize.o crc.o version.o
imageunzip.o: imageunzip.c
$(CC) -c $(UNZIPCFLAGS) -o imageunzip.o $<
imagedump: imagedump.o version.o
$(SHDLIBS)
$(CC) $(CFLAGS) imagedump.o version.o $(LIBS)
$(SHDLIBS)
-o imagedump
imagedump: imagedump.o version.o
$(CC) $(CFLAGS) imagedump.o version.o $(LIBS) -o imagedump
imagehash: imagehash.o version.o
$(CC) $(CFLAGS) imagehash.o version.o $(HASHLIBS) -o imagehash
...
...
@@ -194,7 +182,7 @@ imagehash: imagehash.o version.o
imagehash.o: imagehash.c
$(CC) -c $(HASHCFLAGS) -o imagehash.o $<
ffs extfs ext4fs ntfs fat shd hashmap
:
$(SUBDIRS)
:
@$(MAKE) SUBDIRCFLAGS="$(SUBDIRCFLAGS)" -C $@ all
imagezip.o: sliceinfo.h imagehdr.h global.h
...
...
@@ -243,4 +231,4 @@ imagezip.tar: Makefile.sa Makefile-linux.sa
tar cf imagezip.tar imagezip-dist
rm -rf imagezip-dist
.PHONY:
$(SUBDIRS)
.PHONY:
$(SUBDIRS)
os/imagezip/imagedump.c
View file @
6ff50f6e
...
...
@@ -55,12 +55,6 @@ static int dumpchunk(char *name, char *buf, int chunkno, int checkindex);
static
void
dumpchunkhash
(
char
*
name
,
char
*
buf
,
int
chunkno
,
int
checkindex
);
#endif
#ifdef WITH_SHD
void
add_shdrange
(
u_int32_t
start
,
u_int32_t
size
);
int
write_shd
(
char
*
shddev
);
int
debug
=
0
;
#endif
#define SECTOBYTES(s) ((unsigned long long)(s) * SECSIZE)
int
...
...
@@ -288,13 +282,6 @@ dumpfile(char *name, int fd)
}
done:
#ifdef WITH_SHD
if
(
chkpointdev
&&
write_shd
(
chkpointdev
))
{
fprintf
(
stderr
,
"Could not record SHD alloc block info
\n
"
);
exit
(
1
);
}
#endif
if
(
filesize
==
0
)
filesize
=
(
off_t
)(
chunkno
+
1
)
*
CHUNKSIZE
;
...
...
@@ -505,14 +492,6 @@ dumpchunk(char *name, char *buf, int chunkno, int checkindex)
franges
++
;
}
#ifdef WITH_SHD
/*
* Accumulate SHD allocated list info
*/
if
(
chkpointdev
)
add_shdrange
(
reg
->
start
,
reg
->
size
);
#endif
count
=
reg
->
size
;
sectinuse
+=
count
;
if
(
count
<
amin
)
...
...
os/imagezip/imagezip.c
View file @
6ff50f6e
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2000-200
9
University of Utah and the Flux Group.
* Copyright (c) 2000-20
1
0 University of Utah and the Flux Group.
* All rights reserved.
*/
...
...
@@ -61,10 +61,6 @@ int filemode = 0;
off_t
datawritten
;
partmap_t
ignore
,
forceraw
;
#ifdef WITH_SHD
char
*
chkpointdev
;
#endif
#ifdef WITH_HASH
char
*
hashfile
;
#endif
...
...
@@ -119,11 +115,6 @@ int read_raw(void);
int
compress_image
(
void
);
void
usage
(
void
);
#ifdef WITH_SHD
int
read_shd
(
char
*
shddev
,
char
*
infile
,
int
infd
,
u_int32_t
ssect
,
void
(
*
add
)(
uint32_t
,
uint32_t
));
#endif
#ifdef WITH_HASH
struct
range
*
hashmap_compute_delta
(
struct
range
*
,
char
*
,
int
,
u_int32_t
);
void
report_hash_stats
(
int
pnum
);
...
...
@@ -379,7 +370,7 @@ main(int argc, char *argv[])
extern
char
build_info
[];
gettimeofday
(
&
sstamp
,
0
);
while
((
ch
=
getopt
(
argc
,
argv
,
"vlbnNdihrs:c:z:ofI:1F:DR:S:X
C:
H:M"
))
!=
-
1
)
while
((
ch
=
getopt
(
argc
,
argv
,
"vlbnNdihrs:c:z:ofI:1F:DR:S:XH:M"
))
!=
-
1
)
switch
(
ch
)
{
case
'v'
:
version
++
;
...
...
@@ -447,14 +438,6 @@ main(int argc, char *argv[])
case
'X'
:
forcereads
++
;
break
;
case
'C'
:
#ifdef WITH_SHD
chkpointdev
=
optarg
;
#else
fprintf
(
stderr
,
"'C' option not supported
\n
"
);
usage
();
#endif
break
;
case
'H'
:
#ifdef WITH_HASH
hashfile
=
optarg
;
...
...
@@ -487,9 +470,6 @@ main(int argc, char *argv[])
fprintf
(
stderr
,
"%c %s"
,
ch
>
1
?
','
:
':'
,
fsmap
[
ch
].
desc
);
#ifdef WITH_SHD
fprintf
(
stderr
,
", SHD device"
);
#endif
#ifdef WITH_HASH
fprintf
(
stderr
,
", hash-signature comparison"
);
#endif
...
...
@@ -538,73 +518,33 @@ main(int argc, char *argv[])
inputmaxsec = getdisksize(infd);
#endif
#ifdef WITH_SHD
if
(
chkpointdev
)
{
rval
=
0
;
if
(
dorelocs
)
{
fprintf
(
stderr
,
"WARNING: no relocation info "
"generated for checkpoint images
\n
"
);
dorelocs
=
0
;
}
/*
* Slice indicates the slice shadowed for checkpointing.
* XXX we need this right now to determine the offset of
* the block numbers returned by the shd device.
*/
if
(
slicemode
)
{
struct
doslabel
doslabel
;
rval
=
read_doslabel
(
infd
,
DOSBBSECTOR
,
0
,
&
doslabel
);
if
(
rval
==
0
)
{
inputminsec
=
doslabel
.
parts
[
slice
-
1
].
dp_start
;
inputmaxsec
=
inputminsec
+
doslabel
.
parts
[
slice
-
1
].
dp_size
;
}
}
if
(
rval
==
0
)
{
rval
=
read_shd
(
chkpointdev
,
infilename
,
infd
,
inputminsec
,
addvalid
);
if
(
rval
==
0
)
sortrange
(
&
ranges
,
1
,
0
);
}
if
(
rval
)
{
fprintf
(
stderr
,
"* * * Aborting * * *
\n
"
);
exit
(
1
);
}
}
else
#endif
{
/*
* Create the skip list by scanning the filesystems on
* the disk or indicated partition.
*/
if
(
slicetype
!=
0
)
{
rval
=
read_slice
(
-
1
,
slicetype
,
0
,
0
,
infilename
,
infd
);
if
(
rval
==
-
1
)
fprintf
(
stderr
,
", cannot process
\n
"
);
}
else
if
(
rawmode
)
rval
=
read_raw
();
else
rval
=
read_image
(
DOSBBSECTOR
,
0
,
0
);
if
(
rval
)
{
fprintf
(
stderr
,
"* * * Aborting * * *
\n
"
);
exit
(
1
);
}
/*
* Create a valid range list from the skip list
*/
(
void
)
mergeskips
(
debug
>
1
);
if
(
debug
)
dumpskips
(
debug
>
1
);
makeranges
();
/*
* Create the skip list by scanning the filesystems on
* the disk or indicated partition.
*/
if
(
slicetype
!=
0
)
{
rval
=
read_slice
(
-
1
,
slicetype
,
0
,
0
,
infilename
,
infd
);
if
(
rval
==
-
1
)
fprintf
(
stderr
,
", cannot process
\n
"
);
}
else
if
(
rawmode
)
rval
=
read_raw
();
else
rval
=
read_image
(
DOSBBSECTOR
,
0
,
0
);
if
(
rval
)
{
fprintf
(
stderr
,
"* * * Aborting * * *
\n
"
);
exit
(
1
);
}
/*
* Create a valid range list from the skip list
*/
(
void
)
mergeskips
(
debug
>
1
);
if
(
debug
)
dumpskips
(
debug
>
1
);
makeranges
();
if
(
debug
)
dumpranges
(
debug
>
1
);
sortrange
(
&
fixups
,
0
,
cmpfixups
);
if
(
debug
>
1
)
dumpfixups
(
debug
>
2
);
...
...
@@ -746,9 +686,9 @@ read_doslabel(int infd, int lsect, int pstart, struct doslabel *label)
fprintf
(
stderr
,
" P%d: "
,
bsdix
+
1
);
smap
=
getslicemap
(
label
->
parts
[
i
].
dp_typ
);
if
(
smap
==
0
)
fprintf
(
stderr
,
"%-1
0
s"
,
"UNKNOWN"
);
fprintf
(
stderr
,
"%-1
2
s"
,
"UNKNOWN"
);
else
fprintf
(
stderr
,
"%-1
0
s"
,
smap
->
desc
);
fprintf
(
stderr
,
"%-1
2
s"
,
smap
->
desc
);
start
=
label
->
parts
[
i
].
dp_start
;
#if 0
...
...
@@ -780,6 +720,35 @@ read_image(u_int32_t bbstart, int pstart, u_int32_t extstart)
if
(
read_doslabel
(
infd
,
bbstart
,
pstart
,
&
doslabel
)
!=
0
)
return
1
;
/*
* Quick, brute-force check for overlap of partitions.
* XXX right now, any overlap is bad and we bail. In the future,
* we could determine all areas of intersection and be conservative
* with those areas; i.e., always save unless overlap is strictly
* between unused/ignored partitions.
*/
for
(
i
=
0
;
i
<
NDOSPART
-
1
;
i
++
)
{
u_int32_t
start1
,
size1
,
start2
,
size2
;
int
i2
;
if
((
size1
=
doslabel
.
parts
[
i
].
dp_size
)
==
0
)
continue
;
start1
=
bbstart
+
doslabel
.
parts
[
i
].
dp_start
;
for
(
i2
=
i
+
1
;
i2
<
NDOSPART
;
i2
++
)
{
if
((
size2
=
doslabel
.
parts
[
i2
].
dp_size
)
==
0
)
continue
;
start2
=
bbstart
+
doslabel
.
parts
[
i2
].
dp_start
;
if
(
start2
+
size2
>
start1
&&
start1
+
size1
>
start2
)
{
warnx
(
"P%d and P%d overlap!"
,
i
+
1
,
i2
+
1
);
rval
++
;
}
}
}
if
(
rval
)
return
1
;
/*
* Now operate on individual slices.
*/
...
...
os/imagezip/shd/GNUmakefile.in
deleted
100644 → 0
View file @
1d430992
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# All rights reserved.
#
SRCDIR = @srcdir@
TESTBED_SRCDIR = @top_srcdir@
OBJDIR = ../../..
SUBDIR = os/imagezip/shd
MAINDIR = $(SRCDIR)/..
include $(OBJDIR)/Makeconf
CFLAGS += $(SUBDIRCFLAGS) -I$(MAINDIR) -I$(SRCDIR)
all: libshd.a
include $(TESTBED_SRCDIR)/GNUmakerules
OBJS = shd.o
shd.o: shd.h
shd.o: $(MAINDIR)/global.h $(MAINDIR)/sliceinfo.h $(MAINDIR)/imagehdr.h
libshd.a: $(OBJS)
$(AR) $(ARFLAGS) $@ $?
$(RANLIB) $@
install:
clean:
rm -f libshd.a $(OBJS)
os/imagezip/shd/shd.c
deleted
100644 → 0
View file @
1d430992
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2005 University of Utah and the Flux Group.
* All rights reserved.
*/
/*
* Support for extracting a changed block list from the shadow/checkpoint
* device driver.
*
* Open the indicated device and make repeated ioctl calls to extract the
* changed block info.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <assert.h>
#include <sys/ioctl.h>
#include "shd.h"
#include "sliceinfo.h"
#include "global.h"
#include "imagehdr.h"
#define ENTRIESPERCALL 1024
#ifdef FAKEIT
#define SHDIOCTL fake_ioctl
int
fake_ioctl
(
int
,
int
,
void
*
);
#else
#define SHDIOCTL ioctl
#endif
int
read_shd
(
char
*
shddev
,
char
*
infile
,
int
infd
,
u_int32_t
ssect
,
void
(
*
addvalid
)(
u_int32_t
,
u_int32_t
))
{
int
shdfd
;
struct
shd_modinfo
sm
;
sm
.
bufsiz
=
ENTRIESPERCALL
;
sm
.
buf
=
malloc
(
sm
.
bufsiz
*
sizeof
(
struct
shd_range
));
if
(
sm
.
buf
==
0
)
{
fprintf
(
stderr
,
"No memory for SHD ranges
\n
"
);
return
1
;
}
/*
* Open the shd device so we can ioctl
*/
shdfd
=
open
(
shddev
,
O_RDONLY
,
0
);
if
(
shdfd
<
0
)
{
perror
(
shddev
);
return
1
;
}
/*
* Initialize the iterator (and return the first set of entries)
*/
sm
.
command
=
1
;
if
(
SHDIOCTL
(
shdfd
,
SHDGETMODIFIEDRANGES
,
&
sm
)
<
0
)
{
perror
(
shddev
);
close
(
shdfd
);
return
1
;
}
/*
* Loop extracting changed block ranges and creating imagezip
* block ranges.
*/
while
(
sm
.
retsiz
>
0
)
{
struct
shd_range
*
sr
=
sm
.
buf
;
if
(
debug
>
1
)
fprintf
(
stderr
,
"GETRANGES returns %ld ranges:
\n
"
,
sm
.
retsiz
);
for
(
sr
=
sm
.
buf
;
sm
.
retsiz
>
0
;
sr
++
,
sm
.
retsiz
--
)
{
if
(
debug
>
2
)
fprintf
(
stderr
,
" %12d %9d
\n
"
,
sr
->
start
,
(
sr
->
end
-
sr
->
start
));
(
*
addvalid
)(
sr
->
start
+
ssect
,
(
sr
->
end
-
sr
->
start
));
}
sm
.
command
=
2
;
if
(
SHDIOCTL
(
shdfd
,
SHDGETMODIFIEDRANGES
,
&
sm
)
<
0
)
{
perror
(
shddev
);
close
(
shdfd
);
/* XXX should flush the valid table */
return
1
;
}
}
sm
.
command
=
3
;
(
void
)
SHDIOCTL
(
shdfd
,
SHDGETMODIFIEDRANGES
,
&
sm
);
close
(
shdfd
);
return
0
;
}
static
struct
shd_allocinfo
alloclist
;
int
write_shd
(
char
*
shddev
)
{
int
shdfd
;
if
(
alloclist
.
buf
==
0
||
alloclist
.
bufsiz
==
0
)
return
0
;
/*
* Open the shd device so we can ioctl
*/
shdfd
=
open
(
shddev
,
O_RDWR
);
if
(
shdfd
<
0
)
{
perror
(
shddev
);
return
1
;
}
if
(
SHDIOCTL
(
shdfd
,
SHDSETALLOCATEDRANGES
,
&
alloclist
)
<
0
)
{
perror
(
shddev
);
close
(
shdfd
);
return
1
;
}
close
(
shdfd
);
free
(
alloclist
.
buf
);
alloclist
.
buf
=
0
;
alloclist
.
bufsiz
=
0
;
return
0
;
}
void
add_shdrange
(
u_int32_t
start
,
u_int32_t
size
)
{
size_t
nsize
=
(
alloclist
.
bufsiz
+
1
)
*
sizeof
(
struct
shd_range
);
alloclist
.
buf
=
realloc
(
alloclist
.
buf
,
nsize
);
if
(
alloclist
.
buf
==
0
)
{
fprintf
(
stderr
,
"No memory for SHD alloc ranges
\n
"
);
exit
(
1
);
}
alloclist
.
buf
[
alloclist
.
bufsiz
].
start
=
start
;
alloclist
.
buf
[
alloclist
.
bufsiz
].
end
=
start
+
size
;
alloclist
.
bufsiz
++
;
}
#ifdef FAKEIT
struct
shd_range
foo
[]
=
{
{
110427
,
4
},
{
2410487
,
8
},
{
2564819
,
12
},
{
2862827
,
16
},
{
2774027
,
20
},
{
4277895
,
24
},
{
3853567
,
28
},
{
2372447
,
32
},
{
12352615
,
40
},
{
5428223
,
44
},
{
2436383
,
48
},
{
2602463
,
52
},
{
11039151
,
56
},
{
4774459
,
68
},
{
10265207
,
88
},
{
4409343
,
120
},
{
4387795
,
204
},
{
11033303
,
408
},
{
9786815
,
1040
},
{
2361715
,
1056
},
{
8139631
,
1752
},
{
9795103
,
11808
},
{
4499231
,
104368
},
{
11832015
,
112032
},
{
9076719
,
115560
},
{
9307719
,
123600
},
{
5598591
,
130240
},
{
0
,
0
}
};
int
fake_ioctl
(
int
fd
,
int
cmd
,
void
*
data
)
{
static
struct
shd_range
*
fooptr
,
*
out
;
int
i
;
switch
(
cmd
)
{
case
SHDGETMODIFIEDRANGES
:
{
struct
shd_modinfo
*
sm
=
data
;
switch
(
sm
->
command
)
{
case
1
:
fooptr
=
foo
;
case
2
:
out
=
sm
->
buf
;
for
(
i
=
0
;
i
<
sm
->
bufsiz
;
i
++
)
{
if
(
fooptr
->
start
==
0
&&
fooptr
->
end
==
0
)
break
;
out
->
start
=
fooptr
->
start
;
out
->
end
=
fooptr
->
start
+
fooptr
->
end
;
fooptr
++
,
out
++
;
}
sm
->
retsiz
=
i
;
break
;
case
3
:
break
;
}
return
0
;
}
case
SHDSETALLOCATEDRANGES
:
{
struct
shd_allocinfo
*
sa
=
data
;
int
i
;
printf
(
"SETALLOCATEDRANGES: %ld entries:
\n
"
,
sa
->
bufsiz
);
out
=
sa
->
buf
;
for
(
i
=
0
;
i
<
sa
->
bufsiz
;
i
++
)
{
printf
(
" [%u-%u]
\n
"
,
out
->
start
,
out
->
end
);
out