From mboxrd@z Thu Jan 1 00:00:00 1970 From: rmccabe@sourceware.org Date: 12 May 2008 15:13:36 -0000 Subject: [Cluster-devel] conga ./clustermon.spec.in.in ./conga.spec.in. ... Message-ID: <20080512151336.21607.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: conga Branch: RHEL5 Changes by: rmccabe at sourceware.org 2008-05-12 15:13:33 Modified files: . : clustermon.spec.in.in conga.spec.in.in luci/site/luci/Extensions: ricci_communicator.py make : version.in ricci/common : File.cpp Variable.cpp daemon_init.c utils.cpp ricci/include : shred_allocator.h ricci/init.d : ricci ricci/modules/cluster/clumon: Makefile ricci/modules/cluster/clumon/init.d: modclusterd ricci/modules/cluster/clumon/src/common: Cluster.cpp ricci/modules/storage: ContentFS.cpp ExtendedFS.cpp LV.cpp Mapper.cpp MountHandler.cpp PTSource.cpp PV.cpp Partition.cpp PartitionTable.cpp parted_wrapper.cpp Log message: Fixes from HEAD Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/clustermon.spec.in.in.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.18.2.37&r2=1.18.2.38 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/conga.spec.in.in.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.45.2.84&r2=1.45.2.85 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_communicator.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.9.2.14&r2=1.9.2.15 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/make/version.in.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.21.2.38&r2=1.21.2.39 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/common/File.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.4&r2=1.1.2.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/common/Variable.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.8.2.1&r2=1.8.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/common/daemon_init.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.1&r2=1.1.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/common/utils.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.6.2.2&r2=1.6.2.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/include/shred_allocator.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.2.2.1&r2=1.2.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/init.d/ricci.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.8.2.4&r2=1.8.2.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/Makefile.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.2&r2=1.4.2.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/init.d/modclusterd.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.2.2.2&r2=1.2.2.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/common/Cluster.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.6.2.2&r2=1.6.2.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/ContentFS.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.5.2.1&r2=1.5.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/ExtendedFS.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.7.2.2&r2=1.7.2.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/LV.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.6.2.4&r2=1.6.2.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/Mapper.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.3.2.1&r2=1.3.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/MountHandler.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.5.2.2&r2=1.5.2.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/PTSource.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.2.2.1&r2=1.2.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/PV.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.3&r2=1.4.2.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/Partition.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.3.2.1&r2=1.3.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/PartitionTable.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.5.2.1&r2=1.5.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/parted_wrapper.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.8.2.4&r2=1.8.2.5 --- conga/clustermon.spec.in.in 2008/04/11 06:54:43 1.18.2.37 +++ conga/clustermon.spec.in.in 2008/05/12 15:13:31 1.18.2.38 @@ -18,7 +18,7 @@ Name: clustermon Version: @@VERS@@ Release: @@REL@@%{?dist} -License: GPL +License: GPLv2 URL: http://sources.redhat.com/cluster/conga Group: System Environment/Base @@ -67,12 +67,11 @@ make %{?_smp_mflags} clustermon %install -rm -rf $RPM_BUILD_ROOT -make DESTDIR=$RPM_BUILD_ROOT install_clustermon +rm -rf %{buildroot} +make DESTDIR=%{buildroot} install_clustermon %clean -rm -rf $RPM_BUILD_ROOT - +rm -rf %{buildroot} @@ -191,7 +190,7 @@ %{_docdir}/cluster-cim-%{version}/ %post -n cluster-cim -# pegasus might not be running, don't fail %post +# pegasus might not be running, don't fail /sbin/service tog-pegasus condrestart >&/dev/null exit 0 @@ -200,7 +199,7 @@ if [ "$1" == "0" ]; then /sbin/service tog-pegasus condrestart >&/dev/null fi -# pegasus might not be running, don't fail %postun +# pegasus might not be running, don't fail exit 0 --- conga/conga.spec.in.in 2008/04/28 03:54:18 1.45.2.84 +++ conga/conga.spec.in.in 2008/05/12 15:13:32 1.45.2.85 @@ -62,11 +62,11 @@ make %{?_smp_mflags} conga %install -rm -rf $RPM_BUILD_ROOT -make DESTDIR=$RPM_BUILD_ROOT install_conga +rm -rf %{buildroot} +make DESTDIR=%{buildroot} install_conga %clean -rm -rf $RPM_BUILD_ROOT +rm -rf %{buildroot} ####### luci ####### --- conga/luci/site/luci/Extensions/ricci_communicator.py 2008/01/23 04:44:32 1.9.2.14 +++ conga/luci/site/luci/Extensions/ricci_communicator.py 2008/05/12 15:13:32 1.9.2.15 @@ -169,7 +169,7 @@ luci_log.debug_net('RC:UNAUTH0: unauthenticate %s for %s:%d' \ % (ret, self.__hostname, self.__port)) if ret != '0': - raise Exception, 'Invalid response' + raise Exception, 'Invalid response: %s' % ret try: self.ss.untrust() @@ -494,7 +494,7 @@ % batch_xml.toxml()) except: pass - raise RicciError, 'Not an XML batch node' + raise RicciError, 'Not an XML batch node: %s' % batch_xml.nodeName total = 0 last = 0 @@ -544,7 +544,7 @@ if LUCI_DEBUG_NET is True: luci_log.debug_net_priv('RC:EMS0: Expecting "batch" got "%s"' \ % batch_xml.toxml()) - raise RicciError, 'Invalid XML node; expecting a batch node' + raise RicciError, 'Invalid XML node; expecting a batch node: %s' % batch_xml.nodeName c = 0 for node in batch_xml.childNodes: --- conga/make/version.in 2008/04/28 03:54:18 1.21.2.38 +++ conga/make/version.in 2008/05/12 15:13:32 1.21.2.39 @@ -1,2 +1,2 @@ -VERSION=0.12.0 -RELEASE=9 +VERSION=0.14.0 +RELEASE=1 --- conga/ricci/common/File.cpp 2008/01/17 17:38:36 1.1.2.4 +++ conga/ricci/common/File.cpp 2008/05/12 15:13:32 1.1.2.5 @@ -139,17 +139,17 @@ MutexLocker l(*_mutex); long len = size(); - const auto_ptr buff(new char[len]); + char buff[len]; try { ((fstream *) _pimpl->fs)->seekg(0, ios::beg); check_failed(); - ((fstream *) _pimpl->fs)->read(buff.get(), len); + ((fstream *) _pimpl->fs)->read(buff, len); check_failed(); - String ret(buff.get(), len); - ::shred(buff.get(), len); + String ret(buff, len); + ::shred(buff, len); return ret; } catch ( ... ) { - ::shred(buff.get(), len); + ::shred(buff, len); throw; } } --- conga/ricci/common/Variable.cpp 2008/01/17 17:38:36 1.8.2.1 +++ conga/ricci/common/Variable.cpp 2008/05/12 15:13:32 1.8.2.2 @@ -26,6 +26,8 @@ #include +#include +#include using namespace std; // ##### class Variable ##### --- conga/ricci/common/daemon_init.c 2008/01/17 17:38:36 1.1.2.1 +++ conga/ricci/common/daemon_init.c 2008/05/12 15:13:32 1.1.2.2 @@ -20,7 +20,7 @@ /** @file * daemon_init function, does sanity checks and calls daemon(). * - * $Id: daemon_init.c,v 1.1.2.1 2008/01/17 17:38:36 rmccabe Exp $ + * $Id: daemon_init.c,v 1.1.2.2 2008/05/12 15:13:32 rmccabe Exp $ * * Author: Jeff Moyer */ @@ -232,5 +232,4 @@ update_pidfile(prog); nice(-1); - //mlockall(MCL_CURRENT | MCL_FUTURE); } --- conga/ricci/common/utils.cpp 2008/01/17 17:38:36 1.6.2.2 +++ conga/ricci/common/utils.cpp 2008/05/12 15:13:32 1.6.2.3 @@ -23,8 +23,13 @@ #include "utils.h" #include "executils.h" -#include +#include +#include #include +#include +#include +#include +#include //#include @@ -201,24 +206,44 @@ long long utils::to_long(const String& str) { - return atoll(str.c_str()); + char *p = NULL; + long long ret; + ret = strtoll(strip(str).c_str(), &p, 10); + if (p != NULL && *p != '\0') + throw String("Not a number: ") + str; + if (ret == LLONG_MIN && errno == ERANGE) + throw String("Numeric underflow: ") + str; + if (ret == LLONG_MAX && errno == ERANGE) + throw String("Numeric overflow: ") + str; + return ret; } float utils::to_float(const String& str) { - float num = 0; + char *p = NULL; + float ret; - sscanf(strip(str).c_str(), "%f", &num); - return num; + ret = strtof(strip(str).c_str(), &p); + if (p != NULL && *p == '\0') + throw String("Invalid floating point number: ") + str; + if (ret == 0 && errno == ERANGE) + throw String("Floating point underflow: ") + str; + if ((ret == HUGE_VALF || ret == HUGE_VALL) && errno == ERANGE) + throw String("Floating point overflow: ") + str; + + return ret; } String utils::to_string(int value) { char tmp[64]; + int ret; - sprintf(tmp, "%d", value); + ret = snprintf(tmp, sizeof(tmp), "%d", value); + if (ret < 0 || (size_t) ret >= sizeof(tmp)) + throw String("Invalid integer"); return tmp; } @@ -226,8 +251,11 @@ utils::to_string(long value) { char tmp[64]; + int ret; - sprintf(tmp, "%ld", value); + ret = snprintf(tmp, sizeof(tmp), "%ld", value); + if (ret < 0 || (size_t) ret >= sizeof(tmp)) + throw String("Invalid long integer"); return tmp; } @@ -235,8 +263,11 @@ utils::to_string(long long value) { char tmp[64]; + int ret; - sprintf(tmp, "%lld", value); + ret = snprintf(tmp, sizeof(tmp), "%lld", value); + if (ret < 0 || (size_t) ret >= sizeof(tmp)) + throw String("Invalid long long integer"); return tmp; } --- conga/ricci/include/shred_allocator.h 2008/01/17 17:38:37 1.2.2.1 +++ conga/ricci/include/shred_allocator.h 2008/05/12 15:13:32 1.2.2.2 @@ -33,6 +33,12 @@ #ifndef __CONGA_SHRED_ALLOCATOR_H #define __CONGA_SHRED_ALLOCATOR_H +extern "C" { + #include + #include + #include +} + #include template --- conga/ricci/init.d/ricci 2008/01/17 17:38:37 1.8.2.4 +++ conga/ricci/init.d/ricci 2008/05/12 15:13:32 1.8.2.5 @@ -53,103 +53,159 @@ { rm -f "$SSL_PUBKEY" "$SSL_PRIVKEY" echo -n "generating SSL certificates... " - /usr/bin/openssl genrsa -out "$SSL_PRIVKEY" 2048 >&/dev/null - /usr/bin/openssl req -new -x509 -key "$SSL_PRIVKEY" -out "$SSL_PUBKEY" -days 1825 -config /var/lib/ricci/certs/cacert.config - /bin/chown $RUNASUSER:$RUNASUSER "$SSL_PRIVKEY" "$SSL_PUBKEY" + /usr/bin/openssl genrsa -out "$SSL_PRIVKEY" 2048 >&/dev/null && + /usr/bin/openssl req -new -x509 -key "$SSL_PRIVKEY" -out "$SSL_PUBKEY" -days 1825 -config /var/lib/ricci/certs/cacert.config && + /bin/chown $RUNASUSER:$RUNASUSER "$SSL_PRIVKEY" "$SSL_PUBKEY" && + /bin/chmod 600 "$SSL_PRIVKEY" && /bin/chmod 644 "$SSL_PUBKEY" - /bin/chmod 600 "$SSL_PRIVKEY" ret=$? echo "done" return $ret } +check_ricci_lockfiles() { + ricci_status >& /dev/null + ret=$? + if [ "$ret" -eq 1 ] || [ "$ret" -eq 2 ]; then + # stale pid and/or lockfile + rm -f -- "$PIDFILE" "$LOCKFILE" + fi +} + +ricci_status() { + if [ -f "$PIDFILE" ]; then + status -p "$PIDFILE" "$RICCID" + ricci_up=$? + else + status "$RICCID" + ricci_up=$? + fi + return $ricci_up +} + +ricci_stop() { + ricci_status >& /dev/null + ret=$? + + if [ "$ret" -ne 0 ]; then + # already stopped - no error + check_ricci_lockfiles + return 0 + fi + + killproc "$RICCID" SIGTERM + + ricci_status >& /dev/null + ret=$? + + max_wait=10 + cur_wait=0 + while [ "$ret" -eq 0 ] && [ $cur_wait -lt $max_wait ]; do + sleep 1 + cur_wait=`expr $cur_wait + 1` + ricci_status >& /dev/null + ret=$? + done + + ricci_status >& /dev/null + ret=$? + + if [ "$ret" -ne 0 ]; then + rm -f -- "$PIDFILE" "$LOCKFILE" + return 0 + fi + + return 1 +} case $1 in start) service messagebus status >&/dev/null - if [ $? -ne 0 ]; then + if [ "$?" -ne 0 ]; then service messagebus start service messagebus status >&/dev/null - if [ $? -ne 0 ]; then - echo "not starting ricci..." - /usr/bin/logger -t $RICCID "startup failed" + if [ "$?" -ne 0 ]; then + /usr/bin/logger -t "$RICCID" -- "messagebus startup failed" + failure "not starting $RICCID" exit 1 fi fi + service oddjobd status >&/dev/null - if [ $? -ne 0 ]; then + if [ "$?" -ne 0 ]; then service oddjobd start service oddjobd status >&/dev/null - if [ $? -ne 0 ]; then - echo "not starting ricci..." - /usr/bin/logger -t $RICCID "startup failed" + if [ "$?" -ne 0 ]; then + /usr/bin/logger -t "$RICCID" -- "oddjob startup failed" + failure "not starting $RICCID" exit 1 fi fi service saslauthd start >&/dev/null + ssl_certs_ok - if [ "1$?" != "10" ] ; then + if [ "$?" -ne 0 ] ; then generate_ssl_certs fi - NewUID=`grep "^$RUNASUSER:" /etc/passwd | sed -e 's/^[^:]*:[^:]*://' -e 's/:.*//'` + check_ricci_lockfiles + NewUID=`grep "^$RUNASUSER:" /etc/passwd | cut -d: -f3` echo -n $"Starting $ID: " - daemon $RICCID -u $NewUID - rtrn=$? + daemon "$RICCID" -u "$NewUID" echo + ret=$? - if [ $rtrn -eq 0 ]; then - touch "$LOCKFILE" - /usr/bin/logger -t $RICCID "startup succeeded" + if [ "$ret" -eq 0 ]; then + touch -- "$LOCKFILE" + /usr/bin/logger -t $RICCID -- "startup succeeded" else - /usr/bin/logger -t $RICCID "startup failed" + /usr/bin/logger -t $RICCID -- "startup failed" fi ;; restart) $0 stop $0 start - rtrn=$? + ret=$? ;; status) - status $RICCID - rtrn=$? + ricci_status + ret=$? ;; stop) echo -n "Shutting down $ID: " - killproc $RICCID SIGTERM - rtrn=$? - if [ $rtrn -eq 0 ]; then - sleep 8 - rm -f $PIDFILE - rm -f $LOCKFILE - /usr/bin/logger -t $RICCID "shutdown succeeded" - rtrn=0 + ricci_stop + ret=$? + if [ "$ret" -eq 0 ]; then + /usr/bin/logger -t "$RICCID" -- "shutdown succeeded" else - /usr/bin/logger -t $RICCID "shutdown failed" - rtrn=1 + /usr/bin/logger -t "$RICCID" -- "shutdown failed" fi echo ;; condrestart) - if [ -f ${PIDFILE} ] ; then + if [ -f "$PIDFILE" ]; then $0 restart - rtrn=$? + ret=$? fi ;; + try-restart) + ret=3 + ;; + reload) - rtrn=3 + ret=3 ;; *) echo "Usage: $0 {start|stop|status|restart|condrestart|reload}" - rtrn=3 + ret=3 ;; esac -exit $rtrn +exit $ret --- conga/ricci/modules/cluster/clumon/Makefile 2008/01/17 17:38:37 1.4.2.2 +++ conga/ricci/modules/cluster/clumon/Makefile 2008/05/12 15:13:33 1.4.2.3 @@ -11,6 +11,7 @@ top_srcdir=../../.. UNINSTALL=${top_srcdir}/scripts/uninstall.pl +include ${top_srcdir}/make/version.in include ${top_srcdir}/make/defines.mk all: --- conga/ricci/modules/cluster/clumon/init.d/modclusterd 2008/01/17 17:38:37 1.2.2.2 +++ conga/ricci/modules/cluster/clumon/init.d/modclusterd 2008/05/12 15:13:33 1.2.2.3 @@ -37,66 +37,122 @@ # If we're not configured, then don't start anything. # [ "${NETWORKING}" = "yes" ] || exit 1 -#[ -f "$CFG_FILE" ] || exit 0 +modclusterd_status() { + if [ -f "$PIDFILE" ]; then + status -p "$PIDFILE" "$MODCLUSTERD" + ret=$? + else + status "$MODCLUSTERD" + ret=$? + fi + return $ret +} + +check_modclusterd_lockfiles() { + modclusterd_status >& /dev/null + ret=$? + if [ "$ret" -eq 1 ] || [ "$ret" -eq 2 ]; then + # stale pid and/or lockfile + rm -f -- "$PIDFILE" "$LOCKFILE" + fi + return 0 +} + +modclusterd_stop() { + modclusterd_status >& /dev/null + ret=$? + + if [ "$ret" -ne 0 ]; then + # already stopped - no error + check_modclusterd_lockfiles + return 0 + fi + + killproc "$MODCLUSTERD" SIGTERM + + modclusterd_status >& /dev/null + ret=$? + + max_wait=10 + cur_wait=0 + while [ "$ret" -eq 0 ] && [ $cur_wait -lt $max_wait ]; do + sleep 1 + cur_wait=`expr $cur_wait + 1` + modclusterd_status >& /dev/null + ret=$? + done + + modclusterd_status >& /dev/null + ret=$? + + if [ "$ret" -ne 0 ]; then + rm -f -- "$PIDFILE" "$LOCKFILE" + return 0 + fi + + return 1 +} case $1 in start) echo -n $"Starting $ID: " - daemon $MODCLUSTERD - rtrn=$? - if [ $rtrn -eq 0 ]; then - touch $LOCKFILE - /usr/bin/logger -t $MODCLUSTERD "startup succeeded" + check_modclusterd_lockfiles + daemon "$MODCLUSTERD" + ret=$? + if [ "$ret" -eq 0 ]; then + touch -- "$LOCKFILE" + /usr/bin/logger -t "$MODCLUSTERD" -- "startup succeeded" else - /usr/bin/logger -t $MODCLUSTERD "startup failed" - rtrn=1 + /usr/bin/logger -t "$MODCLUSTERD" -- "startup failed" + ret=1 fi echo ;; restart) $0 stop - sleep 8 $0 start - rtrn=$? + ret=$? ;; status) - status $MODCLUSTERD - rtrn=$? + modclusterd_status + ret=$? ;; stop) echo -n "Shutting down $ID: " - killproc $MODCLUSTERD SIGTERM - rtrn=$? - if [ $rtrn -eq 0 ]; then - rm -f $PIDFILE - rm -f $LOCKFILE - /usr/bin/logger -t $MODCLUSTERD "shutdown succeeded" + modclusterd_stop + ret=$? + if [ "$ret" -eq 0 ]; then + /usr/bin/logger -t "$MODCLUSTERD" -- "shutdown succeeded" else - /usr/bin/logger -t $MODCLUSTERD "shutdown failed" - rtrn=1 + /usr/bin/logger -t "$MODCLUSTERD" -- "shutdown failed" + ret=1 fi echo ;; condrestart) - if [ -f ${PIDFILE} ] ; then + if [ -f "$PIDFILE" ]; then $0 restart - rtrn=$? + ret=$? fi ;; + try-restart) + ret=3 + ;; + reload) - rtrn=3 + ret=3 ;; *) echo $"Usage: $0 {start|stop|reload|restart|status}" - rtrn=3 + ret=3 ;; esac -exit $rtrn +exit $ret --- conga/ricci/modules/cluster/clumon/src/common/Cluster.cpp 2008/01/17 17:38:38 1.6.2.2 +++ conga/ricci/modules/cluster/clumon/src/common/Cluster.cpp 2008/05/12 15:13:33 1.6.2.3 @@ -25,7 +25,8 @@ #include extern "C" { -# include + #include + #include } using namespace std; --- conga/ricci/modules/storage/ContentFS.cpp 2008/01/17 17:38:39 1.5.2.1 +++ conga/ricci/modules/storage/ContentFS.cpp 2008/05/12 15:13:33 1.5.2.2 @@ -28,6 +28,7 @@ #include "BDFactory.h" #include "defines.h" #include "utils.h" +#include using namespace std; --- conga/ricci/modules/storage/ExtendedFS.cpp 2008/01/17 17:38:39 1.7.2.2 +++ conga/ricci/modules/storage/ExtendedFS.cpp 2008/05/12 15:13:33 1.7.2.3 @@ -27,8 +27,9 @@ #include "UMountError.h" #include "FileMagic.h" - +#include #include + using namespace std; --- conga/ricci/modules/storage/LV.cpp 2008/01/17 17:38:39 1.6.2.4 +++ conga/ricci/modules/storage/LV.cpp 2008/05/12 15:13:33 1.6.2.5 @@ -124,7 +124,7 @@ long long min = utils::to_long(xml.get_attr("min")); long long max = utils::to_long(xml.get_attr("max")); long long step = utils::to_long(xml.get_attr("step")); - long long min_size = (long long ) (size * (usage / 100.0)); + long long min_size = (long long) (size * usage) / 100; if (min_size > min) min = min_size; else if (min_size > max) --- conga/ricci/modules/storage/Mapper.cpp 2008/01/17 17:38:39 1.3.2.1 +++ conga/ricci/modules/storage/Mapper.cpp 2008/05/12 15:13:33 1.3.2.2 @@ -26,6 +26,7 @@ #include "BDFactory.h" #include "MapperFactory.h" #include "MidAir.h" +#include using namespace std; --- conga/ricci/modules/storage/MountHandler.cpp 2008/01/17 17:38:39 1.5.2.2 +++ conga/ricci/modules/storage/MountHandler.cpp 2008/05/12 15:13:33 1.5.2.3 @@ -37,8 +37,9 @@ #include #include - +#include #include + using namespace std; --- conga/ricci/modules/storage/PTSource.cpp 2008/01/17 17:38:39 1.2.2.1 +++ conga/ricci/modules/storage/PTSource.cpp 2008/05/12 15:13:33 1.2.2.2 @@ -25,6 +25,7 @@ #include "PartitionTable.h" #include "parted_wrapper.h" +#include using namespace std; --- conga/ricci/modules/storage/PV.cpp 2008/01/17 17:38:39 1.4.2.3 +++ conga/ricci/modules/storage/PV.cpp 2008/05/12 15:13:33 1.4.2.4 @@ -26,6 +26,7 @@ #include "MapperFactory.h" #include "utils.h" #include "LVMClusterLockingError.h" +#include using namespace std; --- conga/ricci/modules/storage/Partition.cpp 2008/01/17 17:38:39 1.3.2.1 +++ conga/ricci/modules/storage/Partition.cpp 2008/05/12 15:13:33 1.3.2.2 @@ -30,6 +30,7 @@ #include "ContentExtendedPartition.h" #include "PV.h" +#include using namespace std; --- conga/ricci/modules/storage/PartitionTable.cpp 2008/01/17 17:38:39 1.5.2.1 +++ conga/ricci/modules/storage/PartitionTable.cpp 2008/05/12 15:13:33 1.5.2.2 @@ -28,7 +28,7 @@ #include "MapperFactory.h" #include "utils.h" - +#include #include --- conga/ricci/modules/storage/parted_wrapper.cpp 2008/01/17 17:38:39 1.8.2.4 +++ conga/ricci/modules/storage/parted_wrapper.cpp 2008/05/12 15:13:33 1.8.2.5 @@ -24,8 +24,9 @@ #include "parted_wrapper.h" #include "utils.h" - +#include #include + using namespace std; @@ -667,11 +668,13 @@ String s = utils::to_lower(utils::strip(size_str)); long long multiplier; // parted defines 1KB as 1000 bytes. - if (s.find("b") == s.npos) + if (s.find("b") == s.npos) { multiplier = 1000 * 1000; // by old parted behavior, size is in MB - else { + return (long long) utils::to_long(s) * multiplier; + } else { if (s.size() < 3) throw String("parted size has an invalid value: ") + s; + /* This path should never be hit on RHEL5 and later. */ multiplier = 1; if (s[s.size()-2] == 'k') multiplier = 1000; @@ -681,7 +684,6 @@ multiplier = 1000 * 1000 * 1000; else if (s[s.size()-2] == 't') multiplier = (long long) 1000 * 1000 * 1000 * 1000; + return (long long) utils::to_float(s) * multiplier; } - - return (long long) utils::to_float(s) * multiplier; }