Commit 160a0733 authored by claes's avatar claes

Distribute with SSH insted of RSH

parent e781499c
/*
* Proview $Id: wb_lfu.cpp,v 1.16 2008-06-24 07:48:18 claes Exp $
* Proview $Id: wb_lfu.cpp,v 1.17 2008-06-25 07:56:00 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -633,6 +633,7 @@ pwr_tStatus lfu_SaveDirectoryVolume(
char *bootnode_ptr;
pwr_tUInt32 *os_ptr;
pwr_tUInt32 os;
pwr_tEnum *remote_access_type_ptr;
pwr_tUInt32 *bus_number_ptr;
pwr_tBoolean *single_scan_ptr;
pwr_tFloat32 *scantime_ptr;
......@@ -659,7 +660,7 @@ pwr_tStatus lfu_SaveDirectoryVolume(
trv_tCtx trvctx;
pwr_tObjid distrobjid;
pwr_tVolumeId volume_id;
lfu_eDistrSts distr_status;
pwr_tMask distr_options = 0;
char fname[200];
char path[80];
int path_file_created = 0;
......@@ -1937,6 +1938,15 @@ pwr_tStatus lfu_SaveDirectoryVolume(
os = *os_ptr;
sprintf( os_str, "%d", os);
/* Get RemoteAccessType attribute */
sts = ldh_GetObjectPar( ldhses, nodeobjid, "RtBody",
"RemoteAccessType", (char **)&remote_access_type_ptr, &size);
if ( EVEN(sts)) return sts;
if ( *remote_access_type_ptr == pwr_eRemoteShellEnum_RSH)
distr_options |= lfu_mDistrOpt_RSH;
free( remote_access_type_ptr);
/* Check that there is a rootvolume for this node */
found = 0;
sts = ldh_GetChild( ldhses, nodeobjid, &volobjid);
......@@ -1950,15 +1960,14 @@ pwr_tStatus lfu_SaveDirectoryVolume(
}
sts = ldh_GetNextSibling( ldhses, volobjid, &volobjid);
}
distr_status = lfu_eDistrSts_Normal;
if ( !found)
distr_status = (lfu_eDistrSts)((int)distr_status | lfu_eDistrSts_NoRootVolume);
distr_options = (lfu_mDistrOpt)((int)distr_options | lfu_mDistrOpt_NoRootVolume);
fprintf( file, "node %s %s %d %d %s\n",
nodename_ptr,
os_str,
*bus_number_ptr,
distr_status,
distr_options,
bootnode_ptr);
/* Find the applications for this node */
......@@ -1999,7 +2008,7 @@ pwr_tStatus lfu_SaveDirectoryVolume(
if (EVEN(sts)) return sts;
if ( *components_ptr & lfu_mDistrComponents_LoadFiles &&
!(distr_status & lfu_eDistrSts_NoRootVolume)) {
!(distr_options & lfu_mDistrOpt_NoRootVolume)) {
fprintf( file, "load %s\n", nodename_ptr);
}
if ( *components_ptr & lfu_mDistrComponents_UserDatabase)
......
/*
* Proview $Id: wb_lfu.h,v 1.10 2008-06-24 07:48:18 claes Exp $
* Proview $Id: wb_lfu.h,v 1.11 2008-06-25 07:56:04 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -33,9 +33,9 @@ extern "C" {
#endif
typedef enum {
lfu_eDistrSts_Normal = 0,
lfu_eDistrSts_NoRootVolume = 1 << 0
} lfu_eDistrSts;
lfu_mDistrOpt_NoRootVolume = 1 << 0,
lfu_mDistrOpt_RSH = 1 << 1
} lfu_mDistrOpt;
typedef enum {
lfu_mDistrComponents_UserDatabase = 1 << 0,
......
/*
* Proview $Id: wb_pkg.cpp,v 1.16 2007-01-04 07:29:04 claes Exp $
* Proview $Id: wb_pkg.cpp,v 1.17 2008-06-25 07:56:13 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -83,7 +83,7 @@ void wb_pkg::readConfig()
if ( strcmp( cdh_Low(line_item[0]), "node") == 0) {
pwr_mOpSys opsys;
int bus;
lfu_eDistrSts dstatus;
pwr_tMask dstatus;
char bootnode[80];
if ( !(num == 5 || num == 6))
......@@ -562,16 +562,25 @@ void pkg_node::copyPackage( char *pkg_name)
for ( int i = 0; i < bootnode_cnt; i++) {
dcli_translate_filename( pack_fname, "$pwrp_tmp/pkg_pack.sh");
ofstream of( pack_fname);
of <<
"cd $pwrp_load" << endl <<
"ftp -vin " << bootnodes[i] << " << EOF &>$pwrp_tmp/ftp_" << bootnodes[i] << ".log" << endl <<
"user pwrp pwrp" << endl <<
"binary" << endl <<
"put " << pkg_name << endl <<
"quit" << endl <<
"EOF" << endl <<
"rsh -l pwrp " << bootnodes[i] << " \\$pwr_exe/pwr_pkg.sh -i " << pkg_name << endl;
if ( m_dstatus & lfu_mDistrOpt_RSH) {
// Use ftp and rsh
of <<
"cd $pwrp_load" << endl <<
"ftp -vin " << bootnodes[i] << " << EOF &>$pwrp_tmp/ftp_" << bootnodes[i] << ".log" << endl <<
"user pwrp pwrp" << endl <<
"binary" << endl <<
"put " << pkg_name << endl <<
"quit" << endl <<
"EOF" << endl <<
"rsh -l pwrp " << bootnodes[i] << " \\$pwr_exe/pwr_pkg.sh -i " << pkg_name << endl;
}
else {
// Use scp and SSH
of <<
"cd $pwrp_load" << endl <<
"scp " << pkg_name << " pwrp@" << bootnodes[i] << ":" << endl <<
"ssh pwrp@" << bootnodes[i] << " \\$pwr_exe/pwr_pkg.sh -i " << pkg_name << endl;
}
of.close();
// Execute the pack file
......
/*
* Proview $Id: wb_pkg.h,v 1.7 2007-01-04 07:29:04 claes Exp $
* Proview $Id: wb_pkg.h,v 1.8 2008-06-25 07:56:10 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -109,29 +109,29 @@ class pkg_node {
char m_bootnode[80];
pwr_mOpSys m_opsys;
int m_bus;
lfu_eDistrSts m_dstatus;
pwr_tMask m_dstatus;
bool m_valid;
int m_errors;
int m_warnings;
public:
pkg_node( char *name): m_opsys(pwr_mOpSys__), m_bus(0),
m_dstatus(lfu_eDistrSts_Normal), m_valid(false), m_errors(0), m_warnings(0)
m_dstatus(0), m_valid(false), m_errors(0), m_warnings(0)
{ strcpy( m_name, name); strcpy( m_bootnode, "-");}
pkg_node( char *name, pwr_mOpSys opsys, int bus,
lfu_eDistrSts dstatus, char *bootnode) :
pwr_tMask dstatus, char *bootnode) :
m_opsys(opsys), m_bus(bus), m_dstatus(dstatus),
m_valid(true), m_errors(0), m_warnings(0)
{ strcpy( m_name, name); strcpy( m_bootnode, bootnode);}
char *name() { return m_name;}
pwr_mOpSys opsys() { return m_opsys;}
int bus() { return m_bus;}
lfu_eDistrSts dstatus() { return m_dstatus;}
pwr_tMask dstatus() { return m_dstatus;}
char *bootnode() { return m_bootnode;}
bool valid() { return m_valid;}
void setOpsys( pwr_mOpSys opsys) { m_opsys = opsys;}
void setBus( int bus) { m_bus = bus;}
void setDStatus( lfu_eDistrSts dstatus) { m_dstatus = dstatus;}
void setDStatus( pwr_tMask dstatus) { m_dstatus = dstatus;}
void setBootnode( char *bootnode) { strcpy( m_bootnode, bootnode);}
void setValid() { m_valid = true;}
void push_back( pkg_pattern& pattern) {
......
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