Skip to content
GitLab
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
34595f86
Commit
34595f86
authored
Jan 23, 2014
by
Mike Hibler
Browse files
Handle read-only iSCSI disks: mount them RO if they have a mountpoint.
parent
a35a38a7
Changes
3
Hide whitespace changes
Inline
Side-by-side
clientside/tmcc/common/config/rc.storage
View file @
34595f86
#!/usr/bin/perl -w
#
# Copyright (c) 2004-201
3
University of Utah and the Flux Group.
# Copyright (c) 2004-201
4
University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
...
...
@@ -405,6 +405,9 @@ sub process($$$$)
if
(
!
exists
(
$href
->
{'
PERSIST
'}))
{
$href
->
{'
PERSIST
'}
=
0
;
}
if
(
!
exists
(
$href
->
{'
PERMS
'}))
{
$href
->
{'
PERMS
'}
=
"
RW
";
}
}
elsif
(
$class
eq
"
local
")
{
if
(
$href
->
{'
HOSTID
'}
ne
"
localhost
"
||
...
...
@@ -528,6 +531,9 @@ sub process($$$$)
if
(
$href
->
{'
PERSIST
'})
{
$msg
.=
"
persistent
";
}
if
(
$href
->
{'
PERMS
'}
eq
"
RO
")
{
$msg
.=
"
read-only
";
}
print
"
$msg
iSCSI node attached as
$dev
";
}
}
...
...
@@ -537,7 +543,11 @@ sub process($$$$)
}
}
if
(
$href
->
{'
MOUNTPOINT
'})
{
print
"
mounted on
"
.
$href
->
{'
MOUNTPOINT
'};
my
$w
=
"
RW
";
if
(
$href
->
{'
PERMS
'}
eq
"
RO
")
{
$w
=
"
RO
";
}
print
"
mounted
$w
on
"
.
$href
->
{'
MOUNTPOINT
'};
}
print
"
\n
";
}
else
{
...
...
clientside/tmcc/freebsd/liblocstorage.pm
View file @
34595f86
#!/usr/bin/perl -wT
#
# Copyright (c) 2013 University of Utah and the Flux Group.
# Copyright (c) 2013
-2014
University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
...
...
@@ -912,18 +912,26 @@ sub os_check_storage_element($$)
if
(
$mpoint
)
{
my
$line
=
`
$MOUNT
| grep '^/dev/
$dev
on '
`;
if
(
!
$line
)
{
my
$mopt
=
"";
my
$fopt
=
"
-p
";
# check for RO export and adjust options accordingly
if
(
exists
(
$href
->
{'
PERMS
'})
&&
$href
->
{'
PERMS
'}
eq
"
RO
")
{
$mopt
=
"
-o ro
";
$fopt
=
"
-n
";
}
# the mountpoint should exist
if
(
!
-
d
"
$mpoint
")
{
warn
("
***
$bsid
: no mount point
$mpoint
\n
");
return
-
1
;
}
# fsck it in case of an abrupt shutdown
if
(
mysystem
("
$FSCK
-t ufs
-p
/dev/
$dev
$redir
"))
{
if
(
mysystem
("
$FSCK
$fopt
-t ufs /dev/
$dev
$redir
"))
{
warn
("
***
$bsid
: fsck of /dev/
$dev
failed
\n
");
return
-
1
;
}
# and mount it
if
(
mysystem
("
$MOUNT
-t ufs /dev/
$dev
$mpoint
$redir
"))
{
if
(
mysystem
("
$MOUNT
$mopt
-t ufs /dev/
$dev
$mpoint
$redir
"))
{
warn
("
***
$bsid
: could not mount /dev/
$dev
on
$mpoint
\n
");
return
-
1
;
}
...
...
@@ -1098,6 +1106,9 @@ sub os_create_storage($$)
return
0
;
}
my
$mopt
=
"";
my
$fopt
=
"
-p
";
if
(
exists
(
$href
->
{'
MOUNTPOINT
'})
&&
!
exists
(
$href
->
{'
MOUNTED
'}))
{
my
$lv
=
$href
->
{'
VOLNAME
'};
my
$mdev
=
$href
->
{'
LVDEV
'};
...
...
@@ -1117,7 +1128,12 @@ sub os_create_storage($$)
#
if
(
$href
->
{'
CLASS
'}
eq
"
SAN
"
&&
$href
->
{'
PROTO
'}
eq
"
iSCSI
"
&&
$href
->
{'
PERSIST
'}
!=
0
)
{
if
(
mysystem
("
$FSCK
-t ufs -p
$mdev
$redir
"))
{
# check for RO export and adjust options accordingly
if
(
exists
(
$href
->
{'
PERMS
'})
&&
$href
->
{'
PERMS
'}
eq
"
RO
")
{
$mopt
=
"
-o ro
";
$fopt
=
"
-n
";
}
if
(
mysystem
("
$FSCK
$fopt
-t ufs
$mdev
$redir
"))
{
warn
("
***
$lv
: fsck of persistent store
$mdev
failed
\n
");
return
0
;
}
...
...
@@ -1158,7 +1174,7 @@ sub os_create_storage($$)
return
0
;
}
}
else
{
if
(
mysystem
("
$MOUNT
-t ufs
$mdev
$mpoint
$redir
"))
{
if
(
mysystem
("
$MOUNT
$mopt
-t ufs
$mdev
$mpoint
$redir
"))
{
warn
("
***
$lv
: could not mount
$mdev
on
$mpoint$logmsg
\n
");
return
0
;
}
...
...
clientside/tmcc/linux/liblocstorage.pm
View file @
34595f86
#!/usr/bin/perl -wT
#
# Copyright (c) 2013 University of Utah and the Flux Group.
# Copyright (c) 2013
-2014
University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
...
...
@@ -610,17 +610,26 @@ sub os_check_storage_element($$)
if
(
$mpoint
)
{
my
$line
=
`
$MOUNT
| grep '^/dev/
$dev
on '
`;
if
(
!
$line
)
{
my
$mopt
=
"";
my
$fopt
=
"
-p
";
# check for RO export and adjust options accordingly
if
(
exists
(
$href
->
{'
PERMS
'})
&&
$href
->
{'
PERMS
'}
eq
"
RO
")
{
$mopt
=
"
-o ro
";
$fopt
=
"
-n
";
}
# the mountpoint should exist
if
(
!
-
d
"
$mpoint
")
{
warn
("
***
$bsid
: no mount point
$mpoint
\n
");
return
-
1
;
}
# fsck it in case of an abrupt shutdown
if
(
mysystem
("
$FSCK
-p
/dev/
$dev
$redir
"))
{
if
(
mysystem
("
$FSCK
$fopt
/dev/
$dev
$redir
"))
{
warn
("
***
$bsid
: fsck of /dev/
$dev
failed
\n
");
return
-
1
;
}
if
(
mysystem
("
$MOUNT
/dev/
$dev
$mpoint
$redir
"))
{
if
(
mysystem
("
$MOUNT
$mopt
/dev/
$dev
$mpoint
$redir
"))
{
warn
("
***
$bsid
: could not mount /dev/
$dev
on
$mpoint
\n
");
return
-
1
;
}
...
...
@@ -789,6 +798,9 @@ sub os_create_storage($$)
return
0
;
}
my
$mopt
=
"";
my
$fopt
=
"
-p
";
if
(
exists
(
$href
->
{'
MOUNTPOINT
'}))
{
my
$lv
=
$href
->
{'
VOLNAME
'};
my
$mdev
=
$href
->
{'
LVDEV
'};
...
...
@@ -808,6 +820,11 @@ sub os_create_storage($$)
#
if
(
$href
->
{'
CLASS
'}
eq
"
SAN
"
&&
$href
->
{'
PROTO
'}
eq
"
iSCSI
"
&&
$href
->
{'
PERSIST
'}
!=
0
)
{
# check for RO export and adjust options accordingly
if
(
exists
(
$href
->
{'
PERMS
'})
&&
$href
->
{'
PERMS
'}
eq
"
RO
")
{
$mopt
=
"
-o ro
";
$fopt
=
"
-n
";
}
# figure out what the fstype is
$fstype
=
`
blkid -s TYPE -o value
$mdev
`;
chomp
(
$fstype
);
...
...
@@ -818,7 +835,7 @@ sub os_create_storage($$)
$fstype
=
"
ext4
";
}
if
(
mysystem
("
$FSCK
-p
$mdev
$redir
"))
{
if
(
mysystem
("
$FSCK
$fopt
$mdev
$redir
"))
{
warn
("
***
$lv
: fsck of persistent store
$mdev
failed
\n
");
return
0
;
}
...
...
@@ -880,7 +897,7 @@ sub os_create_storage($$)
return
0
;
}
}
else
{
if
(
mysystem
("
$MOUNT
-t
$fstype
$mdev
$mpoint
$redir
"))
{
if
(
mysystem
("
$MOUNT
$mopt
-t
$fstype
$mdev
$mpoint
$redir
"))
{
warn
("
***
$lv
: could not mount
$mdev
on
$mpoint$logmsg
\n
");
return
0
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment