Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
d69b9873
Commit
d69b9873
authored
Sep 18, 2013
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Loadfile version check when node is built (refs #140)
parent
d935e2c2
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
191 additions
and
7 deletions
+191
-7
src/msg/wb/src/wb_ldh_msg.msg
src/msg/wb/src/wb_ldh_msg.msg
+2
-0
wb/lib/wb/src/wb_build.cpp
wb/lib/wb/src/wb_build.cpp
+9
-0
wb/lib/wb/src/wb_erep.cpp
wb/lib/wb/src/wb_erep.cpp
+140
-0
wb/lib/wb/src/wb_erep.h
wb/lib/wb/src/wb_erep.h
+20
-1
wb/lib/wb/src/wb_pkg.cpp
wb/lib/wb/src/wb_pkg.cpp
+5
-5
wb/lib/wb/src/wb_wnav_command.cpp
wb/lib/wb/src/wb_wnav_command.cpp
+15
-1
No files found.
src/msg/wb/src/wb_ldh_msg.msg
View file @
d69b9873
...
...
@@ -152,3 +152,5 @@ maxwblfiles <Max number of wb_load files exceeded> /error
compsyntax <Configure component syntax error> /error
numaref <Attribute referens in numeric format> /info
numobjid <Objid in numeric format> /info
volversion <Volume version mismatch> /error
volerr <Volume check errors> /error
wb/lib/wb/src/wb_build.cpp
View file @
d69b9873
...
...
@@ -181,7 +181,16 @@ void wb_build::node( char *nodename, void *volumelist, int volumecnt)
}
wb_log
::
pull
();
if
(
m_wnav
&&
m_wnav
->
ldhses
)
{
wb_erep
*
erep
=
*
(
wb_env
*
)
ldh_SessionToWB
(
m_wnav
->
ldhses
);
erep
->
checkVolumes
(
&
m_sts
,
nodename
);
if
(
evenSts
())
return
;
}
if
(
opt
.
force
||
opt
.
manual
||
rebuild
)
{
m_sts
=
lfu_create_bootfile
(
nodename
,
(
lfu_t_volumelist
*
)
volumelist
,
volumecnt
,
opt
.
debug
);
if
(
ODD
(
m_sts
))
...
...
wb/lib/wb/src/wb_erep.cpp
View file @
d69b9873
...
...
@@ -1327,3 +1327,143 @@ bool wb_erep::check_lock( char *name, ldh_eVolDb type)
dcli_translate_filename
(
vname
,
vname
);
return
wb_dblock
::
check
(
vname
);
}
void
wb_erep
::
checkVolume
(
pwr_tStatus
*
sts
,
pwr_tVid
vid
,
vector
<
wb_volcheck
>
&
carray
,
int
*
err_cnt
)
{
lfu_t_volref
*
volref
;
int
volref_cnt
;
pwr_tFileName
fname
;
wb_vrep
*
vol
=
volume
(
sts
,
vid
);
if
(
EVEN
(
*
sts
))
{
MsgWindow
::
message
(
'E'
,
"Volume not loaded: "
,
cdh_VolumeIdToString
(
0
,
vid
,
0
,
0
));
(
*
err_cnt
)
++
;
return
;
}
wb_volcheck
vcheck
;
switch
(
vol
->
type
())
{
case
ldh_eVolRep_Dbs
:
{
vcheck
.
m_vid
=
vid
;
vcheck
.
m_time
=
((
wb_vrepdbs
*
)
vol
)
->
m_dbsvep
->
vp
->
time
;
strcpy
(
vcheck
.
m_vname
,
vol
->
name
());
strcpy
(
vcheck
.
m_filename
,
vol
->
fileName
());
break
;
}
case
ldh_eVolRep_Wbl
:
case
ldh_eVolRep_Db
:
case
ldh_eVolRep_Dbms
:
{
// Find dbs-file on $pwrp_load
pwr_tFileName
filestr
;
pwr_tVid
vol_vid
;
pwr_tCid
vol_cid
;
pwr_tTime
vol_time
;
pwr_tObjName
vol_name
;
volumeNameToFilename
(
sts
,
(
char
*
)
vol
->
name
(),
filestr
);
*
sts
=
lfu_GetVolume
(
filestr
,
vol_name
,
&
vol_vid
,
&
vol_cid
,
&
vol_time
);
if
(
EVEN
(
*
sts
))
{
MsgWindow
::
message
(
'E'
,
"Dbs file not found for volume "
,
cdh_VolumeIdToString
(
0
,
vid
,
0
,
0
));
(
*
err_cnt
)
++
;
return
;
}
vcheck
.
m_vid
=
vid
;
vcheck
.
m_time
=
vol_time
;
strcpy
(
vcheck
.
m_vname
,
vol
->
name
());
strcpy
(
vcheck
.
m_filename
,
filestr
);
break
;
}
default:
MsgWindow
::
message
(
'E'
,
"Strange volume type: "
,
cdh_VolumeIdToString
(
0
,
vid
,
0
,
0
));
(
*
err_cnt
)
++
;
}
// Check if volume is stored
bool
found
=
false
;
for
(
int
i
=
0
;
i
<
(
int
)
carray
.
size
();
i
++
)
{
if
(
carray
[
i
].
m_vid
==
vcheck
.
m_vid
)
{
found
=
true
;
if
(
carray
[
i
].
m_time
.
tv_sec
!=
vcheck
.
m_time
.
tv_sec
)
{
char
msg
[
200
];
sprintf
(
msg
,
"Version mismatch volume %s in %s and %s"
,
vcheck
.
m_vname
,
vcheck
.
m_filename
,
carray
[
i
].
m_filename
);
MsgWindow
::
message
(
'E'
,
msg
,
msgw_ePop_No
);
(
*
err_cnt
)
++
;
*
sts
=
LDH__VOLVERSION
;
}
}
}
if
(
!
found
)
carray
.
push_back
(
vcheck
);
if
(
vol
->
cid
()
==
pwr_eClass_DetachedClassVolume
)
// No check of referenced volumes
return
;
*
sts
=
lfu_GetVolRef
(
vcheck
.
m_filename
,
&
volref
,
&
volref_cnt
);
if
(
EVEN
(
*
sts
))
return
;
for
(
int
i
=
0
;
i
<
volref_cnt
;
i
++
)
{
volumeNameToFilename
(
sts
,
volref
[
i
].
name
,
fname
);
if
(
EVEN
(
*
sts
))
{
char
msg
[
200
];
sprintf
(
msg
,
"Loadfile not found: %s"
,
volref
[
i
].
name
);
MsgWindow
::
message
(
'E'
,
msg
,
msgw_ePop_No
);
(
*
err_cnt
)
++
;
continue
;
}
checkVolume
(
sts
,
volref
[
i
].
vid
,
carray
,
err_cnt
);
for
(
int
j
=
0
;
j
<
(
int
)
carray
.
size
();
j
++
)
{
if
(
carray
[
j
].
m_vid
==
volref
[
i
].
vid
)
{
if
(
carray
[
j
].
m_time
.
tv_sec
!=
volref
[
i
].
version
.
tv_sec
)
{
char
msg
[
200
];
sprintf
(
msg
,
"Version mismatch volume %s in %s and %s"
,
volref
[
i
].
name
,
vcheck
.
m_filename
,
carray
[
j
].
m_filename
);
MsgWindow
::
message
(
'E'
,
msg
,
msgw_ePop_No
);
(
*
err_cnt
)
++
;
*
sts
=
LDH__VOLVERSION
;
}
break
;
}
}
}
free
(
(
char
*
)
volref
);
}
void
wb_erep
::
checkVolumes
(
pwr_tStatus
*
sts
,
char
*
nodeconfigname
)
{
lfu_t_volumelist
*
vollist
;
int
volcnt
;
vector
<
wb_volcheck
>
carray
;
int
err_cnt
=
0
;
// Load the bootlist
*
sts
=
lfu_volumelist_load
(
load_cNameBootList
,
&
vollist
,
&
volcnt
);
if
(
EVEN
(
*
sts
))
return
;
bool
found
=
false
;
for
(
int
i
=
0
;
i
<
volcnt
;
i
++
)
{
if
(
cdh_NoCaseStrcmp
(
vollist
[
i
].
p1
,
nodeconfigname
)
==
0
)
{
found
=
true
;
checkVolume
(
sts
,
vollist
[
i
].
volume_id
,
carray
,
&
err_cnt
);
}
}
if
(
!
found
)
{
char
msg
[
200
];
sprintf
(
msg
,
"No root volume found for node %s"
,
nodeconfigname
);
MsgWindow
::
message
(
'E'
,
msg
,
msgw_ePop_Yes
);
*
sts
=
LDH__NOSUCHVOL
;
}
if
(
err_cnt
)
{
MsgWindow
::
map_default
();
*
sts
=
LDH__VOLERR
;
}
}
wb/lib/wb/src/wb_erep.h
View file @
d69b9873
...
...
@@ -40,18 +40,36 @@
#include <map>
#include <string>
#include <vector>
#include <string.h>
#include "wb_pwrs.h"
using
namespace
std
;
class
wb_merep
;
class
wb_vrep
;
class
wb_cdrep
;
class
wb_orep
;
class
wb_tdrep
;
class
wb_adrep
;
class
wb_name
;
class
wb_volcheck
{
public:
wb_volcheck
()
{}
wb_volcheck
(
char
*
vname
,
char
*
filename
,
pwr_tVid
vid
,
pwr_tTime
time
)
:
m_vid
(
vid
),
m_time
(
time
)
{
strncpy
(
m_vname
,
vname
,
sizeof
(
m_vname
));
strncpy
(
m_filename
,
filename
,
sizeof
(
m_filename
));
}
char
m_vname
[
80
];
char
m_filename
[
80
];
pwr_tVid
m_vid
;
pwr_tTime
m_time
;
};
class
wb_erep
{
typedef
map
<
pwr_tVid
,
wb_vrep
*>::
iterator
vrep_iterator
;
...
...
@@ -114,7 +132,7 @@ public:
bool
refMerepOccupied
()
{
return
m_ref_merep_occupied
;}
void
printMethods
();
bool
check_lock
(
char
*
name
,
ldh_eVolDb
type
);
void
checkVolumes
(
pwr_tStatus
*
sts
,
char
*
nodeconfigname
);
static
void
volumeNameToFilename
(
pwr_tStatus
*
sts
,
char
*
name
,
char
*
filename
);
private:
...
...
@@ -123,6 +141,7 @@ private:
void
loadMeta
(
pwr_tStatus
*
status
,
char
*
db
);
void
loadLocalWb
(
pwr_tStatus
*
sts
);
void
bindMethods
();
void
checkVolume
(
pwr_tStatus
*
sts
,
pwr_tVid
vid
,
vector
<
wb_volcheck
>
&
carray
,
int
*
err_cnt
);
static
void
at_exit
();
};
...
...
wb/lib/wb/src/wb_pkg.cpp
View file @
d69b9873
...
...
@@ -339,10 +339,6 @@ void pkg_node::checkVolume( char *filename)
sts
=
lfu_GetVolume
(
filename
,
vol_name
,
&
vol_vid
,
&
vol_cid
,
&
vol_time
);
if
(
EVEN
(
sts
))
throw
wb_error
(
sts
);
if
(
vol_cid
==
pwr_eClass_DetachedClassVolume
)
// No check
return
;
found
=
false
;
for
(
int
i
=
0
;
i
<
(
int
)
m_volumelist
.
size
();
i
++
)
{
if
(
m_volumelist
[
i
].
m_vid
==
vol_vid
)
{
...
...
@@ -361,6 +357,10 @@ void pkg_node::checkVolume( char *filename)
m_volumelist
.
push_back
(
vol
);
}
if
(
vol_cid
==
pwr_eClass_DetachedClassVolume
)
// No check of referenced volumes
return
;
sts
=
lfu_GetVolRef
(
filename
,
&
volref
,
&
volref_cnt
);
if
(
EVEN
(
sts
))
throw
wb_error
(
sts
);
...
...
@@ -380,7 +380,7 @@ void pkg_node::checkVolume( char *filename)
if
(
m_volumelist
[
j
].
m_vid
==
(
volref
+
i
)
->
vid
)
{
if
(
m_volumelist
[
j
].
m_time
.
tv_sec
!=
(
volref
+
i
)
->
version
.
tv_sec
)
{
char
msg
[
200
];
sprintf
(
msg
,
"Version mismatch volume %s in %s
"
,
(
volref
+
i
)
->
name
,
filename
);
sprintf
(
msg
,
"Version mismatch volume %s in %s
and %s"
,
(
volref
+
i
)
->
name
,
filename
,
m_volumelist
[
j
].
m_
filename
);
MsgWindow
::
message
(
'E'
,
msg
,
msgw_ePop_No
);
m_errors
++
;
}
...
...
wb/lib/wb/src/wb_wnav_command.cpp
View file @
d69b9873
...
...
@@ -454,7 +454,7 @@ dcli_tCmdTable wnav_command_table[] = {
{
"CHECK"
,
&
wnav_check_func
,
{
"dcli_arg1"
,
"/VOLUME"
,
"/NAME"
,
""
}
{
"dcli_arg1"
,
"/VOLUME"
,
"/NAME"
,
"
/NODE"
,
"
"
}
},
{
"UPDATE"
,
...
...
@@ -5197,6 +5197,20 @@ static int wnav_check_func( void *client_data,
wnav
->
message
(
'I'
,
"Successfull syntax check, no errors or warnings found"
);
}
}
else
if
(
cdh_NoCaseStrncmp
(
arg1_str
,
"BOOTFILE"
,
strlen
(
arg1_str
))
==
0
)
{
char
nodestr
[
80
];
wb_erep
*
erep
=
*
(
wb_env
*
)
wnav
->
wbctx
;
if
(
EVEN
(
dcli_get_qualifier
(
"/NODE"
,
nodestr
,
sizeof
(
nodestr
))))
{
wnav
->
message
(
'E'
,
"Syntax error"
);
return
WNAV__SYNTAX
;
}
erep
->
checkVolumes
(
&
sts
,
nodestr
);
if
(
EVEN
(
sts
))
wnav
->
message
(
' '
,
wnav_get_message
(
sts
));
else
wnav
->
message
(
'I'
,
"Bootfile check successful"
);
}
else
{
wnav
->
message
(
'E'
,
"Syntax error"
);
return
WNAV__SYNTAX
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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