From mboxrd@z Thu Jan 1 00:00:00 1970 From: rmccabe@sourceware.org Date: 11 Sep 2007 02:45:53 -0000 Subject: [Cluster-devel] conga/ricci Changelog configure ricci.spec.in. ... Message-ID: <20070911024553.29624.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 Changes by: rmccabe at sourceware.org 2007-09-11 02:45:29 Modified files: ricci : Changelog configure ricci.spec.in.in ricci/common : Logger.cpp daemon_init.c executils_test.cpp signals.c ricci/docs : cluster_api.html logging_api.html modules.html modules_common.html reboot_api.html ricci_api.html rpm_api.html service_api.html storage-bd_template.html storage-bds.html storage-content.html storage-content_template.html storage-mapper_template.html storage-mappers.html storage_api.html variables.html ricci/init.d : ricci ricci/make : defines.mk.in ricci/modules/cluster/clumon: README.cim README.snmpd REDHAT-CLUSTER-MIB REDHAT-MIB RedHat_ClusterSchema.mof ricci/modules/cluster/clumon/init.d: modclusterd ricci/modules/cluster/clumon/src/cim-provider: ClusterProvider.cpp ClusterProvider.h ClusterProviderMain.cpp SmartHandler.h clusterCIM_test.cpp ricci/modules/cluster/clumon/src/snmp-agent: clusterMIB.cpp clusterMIB.h clusterMonitorSnmp.cpp clusterMonitorSnmp.h nodesMIB.cpp nodesMIB.h nodesMIB_access.cpp nodesMIB_access.h nodesMIB_checkfns.cpp nodesMIB_checkfns.h nodesMIB_checkfns_local.cpp nodesMIB_checkfns_local.h nodesMIB_columns.h nodesMIB_enums.h servicesMIB.cpp servicesMIB.h servicesMIB_access.cpp servicesMIB_access.h servicesMIB_checkfns.cpp servicesMIB_checkfns.h servicesMIB_checkfns_local.cpp servicesMIB_checkfns_local.h servicesMIB_columns.h servicesMIB_enums.h ricci/modules/log: LogParser.cpp LogParser.h LoggingModule.cpp LoggingModule.h main.cpp ricci/modules/rpm: PackageHandler.cpp PackageHandler.h RpmModule.cpp RpmModule.h main.cpp ricci/modules/service: ServiceManager.cpp ServiceManager.h ServiceModule.cpp ServiceModule.h main.cpp ricci/modules/storage: BD.cpp BD.h BDFactory.cpp BDFactory.h ClusterNotQuorateError.h ClusterNotRunningError.h ClvmdError.h Content.cpp Content.h ContentExtendedPartition.cpp ContentExtendedPartition.h ContentFS.cpp ContentFS.h ContentFactory.cpp ContentFactory.h ContentNone.cpp ContentNone.h ContentUnusable.cpp ContentUnusable.h ExtendedFS.cpp ExtendedFS.h FSController.cpp FSController.h FileMagic.cpp FileMagic.h GFS1.cpp GFS1.h GFS2.cpp GFS2.h HD.cpp HD.h LV.cpp LV.h LVM.cpp LVM.h LVMClusterLockingError.h MDRaid.cpp MDRaid.h MDRaidSource.cpp MDRaidSource.h MDRaidTarget.cpp MDRaidTarget.h Mapper.cpp Mapper.h MapperFactory.cpp MapperFactory.h MapperSource.cpp MapperSource.h MidAir.h MountHandler.cpp MountHandler.h PTSource.cpp PTSource.h PV.cpp PV.h Partition.cpp Partition.h PartitionTable.cpp PartitionTable.h Props.cpp Props.h StorageModule.cpp StorageModule.h SwapFS.cpp SwapFS.h System.cpp System.h UMountError.h UnsupportedFS.cpp UnsupportedFS.h VG.cpp VG.h ValidationError.h defines.h gfs_ondisk.h main.cpp mdadm_wrapper.cpp mdadm_wrapper.h parted_wrapper.cpp parted_wrapper.h ricci/ricci : main.cpp ricci/test : PropsObject.py Variable.py add_sources_renderer.py auth_page.py bd_remove_renderer.py bd_renderer.py communicator.py content_renderer.py dispatcher.py host_selection.py main_page.py mapper_renderer.py new_mapper_renderer.py new_target_renderer.py props_renderer.py ricci/test_suite: README SSLClient_send_to_ricci send_to_ricci Log message: Whitespace cleanup. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/Changelog.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/configure.diff?cvsroot=cluster&r1=1.9&r2=1.10 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/ricci.spec.in.in.diff?cvsroot=cluster&r1=1.13&r2=1.14 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/common/Logger.cpp.diff?cvsroot=cluster&r1=1.5&r2=1.6 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/common/daemon_init.c.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/common/executils_test.cpp.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/common/signals.c.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/docs/cluster_api.html.diff?cvsroot=cluster&r1=1.7&r2=1.8 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/docs/logging_api.html.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/docs/modules.html.diff?cvsroot=cluster&r1=1.5&r2=1.6 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/docs/modules_common.html.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/docs/reboot_api.html.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/docs/ricci_api.html.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/docs/rpm_api.html.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/docs/service_api.html.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/docs/storage-bd_template.html.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/docs/storage-bds.html.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/docs/storage-content.html.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/docs/storage-content_template.html.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/docs/storage-mapper_template.html.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/docs/storage-mappers.html.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/docs/storage_api.html.diff?cvsroot=cluster&r1=1.7&r2=1.8 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/docs/variables.html.diff?cvsroot=cluster&r1=1.5&r2=1.6 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/init.d/ricci.diff?cvsroot=cluster&r1=1.11&r2=1.12 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/make/defines.mk.in.diff?cvsroot=cluster&r1=1.8&r2=1.9 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/README.cim.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/README.snmpd.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/REDHAT-CLUSTER-MIB.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/REDHAT-MIB.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/RedHat_ClusterSchema.mof.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/init.d/modclusterd.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/cim-provider/ClusterProvider.cpp.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/cim-provider/ClusterProvider.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/cim-provider/ClusterProviderMain.cpp.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/cim-provider/SmartHandler.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/cim-provider/clusterCIM_test.cpp.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/clusterMIB.cpp.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/clusterMIB.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/clusterMonitorSnmp.cpp.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/clusterMonitorSnmp.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB.cpp.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_access.cpp.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_access.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_checkfns.cpp.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_checkfns.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_checkfns_local.cpp.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_checkfns_local.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_columns.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_enums.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB.cpp.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_access.cpp.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_access.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_checkfns.cpp.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_checkfns.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_checkfns_local.cpp.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_checkfns_local.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_columns.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_enums.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/log/LogParser.cpp.diff?cvsroot=cluster&r1=1.9&r2=1.10 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/log/LogParser.h.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/log/LoggingModule.cpp.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/log/LoggingModule.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/log/main.cpp.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/rpm/PackageHandler.cpp.diff?cvsroot=cluster&r1=1.14&r2=1.15 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/rpm/PackageHandler.h.diff?cvsroot=cluster&r1=1.5&r2=1.6 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/rpm/RpmModule.cpp.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/rpm/RpmModule.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/rpm/main.cpp.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/service/ServiceManager.cpp.diff?cvsroot=cluster&r1=1.11&r2=1.12 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/service/ServiceManager.h.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/service/ServiceModule.cpp.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/service/ServiceModule.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/service/main.cpp.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/BD.cpp.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/BD.h.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/BDFactory.cpp.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/BDFactory.h.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/ClusterNotQuorateError.h.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/ClusterNotRunningError.h.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/ClvmdError.h.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/Content.cpp.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/Content.h.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/ContentExtendedPartition.cpp.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/ContentExtendedPartition.h.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/ContentFS.cpp.diff?cvsroot=cluster&r1=1.5&r2=1.6 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/ContentFS.h.diff?cvsroot=cluster&r1=1.6&r2=1.7 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/ContentFactory.cpp.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/ContentFactory.h.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/ContentNone.cpp.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/ContentNone.h.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/ContentUnusable.cpp.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/ContentUnusable.h.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/ExtendedFS.cpp.diff?cvsroot=cluster&r1=1.8&r2=1.9 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/ExtendedFS.h.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/FSController.cpp.diff?cvsroot=cluster&r1=1.9&r2=1.10 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/FSController.h.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/FileMagic.cpp.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/FileMagic.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/GFS1.cpp.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/GFS1.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/GFS2.cpp.diff?cvsroot=cluster&r1=1.5&r2=1.6 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/GFS2.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/HD.cpp.diff?cvsroot=cluster&r1=1.5&r2=1.6 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/HD.h.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/LV.cpp.diff?cvsroot=cluster&r1=1.9&r2=1.10 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/LV.h.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/LVM.cpp.diff?cvsroot=cluster&r1=1.12&r2=1.13 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/LVM.h.diff?cvsroot=cluster&r1=1.5&r2=1.6 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/LVMClusterLockingError.h.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/MDRaid.cpp.diff?cvsroot=cluster&r1=1.7&r2=1.8 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/MDRaid.h.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/MDRaidSource.cpp.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/MDRaidSource.h.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/MDRaidTarget.cpp.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/MDRaidTarget.h.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/Mapper.cpp.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/Mapper.h.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/MapperFactory.cpp.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/MapperFactory.h.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/MapperSource.cpp.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/MapperSource.h.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/MidAir.h.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/MountHandler.cpp.diff?cvsroot=cluster&r1=1.7&r2=1.8 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/MountHandler.h.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/PTSource.cpp.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/PTSource.h.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/PV.cpp.diff?cvsroot=cluster&r1=1.6&r2=1.7 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/PV.h.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/Partition.cpp.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/Partition.h.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/PartitionTable.cpp.diff?cvsroot=cluster&r1=1.5&r2=1.6 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/PartitionTable.h.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/Props.cpp.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/Props.h.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/StorageModule.cpp.diff?cvsroot=cluster&r1=1.7&r2=1.8 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/StorageModule.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/SwapFS.cpp.diff?cvsroot=cluster&r1=1.9&r2=1.10 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/SwapFS.h.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/System.cpp.diff?cvsroot=cluster&r1=1.5&r2=1.6 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/System.h.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/UMountError.h.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/UnsupportedFS.cpp.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/UnsupportedFS.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/VG.cpp.diff?cvsroot=cluster&r1=1.13&r2=1.14 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/VG.h.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/ValidationError.h.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/defines.h.diff?cvsroot=cluster&r1=1.7&r2=1.8 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/gfs_ondisk.h.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/main.cpp.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/mdadm_wrapper.cpp.diff?cvsroot=cluster&r1=1.5&r2=1.6 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/mdadm_wrapper.h.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/parted_wrapper.cpp.diff?cvsroot=cluster&r1=1.11&r2=1.12 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/parted_wrapper.h.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/ricci/main.cpp.diff?cvsroot=cluster&r1=1.5&r2=1.6 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test/PropsObject.py.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test/Variable.py.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test/add_sources_renderer.py.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test/auth_page.py.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test/bd_remove_renderer.py.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test/bd_renderer.py.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test/communicator.py.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test/content_renderer.py.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test/dispatcher.py.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test/host_selection.py.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test/main_page.py.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test/mapper_renderer.py.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test/new_mapper_renderer.py.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test/new_target_renderer.py.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test/props_renderer.py.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test_suite/README.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test_suite/SSLClient_send_to_ricci.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test_suite/send_to_ricci.diff?cvsroot=cluster&r1=1.1&r2=1.2 --- conga/ricci/Changelog 2006/08/22 17:32:06 1.4 +++ conga/ricci/Changelog 2007/09/11 02:45:26 1.5 @@ -1,15 +1,15 @@ -2006-08-18 Stanko Kupcevic +2006-08-18 Stanko Kupcevic * Don't auto-start ricci after installation, do it manually - * storage module: use `pvdisplay -c` if `pvs` fails - (`pvs` will fail if one of hard drives is not readable, + * storage module: use `pvdisplay -c` if `pvs` fails + (`pvs` will fail if one of hard drives is not readable, while `pvdisplay -c` will give incomplete but usefull info) * shred strings -2006-07-17 Stanko Kupcevic +2006-07-17 Stanko Kupcevic * common/executils.cpp: clear stdout/stderr buffers before executing external commands -2006-07-12 Stanko Kupcevic +2006-07-12 Stanko Kupcevic * ricci: unauthenticate() should always succeed * storage module: remove snapshot_usage from state_ind (snapshot usage shouldn't affect state_ind) --- conga/ricci/configure 2006/11/17 00:31:50 1.9 +++ conga/ricci/configure 2007/09/11 02:45:26 1.10 @@ -28,7 +28,7 @@ LIBDIR_SED=\\/lib X86_64_TMP=`uname -a | grep x86_64` -if [ "$X86_64_TMP" ]; then +if [ "$X86_64_TMP" ]; then LIBDIR_SED=\\/lib64 fi @@ -46,7 +46,7 @@ # D-BUS version DBUS_VERSION=`pkg-config --modversion dbus-1 2>/dev/null` -if [ -z "$DBUS_VERSION" ] ; then +if [ -z "$DBUS_VERSION" ] ; then echo "D-BUS required, but I am unable to locate it. Is it installed?" rm -f $MAKE_DEFINES exit 1 @@ -55,12 +55,12 @@ VERSIONS=(`echo $DBUS_VERSION | sed -e s,^\\\\\([0123456789]*\\\\\)\.\\\\\([0123456789]*\\\\\).*,\\\1\ \\\2, 2>/dev/null`) DBUS_MAJOR_VERSION=${VERSIONS[0]} DBUS_MINOR_VERSION=${VERSIONS[1]} - if [ -z "$DBUS_MAJOR_VERSION" ] ; then + if [ -z "$DBUS_MAJOR_VERSION" ] ; then echo "; failed extraction of major D-BUS version" rm -f $MAKE_DEFINES exit 1 fi - if [ -z "$DBUS_MINOR_VERSION" ] ; then + if [ -z "$DBUS_MINOR_VERSION" ] ; then echo "; failed extraction of minor D-BUS version" rm -f $MAKE_DEFINES exit 1 --- conga/ricci/ricci.spec.in.in 2007/01/18 03:02:38 1.13 +++ conga/ricci/ricci.spec.in.in 2007/09/11 02:45:26 1.14 @@ -174,7 +174,7 @@ Summary: ricci-modstorage summary Requires: /bin/bash Requires: oddjob libxml2 openssl -Requires: parted +Requires: parted Provides: ricci-modstorage Conflicts: ricci-storage --- conga/ricci/common/Logger.cpp 2007/09/11 00:26:52 1.5 +++ conga/ricci/common/Logger.cpp 2007/09/11 02:45:26 1.6 @@ -31,7 +31,7 @@ #include #include -extern "C" { +extern "C" { #include "sys_util.h" } @@ -124,7 +124,7 @@ p = strchr(cur_time, '\n'); if (p != NULL) - *p = '\0'; + *p = '\0'; if (_fd > 2 && _domain_c != NULL) { ret = snprintf(buf, sizeof(buf), "%s %s: %s\n", --- conga/ricci/common/daemon_init.c 2007/08/31 04:57:37 1.2 +++ conga/ricci/common/daemon_init.c 2007/09/11 02:45:26 1.3 @@ -14,18 +14,18 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /** @file * daemon_init function, does sanity checks and calls daemon(). * - * $Id: daemon_init.c,v 1.2 2007/08/31 04:57:37 rmccabe Exp $ + * $Id: daemon_init.c,v 1.3 2007/09/11 02:45:26 rmccabe Exp $ * * Author: Jeff Moyer */ /* - * TODO: Clean this up so that only one function constructs the + * TODO: Clean this up so that only one function constructs the * pidfile /var/run/loggerd.PID, and perhaps only one function * forms the /proc/PID/ path. * --- conga/ricci/common/executils_test.cpp 2006/08/10 22:53:07 1.2 +++ conga/ricci/common/executils_test.cpp 2007/09/11 02:45:26 1.3 @@ -41,34 +41,34 @@ main(int argc, char** argv) { // set_logger(counting_auto_ptr(new Logger(1, "executils_test", LogExecute))); - + map > oracle; oracle["/bin/cat"] = vector(1, "/etc/cluster/cluster.conf"); oracle["/sbin/magma_tool"] = vector(1, "members"); oracle["/usr/sbin/clustat"] = vector(1, "-x"); oracle["/sbin/ifconfig"] = vector(); // oracle["/bin/sleep"] = vector(1, "4"); - + setup_signal(SIGUSR1, nothing); setup_signal(SIGUSR2, nothing_2); - + pid = getpid(); - + Killer killer; killer.start(); - + while (true) { for (map >::iterator iter = oracle.begin(); iter != oracle.end(); iter++) { String out, err; int status; - + execute(iter->first, iter->second, out, err, status); - + // cout << iter->first << ":" << endl; // cout << out << endl << endl << err << endl << endl; - + MutexLocker l(mutex); running = true; } @@ -77,11 +77,11 @@ } -void +void nothing(int) {} -void +void nothing_2(int) { poll(NULL, 0, rand() % 20); @@ -92,15 +92,15 @@ Killer::run() { int time_to_check = time_sec() + 10; - + srand(time_sec()); while (!shouldStop()) { kill(pid, SIGUSR2); poll(NULL, 0, rand() % 117 + 20); - + kill(pid, SIGUSR1); poll(NULL, 0, rand() % 43 + 20); - + MutexLocker l(mutex); if (time_sec() > time_to_check) { if (!::running) { --- conga/ricci/common/signals.c 2007/08/31 04:57:37 1.2 +++ conga/ricci/common/signals.c 2007/09/11 02:45:26 1.3 @@ -55,7 +55,7 @@ sigemptyset(&set); sigaddset(&set, sig); - + return (sigprocmask(SIG_BLOCK, &set, NULL)); } @@ -73,7 +73,7 @@ sigemptyset(&set); sigaddset(&set, sig); - + return (sigprocmask(SIG_UNBLOCK, &set, NULL)); } --- conga/ricci/docs/cluster_api.html 2007/03/10 04:57:47 1.7 +++ conga/ricci/docs/cluster_api.html 2007/09/11 02:45:26 1.8 @@ -8,15 +8,15 @@ -

Cluster module manages Red Hat Cluster Suite. +

Cluster module manages Red Hat Cluster Suite.

-

Module name: ???cluster??? +

Module name: ???cluster???

Module version: 1.0

See Modules - Common API for -general module description. +general module description.

-

Functions: +

Functions:

  • APIs

    @@ -42,7 +42,7 @@

    Input variables:
    - ???cluster.conf??? (XML) ??? required
    - ???propagate??? (boolean) ??? optional, defaults to ???false???

    -

    No output variables. +

    No output variables.

    On failure:
    - No special errors defined, only generic ones might get returned.

    @@ -51,7 +51,7 @@

      Retrieve cluster status. If node is not configured to be a part of cluster, empty <cluster/> tag will be returned.

      -

      No input variables. +

      No input variables.

      Output variables:
      - ???status??? (XML) ??? status of cluster, nodes and services.
      eg:
      <cluster minQuorum="1" @@ -75,7 +75,7 @@

      Start service ???servicename???. If ???nodename??? is specified, service is started on that node, otherwise it will be started on a node chosen by service manager.
      If service was not running, it - is started. If it was running, it is relocated to ???nodename???. + is started. If it was running, it is relocated to ???nodename???.

      Input variables:
      - ???servicename??? (string) ??? name of service to manipulate
      - ???nodename??? (string) ??? optional @@ -89,7 +89,7 @@

      Migrate the virtual service ???servicename??? to cluster node ???nodename.??? To migrate the virtual service, it must be started, and xend must be running and configured to allow live migration on both its current node and on ???nodename.??? If the service is not started, it will be started on ???nodename.???

      Input variables:
      - ???servicename??? (string) ??? name of - the virtual service to migrate.
      - ???nodename??? (string) ??? + the virtual service to migrate.
      - ???nodename??? (string) ??? name of node to which the virtual service is to be migrated.

      No output variables.

      On failure:
      - 1 ??? service manager is not running on this @@ -110,7 +110,7 @@

        Restart service ???servicename??? on node it is currently running. If service is not running, it will be started on a node - chosen by service manager. + chosen by service manager.

        Input variables:
        - ???servicename??? (string) ??? name of service to manipulate

        @@ -118,7 +118,7 @@

        On failure:
        - 1 ??? service manager is not running on this managed system
        - generic ones

      -
    • start_node +

    • start_node

        Start cluster infrastructure on this node (also, enable daemons' @@ -127,7 +127,7 @@

        Input variables:
        - ???cluster_startup??? (boolean) ??? optional, default ???false???, cluster is starting up (wait for all to come up, then start services ??? avoid fencing on startup)

        -

        No output variables. +

        No output variables.

        On failure:
        - No special errors defined, only generic ones might get returned.

        @@ -143,15 +143,15 @@ bounce services around)
        - ???purge_conf??? (boolean) ??? optional, default ???false???, delete cluster.conf; start_node() cannot be called any more, without calling set_cluster.conf() first -

        No output variables. +

        No output variables.

        On failure:
        - No special errors defined, only generic ones - might get returned. + might get returned.

    • fence_node

        -

        Fence node ???nodename???. +

        Fence node ???nodename???.

        Input variables:
        - nodename (string) ??? name of node to fence

        --- conga/ricci/docs/logging_api.html 2006/06/05 19:54:40 1.2 +++ conga/ricci/docs/logging_api.html 2007/09/11 02:45:26 1.3 @@ -9,14 +9,14 @@

        Log module retrieves log entries from system-wide log facilities, -or specified log files. +or specified log files.

        -

        Module name: ???log??? +

        Module name: ???log???

        -

        Module version: 1.0 +

        Module version: 1.0

        See Modules - Common API for -general module description. +general module description.

        Module parses log files based on following criteria:
        - what log files (defaults to /var/log/messages and /var/log/syslog)
        @@ -37,7 +37,7 @@ these tags.
        For example, ccsd log entry will get assigned ???ccsd??? and ???cluster??? tags; GFS entries will get ???gfs???, ???storage??? and ???cluster??? tags; dlm entries will get ???dlm???, ???cluster??? -and ???kernel??? tags, ... +and ???kernel??? tags, ...

        Defined tag groups:
        - ???cluster??? - matches all log entries from Cluster Suite (includes ???cluster service manager???, cman, @@ -47,7 +47,7 @@ Linux Virtual Server: ipvs, ipvsadm, piranha, ...
        - ???storage??? - matches all log entries about storage
        - ???selinux??? - matches selinux log entries (audit, pam_*, selinux)

        -

        Log entry format: +

        Log entry format:

        <logentry domain="what it is about" pid=???process ID??? age="age in seconds" msg="log message">
        <match @@ -61,23 +61,23 @@ was successfully matched against (there could be multiple, eg. if search was performed on ???kernel??? and ???cluster???, dlm log will be matched against both ??? could be used by UI to group or to find -intersections within result ??? eg. ???cluster??? and ???kernel???). +intersections within result ??? eg. ???cluster??? and ???kernel???).



        -

        Functions: +

        Functions:

          -
        • APIs +

        • APIs

          -
        • get +

        • get

            Retrieve union of matching log entries that are at @@ -87,7 +87,7 @@ optionally, specified using ???paths??? variable. Files rotated by logrotate are picked up automatically, eg. if /var/log/cron was specified, /var/log/cron.1 2 3 ... will get picked up - automatically. + automatically.

            Input variables:
            - ???age??? (int) ??? maximum age, in seconds, of log entries to retrieve
            - ???tags??? (list_str) ??? @@ -98,18 +98,18 @@ Directories are searched recursively. Relative and non-existent paths are discarded. If not specified, or empty, /var/log/messages and /var/log/syslog are processed (along with .1 .2 .3 ... - extensions). + extensions).

            Output variables:
            - ???log_entries??? (list_xml) ??? list of matching entries (see above for <logentry/> - format) + format)

            On failure:
            - No special errors defined, only - generic ones might get returned + generic ones might get returned



        - \ No newline at end of file + --- conga/ricci/docs/modules.html 2007/02/05 20:08:28 1.5 +++ conga/ricci/docs/modules.html 2007/09/11 02:45:26 1.6 @@ -9,7 +9,7 @@

        Modules Common - Common Module -Format and API +Format and API

        Management Modules:

          @@ -27,7 +27,7 @@ ATA-raid, iSCSI targets, dm-crypt, md-crypt, filesystems, their properties, mounts, ...

        • Log Module ??? Retrieves log - entries from system-wide log facilities, or specified log files. + entries from system-wide log facilities, or specified log files.

        • Reboot module ??? Allows system reboot

          --- conga/ricci/docs/modules_common.html 2006/04/12 22:41:20 1.2 +++ conga/ricci/docs/modules_common.html 2007/09/11 02:45:26 1.3 @@ -12,7 +12,7 @@ <response/>.
          In case of API error, <API_error/> is returned. <API_error/> will have ???description??? attribute. <API_error/> will also have a variable ???APIs??? (list_str) -attached to it, to ease debugging. +attached to it, to ease debugging.

          <request/> has a <function_call/> and ???API_version??? (required) and ???sequence??? (optional) attributes. ???sequence??? @@ -26,7 +26,7 @@ Variables for <var/> description.

          <function_response/>:
          <function_response/> will have ???function_name??? attribute, and returned <var/>s -attached to it. Variables are defined by respective function calls. +attached to it. Variables are defined by respective function calls.

          There will always be a ???success??? (boolean) variable in <function_response/>, besides function return values.
          If @@ -37,7 +37,7 @@ respective module functions; exception is generic_error (-1) which covers all other errors.
          Error descriptions are human readable descriptions of error; exception is generic error whose description -might be too primitive for end-user consumption. +might be too primitive for end-user consumption.



          @@ -45,14 +45,14 @@
          • APIs

              -

              Retrieve list of supported API versions. +

              Retrieve list of supported API versions.

              -

              No input variables. +

              No input variables.

              Output variables:
              - ???APIs??? (list_str) ??? list of supported APIs

              On failure:
              - No special errors defined, only - generic ones might get returned. + generic ones might get returned.

          @@ -123,4 +123,4 @@



          - \ No newline at end of file + --- conga/ricci/docs/reboot_api.html 2006/04/12 15:47:09 1.1 +++ conga/ricci/docs/reboot_api.html 2007/09/11 02:45:26 1.2 @@ -8,15 +8,15 @@ -

          Reboot module allows system reboot. +

          Reboot module allows system reboot.

          -

          Module name: ???reboot??? +

          Module name: ???reboot???

          Module version: 1.0

          See Modules - Common API for -general module description. +general module description.

          -

          Functions: +

          Functions:

          • APIs

            @@ -34,10 +34,10 @@ Execute it asynchronously, retrieving batch status periodically (there will be a period when ricci will not be responding). When batch reports successful completion, kernel has been upgraded, and - it is in use (system has been rebooted). + it is in use (system has been rebooted).

            No input variables.

            -

            No output variables. +

            No output variables.

            On failure:
            - No special errors defined, only generic ones might get returned.

            @@ -46,4 +46,4 @@



            - \ No newline at end of file + --- conga/ricci/docs/ricci_api.html 2006/06/09 16:32:19 1.3 +++ conga/ricci/docs/ricci_api.html 2007/09/11 02:45:26 1.4 @@ -14,13 +14,13 @@ client is considered authenticated, otherwise, client can invoke only ???authenticate??? function (see bellow). Once authenticated, presented certificate is saved into cert database, and client has -access to all functions. +access to all functions.



            All messages are XML based. Client is greeted with hello message on connection establishment, then client submits request and waits -for response. Client can make multiple requests in a single session. +for response. Client can make multiple requests in a single session.

            1. Hello message:

              @@ -33,20 +33,20 @@ ???authenticated??? attribute is ???true??? client is authenticated and can proceed with further calls, otherwise, client can only invoke ???authenticate??? function (see bellow). Once authenticated, - client can invoke all functions. + client can invoke all functions.

              -
            2. Request: +

            3. Request:

              Tag has to be ???ricci???, and ???version??? and ???function??? attributes have to be present. Functions, and their arguments are - described below. + described below.

              -
            4. Function response: +

            5. Function response:

              <ricci authenticated="true/false" success="success value ??? unsigned int" version="1.0"/>

              Function response has ???ricci??? tag, and ???authenticated???, - ???version??? and ???success??? attributes. + ???version??? and ???success??? attributes.

              Ricci function call successfulness is stored in ???success??? attr, and can be one of:

              @@ -74,7 +74,7 @@
              Subsequent connections that present saved cert will be auto-authenticated.
              If signing CA is listed in /var/lib/ricci/certs/auth_CAs.pem, certificate is considered valid, - and client needs not call this function at all. + and client needs not call this function at all.

              Function takes only ???password??? argument, specified as an attribute. It has to be a valid root password of @@ -84,11 +84,11 @@ certificate is saved into cert database, and function returns 0. Afterwards, client has access to all functions. If new connection is initiated using the same certificate, client will have full - access without need to call ???authenticate??? function. + access without need to call ???authenticate??? function.

              This is the only function that can be invoked if ???authenticated??? attribute of hello message is set to ???false???. -
              Once authenticated, access is allowed to all functions. +
              Once authenticated, access is allowed to all functions.

        • unauthenticate

          @@ -99,10 +99,10 @@ SSL certificate from cert database.
          Access will be allowed to ???authenticate??? function only.
          New connections, established using current certificate, will not be auto-authenticated; client - will have to re-authenticate. + will have to re-authenticate.

          Function takes no arguments.
          - Function should - always succeed and return 0. + always succeed and return 0.

      • list_modules

        @@ -113,7 +113,7 @@ attached to the response message, in format:
        <module name=???module1???/>
        <module name=???module2???/>

        Function takes no arguments.
        - Function should - always succeed and return 0. + always succeed and return 0.

    • process_batch

      @@ -125,25 +125,25 @@ name=???module2???>
      ... module2 request ...
      </module>
      </batch>
      </ricci>

      Processes batch request, see below for batch - description. + description.

      Processing can be synchronous and asynchronous. If synchronous, ???process_batch??? will return after the whole batch is completed, returning final batch report. There is no way to - retrieve report again. + retrieve report again.

      If asynchronous, ???process_batch??? will return immediately, returning initial batch report (???batch_id??? can be extracted from it). Batch report can be retrieved later, using ???batch_report??? function. Since batch progress is updated for multi-module request, asynchronous processing can be used to - implement progress bars. + implement progress bars.

      Function takes two arguments, async attribute - (defaults to ???false???), and batch. + (defaults to ???false???), and batch.

      - Function returns 11, if batch is missing.
      - - Otherwise it returns 0. + Otherwise it returns 0.

  • batch_report

    @@ -151,24 +151,24 @@

    <ricci function="batch_report" batch_id=???batch_id??? version="1.0"/>

    -

    Retrieve report of batch with id ???batch_id???. +

    Retrieve report of batch with id ???batch_id???.

    Batch report is attached to the function response. If batch is completed (status is either 0 or 4), report will be removed, and won't be accessible any more; otherwise, it can be - retrieved again. + retrieved again.

    Function takes one arguments, ???batch_id???, whose - report is attached to the function response. + report is attached to the function response.

    - Function returns 12, if there is no batch with such - ???batch_id???.
    - It returns 0 otherwise. + ???batch_id???.
    - It returns 0 otherwise.



-

Batch description: +

Batch description:

Batch is a list of module requests (see respective module description for request description). It has a ???batch_id??? @@ -177,7 +177,7 @@ is aborted, and batch' status is set to 4 ??? request failure. If all modules complete successfully, batch' status is set to 0.
Each module, and batch, has a status attribute, describing its progress. -Status is updated after completion of each module. +Status is updated after completion of each module.

<batch batch_id="10271302" status="2">
<module name="module1" @@ -188,7 +188,7 @@

Status codes:
0 - completed successfully (batch and module)
1 - scheduled (batch and module)
2 - in progress (batch and module)
3 - module failure (module only)
4 - request failure (batch -and module)
5 - removed from scheduler (module only) +and module)
5 - removed from scheduler (module only)



@@ -196,4 +196,4 @@



- \ No newline at end of file + --- conga/ricci/docs/rpm_api.html 2007/02/05 20:08:28 1.3 +++ conga/ricci/docs/rpm_api.html 2007/09/11 02:45:26 1.4 @@ -10,30 +10,30 @@

Rpm module manages rpm packages. Allows retrieval of currently installed rpms, querying repositories, and installation/upgrade of -rpms using repositories. (rpm and up2date/yum frontend) +rpms using repositories. (rpm and up2date/yum frontend)

-

Module name: ???rpm??? +

Module name: ???rpm???

Module version: 1.0

See Modules - Common API for -general module description. +general module description.

Rpm module has a notion of rpm and set (set of rpms). Sets are here to simplify installation of multiple packages, eg cluster -deployment. +deployment.

<rpm name=???rpm name??? summary=???summary??? description=???description??? version=???installed version??? repo_version=???version in repository???/>
If ???version??? is empty, rpm is not installed. If ???repo_version??? is empty, package is not in repository. If ???repo_version??? > ???version???, -package can be installed/upgraded. +package can be installed/upgraded.

<set name=???set name??? summary=???summary??? description=???description??? installed="true" in_repository="true" installable="true"/>
If installable is ???true???, set of rpms can be installed, if not -installed; and upgraded, if already installed. +installed; and upgraded, if already installed.

There are couple of predefined rpm sets:
- ???Cluster Base??? - base infrastructure of Red Hat Cluster Suite (currently ccs, cman, @@ -44,7 +44,7 @@ magma-plugins)
- ???Clustered Storage??? - shared storage (currently GFS, lvm2-cluster and respective kernel-... rpms)
- ???Linux Virtual Server??? - (currently ipvsadm, piranha)

-

Functions: +

Functions:

  • APIs

    @@ -72,24 +72,24 @@

    On failure:
    - No special errors defined, only generic ones might get returned.

-
  • query +

  • query

      Query rpms and sets, both locally installed and in - repository, by rpm/set name. + repository, by rpm/set name.

      Input variables:
      - ???search??? (list_xml) ??? list of rpms and sets to query. Rpm format <rpm name=???rpm name???/>; set - format <set name=???set name???/>. + format <set name=???set name???/>.

      Output variables:
      - ???result??? (list_xml) ??? - list of matching rpms and sets. + list of matching rpms and sets.

      On failure:
      - No special errors defined, only generic ones - might get returned. + might get returned.

    -
  • install +

  • install

      Install/upgrade rpms and sets from repository.

      @@ -97,25 +97,25 @@ install/upgrade. Rpm format <rpm name=???rpm name???/>.
      - ???sets??? (list_xml) ??? optional, list of sets to install/upgrade. Set format <set name=???set name???/>.
      - - ???upgrade??? (boolean) ??? optional (defaults to true), upgrade already installed packages/sets. + ???upgrade??? (boolean) ??? optional (defaults to true), upgrade already installed packages/sets.

      -

      No output variables. +

      No output variables.

      On failure:
      - No special errors defined, only generic ones - might get returned. + might get returned.

    -
  • repository_configured +

  • repository_configured

      Is this managed system configured to use repository, and capable of retrieving rpms?

      -

      No input variables. +

      No input variables.

      Output variables:
      - ??? repository_configured??? (boolean) ??? whether repository is available to this managed system

      On failure:
      - No special errors defined, only generic ones - might get returned. + might get returned.

    --- conga/ricci/docs/service_api.html 2007/02/23 22:02:57 1.4 +++ conga/ricci/docs/service_api.html 2007/09/11 02:45:26 1.5 @@ -11,15 +11,15 @@

    Service module manages system-wide services. Allows service start/stop and scheduling services to start on boot (service and chkconfig frontend).

    -

    Module name: ???service??? +

    Module name: ???service???

    Module version: 1.0

    See Modules - Common API for -general module description. +general module description.

    Service module has a notion of service and set (set of services). Sets are here to simplify management of multiple services, eg cluster -start/stop. +start/stop.

    <service description="description" enabled="true/false" name="service name" @@ -37,7 +37,7 @@ Manager??? - (currently rgmanager)
    - ???Clustered Storage??? - shared storage (currently clvmd, gfs)
    - ???Linux Virtual Server??? - (currently pulse, piranha-gui)

    -

    Functions: +

    Functions:

    • APIs

      @@ -49,7 +49,7 @@
      • list

          -

          Retrieve list of services and sets. +

          Retrieve list of services and sets.

          Input variables:
          - ???description??? (boolean) ??? optional, defaults to false, fill in ???description??? attribute (slow)

          @@ -58,10 +58,10 @@

          On failure:
          - No special errors defined, only generic ones might get returned.

        -
      • query +

      • query

          -

          Query services and sets by service/set name. +

          Query services and sets by service/set name.

          Input variables:
          - ???search??? (list_xml) ??? list of services and sets to query. Service format <service name=???rpm @@ -69,78 +69,78 @@ ???description??? (boolean) ??? optional, defaults to false, fill in ???description??? attribute (slow)

          Output variables:
          - ???result??? (list_xml) ??? - list of matching services and sets. + list of matching services and sets.

          On failure:
          - No special errors defined, only generic ones - might get returned. + might get returned.

      • enable

          Enable services/sets to start at boot time. It is not - error to enable already enabled service/set. + error to enable already enabled service/set.

          Input variables:
          - ???services??? (list_xml) ??? list of - services/sets to enable. For format see ???query???. + services/sets to enable. For format see ???query???.

          -

          No output variables. +

          No output variables.

          On failure:
          - No special errors defined, only generic ones - might get returned. + might get returned.

      • disable

          Disable services/sets startup at boot time. It is not - error to disable already disabled service/set. + error to disable already disabled service/set.

          Input variables:
          - ???services??? (list_xml) ??? list of - services/sets to disable. For format see ???query???. + services/sets to disable. For format see ???query???.

          -

          No output variables. +

          No output variables.

          On failure:
          - No special errors defined, only - generic ones might get returned. + generic ones might get returned.

      • start

          Start services/sets. It is not error to start already - started service/set. + started service/set.

          Input variables:
          - ???services??? (list_xml) ??? list of - services/sets to start. For format see ???query???. + services/sets to start. For format see ???query???.

          -

          No output variables. +

          No output variables.

          On failure:
          - No special errors defined, only - generic ones might get returned. + generic ones might get returned.

      • restart

          Restart services/sets.

          Input variables:
          - ???services??? (list_xml) ??? list of - services/sets to restart. For format see ???query???. + services/sets to restart. For format see ???query???.

          -

          No output variables. +

          No output variables.

          On failure:
          - No special errors defined, only - generic ones might get returned. + generic ones might get returned.

      • stop

          Stop services/sets. It is not error to stop already - stopped services/sets. + stopped services/sets.

          Input variables:
          - ???services??? (list_xml) ??? list of - services/sets to stop. For format see ???query???. + services/sets to stop. For format see ???query???.

          -

          No output variables. +

          No output variables.

          On failure:
          - No special errors defined, only - generic ones might get returned. + generic ones might get returned.

      --- conga/ricci/docs/storage-bd_template.html 2006/04/12 22:41:20 1.1 +++ conga/ricci/docs/storage-bd_template.html 2007/09/11 02:45:26 1.2 @@ -11,7 +11,7 @@

      <block_device_template/> is used for creation of new <block_device/>s. It can be found in <mapper/> under -<new_targets/>. +<new_targets/>.



      @@ -20,7 +20,7 @@ to Storage Module using ???create_bd??? function.
      <block_device_template/>'s properties and content can be modified using the same rules before calling ???create_bd??? -function. +function.



      @@ -28,4 +28,4 @@
      <block_device_template/> has the same format as <block_device/>, except that it doesn't have ???path??? attribute. 
       Path of newly created block device can be extracted from return value of ???create_bd??? function. 
      - \ No newline at end of file + --- conga/ricci/docs/storage-bds.html 2006/04/12 22:41:20 1.1 +++ conga/ricci/docs/storage-bds.html 2007/09/11 02:45:26 1.2 @@ -12,7 +12,7 @@ <block_device/> is a target of some <mapper/>.

      Every block device has <content/>, -which represent data stored on block device. +which represent data stored on block device.



      @@ -20,13 +20,13 @@
      • Existing block devices are retrieved either by using ???get_bd(path)??? function or by - extraction from <mapper/>. + extraction from <mapper/>.

      • New block devices are created by submitting <block_device_template/> from <new_targets/> of <mapper/> to Storage Module using ???create_bd??? function. - +

      • Properties are changed by modifying <properties/> tag, see bellow, and submitting <block_device/> to Storage Module @@ -40,7 +40,7 @@

      • Block devices are removed by submitting <block_device/> to Storage Module using ???remove_bd??? function. Operation will succeed only if bd's ???removable??? property is - ???true???. + ???true???.



      @@ -55,7 +55,7 @@ also has a ???path??? and ???state_ind???. State indicator ???state_ind??? is a hashed string of block device properties; if something changes on a block device, its state indicator will change - as well. It is used to detect mid-air collisions. + as well. It is used to detect mid-air collisions.

    • <properties/> tag, which has variables for children.
      Some @@ -65,7 +65,7 @@ different set of properties defined; some of them will be present in all block devices, eg ???removable???. See descriptions of respective LINKME mappers.
      Example of properties for Logical - Volume: + Volume:

        <properties>

        @@ -89,10 +89,10 @@
        • <content/> tag, which represent data stored on block device. <content/> also - contains data about new contents. + contains data about new contents.



        - \ No newline at end of file + --- conga/ricci/docs/storage-content.html 2006/04/12 22:41:20 1.1 +++ conga/ricci/docs/storage-content.html 2007/09/11 02:45:26 1.2 @@ -9,7 +9,7 @@

        <content/> represents a data stored on block device. Every -<block_device/> has a content. +<block_device/> has a content.

        There are four types of contents:

          @@ -23,7 +23,7 @@

          Contents are manipulated by changing <content/> tag of <block_device/>, and submitting <block_device/> to Storage Module using ???modify_bd??? -function. +function.

          • Content properties are changed by modifying <properties/> @@ -47,7 +47,7 @@ </content>

              -
            • Every <content/> has a ???type???. Type can be one of: +

            • Every <content/> has a ???type???. Type can be one of:

              • ???filesystem??? - in which case ???fs_type??? attribute @@ -55,10 +55,10 @@ ???extended_fs??? and ???gfs???

              • ???mapper_source??? - in which case ???mapper_type??? and ???mapper_id??? attributes will be present. They define <mapper/> - whose source this content is. + whose source this content is.

              • ???none??? - meaning that either useless data is present, or - module is not able to properly detect it. + module is not able to properly detect it.

              • ???hidden??? - internal use, eg extended partition


                @@ -68,7 +68,7 @@ properties can be mutable; modifying them and sending <block_device/> to Storage Module will commit changes to the disk.
                Contents have different set of properties defined. -
                Example of properties for Extended Filesystem: +
                Example of properties for Extended Filesystem:

                  <properties>
                  @@ -93,10 +93,10 @@ which can replace current content.
                  To replace current content, grab one of <content_template/>s, modify its properties, move it to <new_content/> and submit - <block_device/> to Storage Module. + <block_device/> to Storage Module.



                - \ No newline at end of file + --- conga/ricci/docs/storage-content_template.html 2006/04/12 22:41:20 1.1 +++ conga/ricci/docs/storage-content_template.html 2007/09/11 02:45:26 1.2 @@ -9,7 +9,7 @@

                <content_template/> is used for replacement of <content/> -on some <block_device/>. +on some <block_device/>.

                There are three types of content templates:

                  @@ -23,7 +23,7 @@ <content_template/> from <available_contents/> to <new_content/> of <content/>. It is module's responsibility to populate <available_contents/> -with appropriate content_templates. +with appropriate content_templates.



                  @@ -35,7 +35,7 @@
                  • Every <content_template/> has a ???type???. Type can be - one of: + one of:

                    • ???filesystem??? - in which case ???fs_type??? attribute @@ -43,10 +43,10 @@ ???extended_fs??? and ???gfs???

                    • ???mapper_source??? - in which case ???mapper_type??? attribute will be present. They define <mapper/> - whose source this content is going to be. + whose source this content is going to be.

                    • ???none??? - meaning that current content will be destroyed. - +

                  • <properties/> tag, which has @@ -54,7 +54,7 @@ be different that properties of <content/> of the same type.
                    Some properties can be mutable.
                    Contents have different set of properties defined.
                    Example of properties for Swap - Filesystem: + Filesystem:

                      <properties>
                      @@ -69,4 +69,4 @@
                       
                      - \ No newline at end of file + --- conga/ricci/docs/storage-mapper_template.html 2006/04/12 22:41:20 1.1 +++ conga/ricci/docs/storage-mapper_template.html 2007/09/11 02:45:26 1.2 @@ -10,7 +10,7 @@

                      <mapper_template/> is used for creation of new <mapper/>s. Mapper templates are retrieved using ???get_mapper_templates??? -function. +function.



                      @@ -19,7 +19,7 @@
                      Modify <properties/> tag, move at least ???min_sources??? <block_device/>s from <new_sources/> to <sources/>,submit <mapper_template/> using ???create_mapper???, and new <mapper/> -will be created. +will be created.



                      @@ -32,14 +32,14 @@
                      • Every mapper template has ???mapper_type??? that represents a - type of mapper that can be created using this template. + type of mapper that can be created using this template.

                      • <properties/> tag, which has variables for children.
                        Some properties can be mutable.
                        Every ???mapper_type??? template has different set of properties defined.
                        Every mapper template will have ???min_sources??? and ???max_sources??? defined.
                        Example of properties for - Partition Tables: + Partition Tables:

                          <properties>
                          @@ -57,10 +57,10 @@
                        • <new_sources/> tag, which has <block_device/>s for children. These block devices can become initial sources of newly created mapper. Move at least ???min_sources??? of them to - <sources/>. + <sources/>.



                        - \ No newline at end of file + --- conga/ricci/docs/storage-mappers.html 2006/04/12 22:41:20 1.1 +++ conga/ricci/docs/storage-mappers.html 2007/09/11 02:45:26 1.2 @@ -13,11 +13,11 @@ data manipulation.
                        Mappers abstract Volume Groups, Partition Tables, RAIDs (Software and ATA), Multipath, dm-crypt, ... .
                        There is also a special Mapper that doesn't import anything, and exports -local and remote physical Hard Drives. +local and remote physical Hard Drives.

                        Imported block devices are called ???sources???, exported ones are called ???targets???; programs write data to targets, mapper writes -to sources. +to sources.



                        @@ -40,16 +40,16 @@

                        Mappers are manipulated in different ways:

                        • Existing mappers are retrieved using ???get_mappers??? - function. + function.

                        • Mappers are created by submitting <mapper_template/> to Storage Module using ???create_mapper??? function. Mapper templates are retrieved using ???get_mapper_templates??? - function. + function.

                        • Properties are changed by modifying <properties/> tag, see bellow, and submitting <mapper/> to Storage Module using - ???modify_mapper??? function. + ???modify_mapper??? function.

                        • New sources are added by submitting <block_device/>s from <new_sources/>, see below, to Storage Module using @@ -59,17 +59,17 @@ mapper's sources.
                          For some mapper_types, it is also possible to add new source manipulating <content/> of <block_device/> of other - mappers. + mappers.

                        • New targets are created by submitting <block_device_template/> from <new_targets/>, see below, to Storage Module using - ???create_bd??? function. + ???create_bd??? function.

                        • Mappers are removed by submitting <mapper/> to Storage Module using ???remove_mapper??? function. Operation will succeed only if mapper's ???removable??? property is - ???true???. + ???true???.



                        @@ -88,7 +88,7 @@ ???state_ind???. State indicator ???state_ind??? is a hashed string of mapper properties; if something changes within mapper, its state indicator will change as well. It is used to detect mid-air - collisions. + collisions.

                      • <properties/> tag, which has variables for children.
                        Some properties can be mutable; modifying them and @@ -96,7 +96,7 @@ disk.
                        Every ???mapper_type??? has different set of properties defined; some of them will be present in all mappers, eg ???removable???. See descriptions of respective LINKME mappers. -
                        Example of properties for Volume Groups: +
                        Example of properties for Volume Groups:

                          <properties>
                          @@ -116,22 +116,22 @@
                           	
                        • <sources/> tag, which has <block_device/>s for children. Content of those block devices will be LINKME ???mapper_source???s of this mapper. Source block devices are - exported by some other mappers. + exported by some other mappers.

                        • <new_sources/> tag, which has <block_device/>s for children. These block devices can become new sources of this - mapper. + mapper.

                        • <targets/> tag, which has <block_device/>s for children. Target block devices are block devices exported by - this mapper, and can have anything for a content. + this mapper, and can have anything for a content.

                        • <new_targets/> tag, which has <block_device_template/>s for children. These templates are used for creation of new targets - of this mapper. + of this mapper.



                        - \ No newline at end of file + --- conga/ricci/docs/storage_api.html 2007/03/05 20:45:17 1.7 +++ conga/ricci/docs/storage_api.html 2007/09/11 02:45:26 1.8 @@ -13,11 +13,11 @@ dm-crypt, md-crypt, filesystems, their properties, mounts, ...
                        Currently, as of version 1.0, it supports LVM, partition tables, software RAID, ext2/3, swap, GFS and mountpoints.

                        -

                        Module name: ???storage??? +

                        Module name: ???storage???

                        Module version: 1.0

                        See Modules - Common API for -general module description. +general module description.



                        @@ -49,22 +49,22 @@

                        All functions might fail with generic error (-1), see Modules - Common API for error description, or one of Storage Module -Specific: +Specific:

                        • 1 ??? mid-air collision
                          Every object has a state indicator associated with it. Before anything is committed to disk, storage is probed and local state indicator is calculated. Local indicator is compared with the one committed by client, if different, mid-air - error is raised. This prevents accidental data destruction. + error is raised. This prevents accidental data destruction.

                        • 2 ??? validation error
                          Every property has constraints associated with it. If property is modified, and it is not within valid constraints, validation error is returned, before anything is - committed to disk. + committed to disk.

                        • 3 ??? umount error
                          It will happen in the case of umount - failure. + failure.

                        • 4 ??? clvmd not running
                          Clustered Volume Groups need clvmd daemon running, and yet clvmd is not running.
                          Storage module @@ -76,38 +76,38 @@

                        • 5 ??? cluster not quorate
                          LVM is configured to use cluster locking mechanism, but cluster is not quorate. That would cause LVM operations to hang until quorum is regained. User should make - cluster quorate before continuing. + cluster quorate before continuing.

                        • 6 ??? cluster locking not enabled
                          LVM is not configured to use cluster - locking mechanism, but some volumes are marked clustered. - User should enable cluster locking. + locking mechanism, but some volumes are marked clustered. + User should enable cluster locking.

                        • 7 ??? cluster not running on node
                          LVM is configured to use cluster - locking mechanism, but cluster is not running on local node. + locking mechanism, but cluster is not running on local node.



                        -

                        Functions: +

                        Functions:

                        • APIs

                        • report

                            -

                            Assemble all info into a single report. +

                            Assemble all info into a single report.

                            -

                            No input variables. +

                            No input variables.

                            Output variables:
                            - ???mapper_templates??? (list_xml) ??? list of <mapper_template/>s, @@ -121,7 +121,7 @@

                                On failure:
                                - No special errors defined, only generic ones - might get returned. + might get returned.

                            @@ -132,7 +132,7 @@

                              Retrieve all mapper templates on the system. If ???mapper_type??? is specified, - retrieve mapper templates of specified type only. + retrieve mapper templates of specified type only.

                              Input variables:
                              - ???mapper_type??? (string) ??? optional, if specified, retrieve mapper templates of specified type

                              @@ -153,7 +153,7 @@

                              Retrieve ???mapper_id???s of all mappers on the system. If ???mapper_type??? is specified, retrieve ???mapper_id???s of specified type only.
                              Mapper id can be used to retrieve - mapper using ???get_mappers??? function. + mapper using ???get_mappers??? function.

                              Input variables:
                              - ???mapper_type??? (string) ??? optional, if specified, retrieve IDs of mappers of specified type, otherwise, @@ -173,7 +173,7 @@

                                  Retrieve all mappers on the system. ???mapper_type??? - and ???mapper_id??? can be used to limit the scope of search. + and ???mapper_id??? can be used to limit the scope of search.

                                  Input variables:
                                  - ???mapper_type??? (string) ??? optional, if specified, retrieve IDs of mappers of specified type
                                  - @@ -212,7 +212,7 @@

                                    -

                                    Modify properties of already existing mapper. +

                                    Modify properties of already existing mapper.

                                    Input variables:
                                    - ???mapper??? (xml) ??? modified <mapper/> to be changed on disk

                                    @@ -247,7 +247,7 @@

                                      Output variables:
                                      - ???mapper??? (xml) ??? <mapper/> with new sources - added + added

                                      On failure:
                                      - Any of errors specified above

                                    @@ -256,11 +256,11 @@

                                        Remove source from mapper.
                                        Source removal - procedure:
                                        1 ??? retrieve mapper
                                        2 ??? extract block + procedure:
                                        1 ??? retrieve mapper
                                        2 ??? extract block device, which has alternative content, from <sources/> tag
                                        3 ??? submit block device, from 2, and mapper attributes, using this function

                                        -

                                        Input variables:
                                        - ???bd??? (xml) ??? +

                                        Input variables:
                                        - ???bd??? (xml) ??? <block_device/>, from mapper's <sources/> tag, to be removed
                                        - ???mapper_type??? (string) ??? type of mapper from which source @@ -274,7 +274,7 @@

                                          Output variables:
                                          - ???mapper??? (xml) ??? <mapper/> with source - removed + removed

                                          On failure:
                                          - Any of errors specified above

                                        @@ -304,7 +304,7 @@ created by submitting <block_device_template/> from <new_targets/> of <mapper/>, using this function.
                                        <block_device_template/>'s - properties and content can be modified before submission. + properties and content can be modified before submission.

                                        Input variables:
                                        - ???bd??? (xml) ??? modified <block_device_template/> @@ -324,7 +324,7 @@

                                          Get a block device by its path.
                                          Block devices can also be retrieved by extraction of <block_device/> - from <mapper/>. + from <mapper/>.

                                          Input variables:
                                          - ???path??? (string) ??? path to retrieve block device for

                                          @@ -344,7 +344,7 @@

                                          Modify properties of block device, its content, or replace content.
                                          See <block_device/> and <content/> for more - info. + info.

                                          Input variables:
                                          - ???bd??? (xml) ??? modified <block_device/> to be changed @@ -354,7 +354,7 @@

                                              Output variables:
                                              - ???bd??? (xml) ??? modified - <block_device/> + <block_device/>

                                              On failure:
                                              - Any of errors specified above, especially unmount error if content fails to unmount

                                              @@ -383,8 +383,8 @@
                                          • enable_clustered_lvm

                                              -

                                              Enable LVM's cluster locking. - It is an error to call this function if lvm2-cluster +

                                              Enable LVM's cluster locking. + It is an error to call this function if lvm2-cluster is not installed.

                                              No input variables. @@ -395,8 +395,8 @@

                                          • disable_clustered_lvm

                                              -

                                              Disable LVM's cluster locking. - It is an error to call this function if lvm2-cluster +

                                              Disable LVM's cluster locking. + It is an error to call this function if lvm2-cluster is not installed.

                                              No input variables. --- conga/ricci/docs/variables.html 2006/09/26 01:04:20 1.5 +++ conga/ricci/docs/variables.html 2007/09/11 02:45:26 1.6 @@ -18,14 +18,14 @@ - If a variable has an ifnot_bool=???bool_var_name??? attribute, it is to be used only if boolean variable named ???bool_var_name??? is set to ???false???.

                                              -

                                              Types: +

                                              Types:

                                              • int

                                                  -

                                                  Integer will be the value of attribute ???value???. +

                                                  Integer will be the value of attribute ???value???.

                                                  -

                                                  If mutable=???true???, constraints: +

                                                  If mutable=???true???, constraints:

                                                    min (attribute)

                                                    @@ -42,9 +42,9 @@
                                                • string

                                                    -

                                                    String will be the value of attribute ???value???. +

                                                    String will be the value of attribute ???value???.

                                                    -

                                                    If mutable=???true???, constraints: +

                                                    If mutable=???true???, constraints:

                                                      min_length (attribute)

                                                      @@ -65,13 +65,13 @@

                                                        Boolean will be the value of attribute ???value???. It can be one of ???true??? or ???false???.

                                                        -

                                                        There is no constraints. +

                                                        There is no constraints.

                                                    • xml

                                                        XML will be attached to the <var/>.

                                                        -

                                                        There is no constraints. +

                                                        There is no constraints.

                                                    • list_str

                                                      --- conga/ricci/init.d/ricci 2007/06/25 16:03:42 1.11 +++ conga/ricci/init.d/ricci 2007/09/11 02:45:27 1.12 @@ -86,18 +86,18 @@ exit 1 fi fi - + service saslauthd start >&/dev/null ssl_certs_ok if [ "1$?" != "10" ] ; then generate_ssl_certs fi - + NewUID=`grep "^$RUNASUSER:" /etc/passwd | sed -e 's/^[^:]*:[^:]*://' -e 's/:.*//'` echo -n $"Starting $ID: " daemon $RICCID -u $NewUID rtrn=$? - echo + echo if [ $rtrn -eq 0 ]; then touch "$LOCKFILE" @@ -109,7 +109,7 @@ restart) $0 stop - $0 start + $0 start rtrn=$? ;; @@ -132,7 +132,7 @@ /usr/bin/logger -t $RICCID "shutdown failed" rtrn=1 fi - echo + echo ;; condrestart) --- conga/ricci/make/defines.mk.in 2007/09/09 14:18:37 1.8 +++ conga/ricci/make/defines.mk.in 2007/09/11 02:45:27 1.9 @@ -1,6 +1,6 @@ # default params: -program-prefix ?= +program-prefix ?= prefix ?= ${DESTDIR}/usr exec-prefix ?= ${DESTDIR}/usr bindir ?= ${exec-prefix}/bin --- conga/ricci/modules/cluster/clumon/README.cim 2006/06/14 21:44:36 1.1 +++ conga/ricci/modules/cluster/clumon/README.cim 2007/09/11 02:45:27 1.2 @@ -1,5 +1,5 @@ -To execute following commands, Pegasus CIM server has to be running +To execute following commands, Pegasus CIM server has to be running and root account has to be used, Register Red Hat Cluster provider: @@ -9,5 +9,5 @@ cimmof -n root/cimv2 RedHat_ClusterSchema.mof -Refer to Pegasus documentation and /usr/share/doc/tog-pegasus for CIM +Refer to Pegasus documentation and /usr/share/doc/tog-pegasus for CIM user management and ACL. --- conga/ricci/modules/cluster/clumon/README.snmpd 2006/06/14 21:44:36 1.1 +++ conga/ricci/modules/cluster/clumon/README.snmpd 2007/09/11 02:45:27 1.2 @@ -42,7 +42,7 @@ group clusterGroup v2c localnet # name incl/excl subtree mask(optional) -view clusterview included REDHAT-CLUSTER-MIB:RedHatCluster +view clusterview included REDHAT-CLUSTER-MIB:RedHatCluster # group context sec.model sec.level prefix read write notif access clusterGroup "" any noauth prefix clusterview none none @@ -54,7 +54,7 @@ net-snmp client configuration: -Place REDHAT-MIB and REDHAT-CLUSTER-MIB into ~/.snmp/mibs/, and query cluster using: +Place REDHAT-MIB and REDHAT-CLUSTER-MIB into ~/.snmp/mibs/, and query cluster using: snmpwalk -v 2c -c COMMUNITY NODENAME REDHAT-CLUSTER-MIB::RedHatCluster (replace NODENAME with the hostname of one of cluster nodes running software) --- conga/ricci/modules/cluster/clumon/REDHAT-CLUSTER-MIB 2006/06/14 21:44:36 1.1 +++ conga/ricci/modules/cluster/clumon/REDHAT-CLUSTER-MIB 2007/09/11 02:45:27 1.2 @@ -13,7 +13,7 @@ 1801 Varsity Drive Raleigh, North Carolina 27606 USA - + email: customerservice at redhat.com " DESCRIPTION "Red Hat Cluster Suite MIB @@ -28,7 +28,7 @@ rhcMIBInfo OBJECT IDENTIFIER ::= { RedHatCluster 1 } rhcCluster OBJECT IDENTIFIER ::= { RedHatCluster 2 } rhcTables OBJECT IDENTIFIER ::= { RedHatCluster 3 } - + @@ -86,7 +86,7 @@ MAX-ACCESS read-only STATUS current DESCRIPTION - "Minimum number of votes required for quorum. + "Minimum number of votes required for quorum. If cluster is not quorate, all services are stopped." ::= { rhcCluster 4 } --- conga/ricci/modules/cluster/clumon/REDHAT-MIB 2006/06/14 21:44:36 1.1 +++ conga/ricci/modules/cluster/clumon/REDHAT-MIB 2007/09/11 02:45:27 1.2 @@ -13,7 +13,7 @@ 1801 Varsity Drive Raleigh, North Carolina 27606 USA - + email: customerservice at redhat.com " DESCRIPTION "Red Hat, Inc MIB --- conga/ricci/modules/cluster/clumon/RedHat_ClusterSchema.mof 2006/06/14 21:44:36 1.1 +++ conga/ricci/modules/cluster/clumon/RedHat_ClusterSchema.mof 2007/09/11 02:45:27 1.2 @@ -1,70 +1,70 @@ -[ Description ("RedHat Cluster. \nServices are accessible thru RedHat_ClusterHostingFailoverService.\nNodes are accessible thru RedHat_ClusterParticipatingNode.\nIf RequiredQuorum is not fulfilled, all services are stoped and Status is set to Degraded.\nIf some services have failed, Status is set to Stressed."), +[ Description ("RedHat Cluster. \nServices are accessible thru RedHat_ClusterHostingFailoverService.\nNodes are accessible thru RedHat_ClusterParticipatingNode.\nIf RequiredQuorum is not fulfilled, all services are stoped and Status is set to Degraded.\nIf some services have failed, Status is set to Stressed."), Version("0.0.2") ] class RedHat_Cluster : CIM_Cluster { [ Description("Number of available nodes' votes.") ] uint16 Votes; - + [ Description("Minimum quorum required for cluster to be operational.") ] uint16 VotesNeededForQuorum; - - + + [ Description("Number of nodes.") ] uint16 NodesNumber; - + [ Description("Number of available nodes.") ] uint16 AvailableNodesNumber; - + [ Description("Number of unavailable nodes.") ] uint16 UnavailableNodesNumber; - + [ Description("Node Names.") ] string NodesNames[]; - + [ Description("Available Nodes.") ] string AvailableNodesNames[]; - + [ Description("Unavailable Nodes.") ] string UnavailableNodesNames[]; - - + + [ Description("Number of services.") ] uint16 ServicesNumber; - + [ Description("Number of running services.") ] uint16 RunningServicesNumber; - + [ Description("Number of stopped services.") ] uint16 StoppedServicesNumber; - + [ Description("Number of failed services.") ] uint16 FailedServicesNumber; - + [ Description("Names of running services.") ] string ServicesNames[]; - + [ Description("Names of running services.") ] string RunningServicesNames[]; - + [ Description("Names of stopped services.") ] string StoppedServicesNames[]; - + [ Description("Names of failed services.") ] string FailedServicesNames[]; }; -[ Description("Cluster Node"), +[ Description("Cluster Node"), Version("0.0.2") ] class RedHat_ClusterNode : CIM_ComputerSystem { [ Key, Description("Name of cluster this node participates in.") ] string ClusterName; - + [ Description("Number of services running on this node") ] uint16 RunningServicesNumber; - + [ Description("Services running on this node") ] string RunningServicesNames[]; }; @@ -75,7 +75,7 @@ { [ Description("Node service runs on") ] string NodeName; - + [ Description("Cluster Name") ] string ClusterName; }; @@ -90,13 +90,13 @@ /* -[ Association, +[ Association, Description("Links cluster to cluster nodes."), Version("0.0.1") ] class RedHat_ClusterParticipatingNode : CIM_ParticipatingCS { [ Override("Antecedent") ] RedHat_ClusterNode REF Antecedent; - + [ Description("Number of node's votes participating in cluster quorum.") ] uint16 QuorumVotes; }; @@ -109,7 +109,7 @@ { [ Override("Antecedent") ] RedHat_Cluster REF Antecedent; - + [ Override("Dependent") ] RedHat_ClusterFailoverService REF Dependent; }; @@ -122,7 +122,7 @@ { [ Override("Antecedent") ] RedHat_ClusterNode REF Antecedent; - + [ Override("Dependent") ] RedHat_ClusterFailoverService REF Dependent; }; --- conga/ricci/modules/cluster/clumon/init.d/modclusterd 2006/10/14 18:52:23 1.2 +++ conga/ricci/modules/cluster/clumon/init.d/modclusterd 2007/09/11 02:45:27 1.3 @@ -57,7 +57,7 @@ restart) $0 stop sleep 8 - $0 start + $0 start rtrn=$? ;; --- conga/ricci/modules/cluster/clumon/src/cim-provider/ClusterProvider.cpp 2006/08/10 22:53:08 1.3 +++ conga/ricci/modules/cluster/clumon/src/cim-provider/ClusterProvider.cpp 2007/09/11 02:45:27 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -46,19 +46,19 @@ -static CIMInstance +static CIMInstance buildClusterInstance(counting_auto_ptr& cluster, Boolean qual, Boolean orig); -static CIMInstance +static CIMInstance buildNodeInstance(counting_auto_ptr& node, Boolean qual, Boolean orig); -static CIMInstance +static CIMInstance buildServiceInstance(counting_auto_ptr& service, Boolean qual, Boolean orig); -static CIMObjectPath +static CIMObjectPath buildClusterInstancePath(counting_auto_ptr& cluster, const CIMNamespaceName& nameSpace); -static CIMObjectPath +static CIMObjectPath buildNodeInstancePath(counting_auto_ptr& node, const CIMNamespaceName& nameSpace); -static CIMObjectPath +static CIMObjectPath buildServiceInstancePath(counting_auto_ptr& service, const CIMNamespaceName& nameSpace); @@ -79,13 +79,13 @@ // CIMProvider interface -void +void ClusterProvider::initialize (CIMOMHandle& cimom) { log("ClusterProvider::initialize called"); } -void +void ClusterProvider::terminate (void) { log("ClusterProvider::terminate called"); @@ -94,7 +94,7 @@ // CIMInstanceProvider interface -void +void ClusterProvider::getInstance(const OperationContext &context, const CIMObjectPath &ref, const Boolean includeQualifiers, @@ -103,18 +103,18 @@ InstanceResponseHandler &handler) { counting_auto_ptr cluster = _monitor.get_cluster(); - + SmartHandler t(handler); - + CIMName className(ref.getClassName()); - + log("getInstance(... " + className.getString() + " ...) called"); - + if(className.equal(CLUSTER_CLASSNAME)) { if(cluster.get() == NULL) return; - CIMObjectPath path = buildClusterInstancePath(cluster, + CIMObjectPath path = buildClusterInstancePath(cluster, ref.getNameSpace()); if(path.identical(ref)) { @@ -130,14 +130,14 @@ return; list > nodes = cluster->nodes(); for(list >::iterator iter = nodes.begin(); - iter != nodes.end(); + iter != nodes.end(); iter++) { - CIMObjectPath path = buildNodeInstancePath(*iter, + CIMObjectPath path = buildNodeInstancePath(*iter, ref.getNameSpace()); if(path.identical(ref)) { - CIMInstance inst = buildNodeInstance(*iter, + CIMInstance inst = buildNodeInstance(*iter, includeQualifiers, includeClassOrigin); handler.deliver(inst); @@ -150,14 +150,14 @@ return; list > services = cluster->services(); for(list >::iterator iter = services.begin(); - iter != services.end(); + iter != services.end(); iter++) { - CIMObjectPath path = buildServiceInstancePath(*iter, + CIMObjectPath path = buildServiceInstancePath(*iter, ref.getNameSpace()); if(path.identical(ref)) { - CIMInstance inst = buildServiceInstance(*iter, + CIMInstance inst = buildServiceInstance(*iter, includeQualifiers, includeClassOrigin); handler.deliver(inst); @@ -168,7 +168,7 @@ throw CIMInvalidParameterException(ref.toString()); } -void +void ClusterProvider::enumerateInstances(const OperationContext &context, const CIMObjectPath &ref, const Boolean includeQualifiers, @@ -177,13 +177,13 @@ InstanceResponseHandler &handler) { counting_auto_ptr cluster = _monitor.get_cluster(); - + SmartHandler t(handler); - + CIMName className(ref.getClassName()); - + log("enumerateInstances(... " + className.getString() + " ...) called"); - + if(className.equal(CLUSTER_CLASSNAME)) { if(cluster.get() == NULL) @@ -199,10 +199,10 @@ return; list > nodes = cluster->nodes(); for(list >::iterator iter = nodes.begin(); - iter != nodes.end(); + iter != nodes.end(); iter++) { - CIMInstance inst = buildNodeInstance(*iter, + CIMInstance inst = buildNodeInstance(*iter, includeQualifiers, includeClassOrigin); handler.deliver(inst); @@ -214,10 +214,10 @@ return; list > services = cluster->services(); for(list >::iterator iter = services.begin(); - iter != services.end(); + iter != services.end(); iter++) { - CIMInstance inst = buildServiceInstance(*iter, + CIMInstance inst = buildServiceInstance(*iter, includeQualifiers, includeClassOrigin); handler.deliver(inst); @@ -227,19 +227,19 @@ throw CIMInvalidParameterException(ref.toString()); } -void +void ClusterProvider::enumerateInstanceNames(const OperationContext &context, const CIMObjectPath &classRef, ObjectPathResponseHandler &handler) { counting_auto_ptr cluster = _monitor.get_cluster(); - + SmartHandler t(handler); - + CIMName className(classRef.getClassName()); - + log("enumerateInstanceNames(... " + className.getString() + " ...) called"); - + if(className.equal(CLUSTER_CLASSNAME)) { if(cluster.get() == NULL) @@ -254,10 +254,10 @@ return; list > nodes = cluster->nodes(); for(list >::iterator iter = nodes.begin(); - iter != nodes.end(); + iter != nodes.end(); iter++) { - CIMObjectPath path = buildNodeInstancePath(*iter, + CIMObjectPath path = buildNodeInstancePath(*iter, classRef.getNameSpace()); handler.deliver(path); } @@ -268,10 +268,10 @@ return; list > services = cluster->services(); for(list >::iterator iter = services.begin(); - iter != services.end(); + iter != services.end(); iter++) { - CIMObjectPath path = buildServiceInstancePath(*iter, + CIMObjectPath path = buildServiceInstancePath(*iter, classRef.getNameSpace()); handler.deliver(path); } @@ -281,7 +281,7 @@ } -void +void ClusterProvider::createInstance(const OperationContext &context, const CIMObjectPath &ref, const CIMInstance &obj, @@ -290,7 +290,7 @@ throw CIMNotSupportedException(CLUSTER_PROVIDER_CLASSNAME + "::createInstance"); } -void +void ClusterProvider::modifyInstance(const OperationContext &context, const CIMObjectPath &ref, const CIMInstance &obj, @@ -301,7 +301,7 @@ throw CIMNotSupportedException(CLUSTER_PROVIDER_CLASSNAME + "::modifyInstance"); } -void +void ClusterProvider::deleteInstance(const OperationContext &context, const CIMObjectPath &ref, ResponseHandler &handler) @@ -314,7 +314,7 @@ // private -void +void ClusterProvider::log(const Pegasus::String& str) { ::log((const char*) str.getCString()); @@ -329,12 +329,12 @@ buildClusterInstance(counting_auto_ptr& cluster, Boolean qual, Boolean orig) { CIMInstance inst(CIMName(CLUSTER_CLASSNAME)); - + // Name inst.addProperty(CIMProperty( CIMName("Name"), CIMValue(Pegasus::String(cluster->name().c_str())))); - + // Caption //inst.addProperty(CIMProperty( // CIMName("Caption"), @@ -343,25 +343,25 @@ //inst.addProperty(CIMProperty( // CIMName("Description"), // CIMValue(Pegasus::String(cluster.name.c_str())))); - + // *** Votes *** - + inst.addProperty(CIMProperty( CIMName("Votes"), CIMValue(Uint16(cluster->votes())))); inst.addProperty(CIMProperty( CIMName("VotesNeededForQuorum"), CIMValue(Uint16(cluster->minQuorum())))); - - + + // *** Nodes *** - + list > nodes = cluster->nodes(); Array names; Array namesA; Array namesU; for(list >::iterator iterN = nodes.begin(); - iterN != nodes.end(); + iterN != nodes.end(); iterN++) { counting_auto_ptr& node = *iterN; @@ -385,24 +385,24 @@ CIMName("UnavailableNodesNumber"), CIMValue(Uint16(cluster->unclusteredNodes().size())))); inst.addProperty(CIMProperty( - CIMName("NodesNames"), + CIMName("NodesNames"), CIMValue(names))); inst.addProperty(CIMProperty( - CIMName("AvailableNodesNames"), + CIMName("AvailableNodesNames"), CIMValue(namesA))); inst.addProperty(CIMProperty( - CIMName("UnavailableNodesNames"), + CIMName("UnavailableNodesNames"), CIMValue(namesU))); - + // *** services *** - + list > services = cluster->services(); names.clear(); Array namesR; Array namesF; Array namesS; for(list >::iterator iterS = services.begin(); - iterS != services.end(); + iterS != services.end(); iterS++) { counting_auto_ptr& service = *iterS; @@ -410,7 +410,7 @@ names.append(name); if(service->running()) namesR.append(name); - else + else namesS.append(name); if(service->failed()) namesF.append(name); @@ -439,10 +439,10 @@ inst.addProperty(CIMProperty( CIMName("FailedServicesNames"), CIMValue(namesF))); - - + + // *** status begin *** - + bool online = cluster->clusteredNodes().size() > 0; bool failedServices = cluster->failedServices().size() != 0; bool stoppedServices = cluster->stoppedServices().size() != 0; @@ -495,7 +495,7 @@ Ostatus.append(10); statusD.append("Cluster stopped"); } - + //inst.addProperty(CIMProperty( // CIMName("Status"), // CIMValue(status))); @@ -505,7 +505,7 @@ inst.addProperty(CIMProperty( CIMName("StatusDescriptions"), CIMValue(statusD))); - + CIMValue clusterState; if(online) clusterState = CIMValue(Uint16(2)); // online @@ -514,55 +514,55 @@ inst.addProperty(CIMProperty( CIMName("ClusterState"), clusterState)); - + // *** status done *** - - + + // Types Array types; types.append(2); // failover inst.addProperty(CIMProperty( CIMName("Types"), CIMValue(types))); - - + + // CreationClassName inst.addProperty(CIMProperty( CIMName("CreationClassName"), CIMValue(Pegasus::String(CLUSTER_CLASSNAME)))); - + // ResetCapability //inst.addProperty(CIMProperty( // CIMName("ResetCapability"), // CIMValue(Uint16(5)))); // not implemented - cluster :) // PowerManagementCapabilities - + // ElementName // InstallDate - + // EnabledState // OtherEnabledState // EnabledDefault - + // RequestedState // TimeOfLastStateChange - + // Roles - + // NameFormat - + // PrimaryOwnerContact // PrimaryOwnerName // OtherIdentifingInfo // IdentifyingDescription - + // Dedicated // OtherDedicatedDescription - - + + // Interconnect // InterconnectAddress - + return inst; } @@ -573,24 +573,24 @@ /* [ Key, Description("Name of cluster this node participates in.") ] string ClusterName; - + [ Description("Number of services running on this node") ] uint16 RunningServicesNumber; - + [ Description("Services running on this node") ] uint16 RunningServicesNames; */ - + // ClusterName inst.addProperty(CIMProperty( CIMName("ClusterName"), CIMValue(Pegasus::String(node->clustername().c_str())))); - + // Name inst.addProperty(CIMProperty( CIMName("Name"), CIMValue(Pegasus::String(node->name().c_str())))); - + // Caption //inst.addProperty(CIMProperty( // CIMName("Caption"), @@ -599,20 +599,20 @@ //inst.addProperty(CIMProperty( // CIMName("Description"), // CIMValue(Pegasus::String(cluster.name.c_str())))); - - + + // *** Votes *** - + inst.addProperty(CIMProperty( CIMName("Votes"), CIMValue(Uint16(node->votes())))); - + // *** services *** - + list > services = node->services(); Array names; for(list >::iterator iter = services.begin(); - iter != services.end(); + iter != services.end(); iter++) { Pegasus::String name((*iter)->name().c_str()); @@ -624,10 +624,10 @@ inst.addProperty(CIMProperty( CIMName("RunningServicesNames"), CIMValue(names))); - - + + // *** status begin *** - + Array Ostatus; // OperationalStatus Array statusD; // StatusDescription if(node->online() && node->clustered()) @@ -648,7 +648,7 @@ Ostatus.append(10); statusD.append("Node not running"); } - + //inst.addProperty(CIMProperty( // CIMName("Status"), // CIMValue(status))); @@ -658,41 +658,41 @@ inst.addProperty(CIMProperty( CIMName("StatusDescriptions"), CIMValue(statusD))); - - + + // CreationClassName inst.addProperty(CIMProperty( CIMName("CreationClassName"), CIMValue(Pegasus::String(CLUSTER_NODE_CLASSNAME)))); - + // ResetCapability //inst.addProperty(CIMProperty( // CIMName("ResetCapability"), // CIMValue(Uint16(5)))); // not implemented - cluster :) // PowerManagementCapabilities - + // ElementName // InstallDate - + // EnabledState // OtherEnabledState // EnabledDefault - + // RequestedState // TimeOfLastStateChange - + // Roles - + // NameFormat - + // PrimaryOwnerContact // PrimaryOwnerName // OtherIdentifingInfo // IdentifyingDescription - + // Dedicated // OtherDedicatedDescription - + return inst; } @@ -700,12 +700,12 @@ buildServiceInstance(counting_auto_ptr& service, Boolean qual, Boolean orig) { CIMInstance inst(CIMName(CLUSTER_SERVICE_CLASSNAME)); - + // Name inst.addProperty(CIMProperty( CIMName("Name"), CIMValue(Pegasus::String(service->name().c_str())))); - + // Caption //inst.addProperty(CIMProperty( // CIMName("Caption"), @@ -714,12 +714,12 @@ //inst.addProperty(CIMProperty( // CIMName("Description"), // CIMValue(Pegasus::String(cluster.name.c_str())))); - + // ClusterName inst.addProperty(CIMProperty( CIMName("ClusterName"), CIMValue(Pegasus::String(service->clustername().c_str())))); - + // Started inst.addProperty(CIMProperty( CIMName("Started"), @@ -733,7 +733,7 @@ inst.addProperty(CIMProperty( CIMName("StartMode"), CIMValue(autostart))); - + // NodeName if(service->running()) { @@ -742,9 +742,9 @@ CIMName("NodeName"), CIMValue(nodeName))); } - + // *** status begin *** - + Array Ostatus; // OperationalStatus Array statusD; // StatusDescription if(service->failed()) @@ -775,91 +775,91 @@ CIMName("StatusDescriptions"), CIMValue(statusD))); // *** status done *** - + // CreationClassName inst.addProperty(CIMProperty( CIMName("CreationClassName"), CIMValue(Pegasus::String(CLUSTER_SERVICE_CLASSNAME)))); - + // SystemCreationClassName inst.addProperty(CIMProperty( CIMName("SystemCreationClassName"), CIMValue(Pegasus::String(CLUSTER_CLASSNAME)))); - + // SystemName inst.addProperty(CIMProperty( CIMName("SystemName"), CIMValue(Pegasus::String(service->clustername().c_str())))); - - + + // ElementName // InstallDate - + // EnabledState // OtherEnabledState // EnabledDefault - + // RequestedState // TimeOfLastStateChange - + // PrimaryOwnerContact // PrimaryOwnerName // OtherIdentifingInfo // IdentifyingDescription - + return inst; } -CIMObjectPath -buildClusterInstancePath(counting_auto_ptr& cluster, +CIMObjectPath +buildClusterInstancePath(counting_auto_ptr& cluster, const CIMNamespaceName& nameSpace) { Array keys; - keys.append(CIMKeyBinding("CreationClassName", - Pegasus::String(CLUSTER_CLASSNAME), + keys.append(CIMKeyBinding("CreationClassName", + Pegasus::String(CLUSTER_CLASSNAME), CIMKeyBinding::STRING)); - keys.append(CIMKeyBinding("Name", - Pegasus::String(cluster->name().c_str()), + keys.append(CIMKeyBinding("Name", + Pegasus::String(cluster->name().c_str()), CIMKeyBinding::STRING)); return CIMObjectPath(hostname(), nameSpace, CLUSTER_CLASSNAME, keys); } -CIMObjectPath -buildNodeInstancePath(counting_auto_ptr& node, +CIMObjectPath +buildNodeInstancePath(counting_auto_ptr& node, const CIMNamespaceName& nameSpace) { Array keys; - keys.append(CIMKeyBinding("CreationClassName", - Pegasus::String(CLUSTER_NODE_CLASSNAME), + keys.append(CIMKeyBinding("CreationClassName", + Pegasus::String(CLUSTER_NODE_CLASSNAME), CIMKeyBinding::STRING)); - keys.append(CIMKeyBinding("Name", - Pegasus::String(node->name().c_str()), + keys.append(CIMKeyBinding("Name", + Pegasus::String(node->name().c_str()), CIMKeyBinding::STRING)); - keys.append(CIMKeyBinding("ClusterName", - Pegasus::String(node->clustername().c_str()), + keys.append(CIMKeyBinding("ClusterName", + Pegasus::String(node->clustername().c_str()), CIMKeyBinding::STRING)); return CIMObjectPath(hostname(), nameSpace, CLUSTER_NODE_CLASSNAME, keys); } -CIMObjectPath -buildServiceInstancePath(counting_auto_ptr& service, +CIMObjectPath +buildServiceInstancePath(counting_auto_ptr& service, const CIMNamespaceName& nameSpace) { Array keys; - keys.append(CIMKeyBinding("CreationClassName", - Pegasus::String(CLUSTER_SERVICE_CLASSNAME), + keys.append(CIMKeyBinding("CreationClassName", + Pegasus::String(CLUSTER_SERVICE_CLASSNAME), CIMKeyBinding::STRING)); - keys.append(CIMKeyBinding("Name", - Pegasus::String(service->name().c_str()), + keys.append(CIMKeyBinding("Name", + Pegasus::String(service->name().c_str()), CIMKeyBinding::STRING)); - keys.append(CIMKeyBinding("SystemCreationClassName", - Pegasus::String(CLUSTER_CLASSNAME), + keys.append(CIMKeyBinding("SystemCreationClassName", + Pegasus::String(CLUSTER_CLASSNAME), CIMKeyBinding::STRING)); - keys.append(CIMKeyBinding("SystemName", - Pegasus::String(service->clustername().c_str()), + keys.append(CIMKeyBinding("SystemName", + Pegasus::String(service->clustername().c_str()), CIMKeyBinding::STRING)); return CIMObjectPath(hostname(), nameSpace, CLUSTER_SERVICE_CLASSNAME, keys); } @@ -870,12 +870,12 @@ { Pegasus::String hostname; struct utsname uts; - + if (uname(&uts) == 0) hostname = uts.nodename; else hostname = "unknown"; - + return hostname; } @@ -913,7 +913,7 @@ class Association -{ +{ public: Association(CIMInstance assoc, CIMObjectPath assocPath, CIMInstance ante, CIMObjectPath antePath, @@ -921,30 +921,30 @@ assoc(assoc), assocPath(assocPath), ante(ante), antePath(antePath), dep(dep), depPath(depPath) {} - + CIMInstance assoc; CIMObjectPath assocPath; CIMInstance ante; CIMObjectPath antePath; CIMInstance dep; CIMObjectPath depPath; -}; +}; -vector -buildAssociations(Cluster& cluster, - const CIMNamespaceName& nameSpace, - Boolean quals, +vector +buildAssociations(Cluster& cluster, + const CIMNamespaceName& nameSpace, + Boolean quals, Boolean orig); -static CIMInstance -buildClusterParticipatingNodeInstance(Cluster& cluster, - Node& node, +static CIMInstance +buildClusterParticipatingNodeInstance(Cluster& cluster, + Node& node, const CIMNamespaceName& nameSpace, - Boolean qual, + Boolean qual, Boolean orig); -static CIMObjectPath +static CIMObjectPath buildClusterParticipatingNodeInstancePath(Cluster& cluster, Node& node, const CIMNamespaceName& nameSpace); @@ -952,29 +952,29 @@ // CIMAssociationProvider interface -void +void ClusterProvider::associatorNames(const OperationContext& context, const CIMObjectPath& objectName, const CIMName& associationClass, const CIMName& resultClass, const Pegasus::String& role, const Pegasus::String& resultRole, - ObjectPathResponseHandler& handler) + ObjectPathResponseHandler& handler) { counting_auto_ptr cluster = _monitor.get_cluster(); - + SmartHandler t(handler); - - log("associatorNames(" + objectName.toString() + ", " + + + log("associatorNames(" + objectName.toString() + ", " + associationClass.getString() + ", " + resultClass.getString() + ", " + - role + ", " + + role + ", " + resultRole + ", ...) called"); return; - + } - -void + +void ClusterProvider::associators(const OperationContext& context, const CIMObjectPath& objectName, const CIMName& associationClass, @@ -987,19 +987,19 @@ ObjectResponseHandler& handler) { counting_auto_ptr cluster = _monitor.get_cluster(); - + SmartHandler t(handler); - - log("associatorNames(" + objectName.toString() + ", " + + + log("associatorNames(" + objectName.toString() + ", " + associationClass.getString() + ", " + resultClass.getString() + ", " + - role + ", " + + role + ", " + resultRole + ", ...) called"); return; - + } - -void + +void ClusterProvider::referenceNames(const OperationContext& context, const CIMObjectPath& objectName, const CIMName& resultClass, @@ -1007,55 +1007,55 @@ ObjectPathResponseHandler& handler) { counting_auto_ptr cluster = _monitor.get_cluster(); - + SmartHandler t(handler); - + CIMName className(objectName.toString()); - - log("referenceNames(" + objectName.toString() + ", " + + + log("referenceNames(" + objectName.toString() + ", " + resultClass.getString() + ", " + role + ", ...) called"); return; - - - if(! className.equal(CLUSTER_CLASSNAME) || + + + if(! className.equal(CLUSTER_CLASSNAME) || ! className.equal(CLUSTER_NODE_CLASSNAME) || ! className.equal(CLUSTER_SERVICE_CLASSNAME)) throw CIMInvalidParameterException(className.getString()); if(role.size()!=0 && - !role.equalNoCase(role, "Dependent") && + !role.equalNoCase(role, "Dependent") && !role.equalNoCase(role, "Antecedent")) throw CIMInvalidParameterException(className.getString()); - - + + if(cluster.get() == NULL) return; - - vector assocs = buildAssociations(*cluster, + + vector assocs = buildAssociations(*cluster, objectName.getNameSpace(), - false, + false, false); - + for(unsigned int i=0; i cluster = _monitor.get_cluster(); - + SmartHandler t(handler); - + CIMName className(objectName.toString()); - - log("references(" + objectName.toString() + ", " + + + log("references(" + objectName.toString() + ", " + resultClass.getString() + ", " + role + ", ...) called"); return; - - - if(! className.equal(CLUSTER_CLASSNAME) || + + + if(! className.equal(CLUSTER_CLASSNAME) || ! className.equal(CLUSTER_NODE_CLASSNAME) || ! className.equal(CLUSTER_SERVICE_CLASSNAME)) throw CIMInvalidParameterException(className.getString()); if(role.size()!=0 && - !role.equalNoCase(role, "Dependent") && + !role.equalNoCase(role, "Dependent") && !role.equalNoCase(role, "Antecedent")) throw CIMInvalidParameterException(className.getString()); - + if(cluster.get() == NULL) return; - - - vector assocs = buildAssociations(*cluster, + + + vector assocs = buildAssociations(*cluster, objectName.getNameSpace(), includeQualifiers, includeClassOrigin); - + for(unsigned int i=0; i keys; - keys.append(CIMKeyBinding("Dependent", - Pegasus::String(buildClusterInstancePath(cluster, nameSpace).toString()), + keys.append(CIMKeyBinding("Dependent", + Pegasus::String(buildClusterInstancePath(cluster, nameSpace).toString()), CIMKeyBinding::REFERENCE)); - keys.append(CIMKeyBinding("Antecedent", - Pegasus::String(buildNodeInstancePath(node, nameSpace).toString()), + keys.append(CIMKeyBinding("Antecedent", + Pegasus::String(buildNodeInstancePath(node, nameSpace).toString()), CIMKeyBinding::REFERENCE)); return CIMObjectPath(hostname(), nameSpace, CLUSTER_PARTICIPATING_NODE_CLASSNAME, keys); } -vector -buildAssociations(Cluster& cluster, - const CIMNamespaceName& nameSpace, - Boolean quals, +vector +buildAssociations(Cluster& cluster, + const CIMNamespaceName& nameSpace, + Boolean quals, Boolean orig) { vector assocs; - + // cluster - node list::iterator iter = cluster.getNodes().begin(); for( ; iter != cluster.getNodes().end(); iter++) { // association - CIMInstance inst = buildClusterParticipatingNodeInstance(cluster, + CIMInstance inst = buildClusterParticipatingNodeInstance(cluster, *iter, nameSpace, quals, @@ -1198,26 +1198,26 @@ CIMObjectPath antePath = buildNodeInstancePath(*iter, nameSpace); // dep - CIMInstance dep = buildClusterInstance(cluster, + CIMInstance dep = buildClusterInstance(cluster, quals, orig); CIMObjectPath depPath = buildClusterInstancePath(cluster, nameSpace); - - Association assoc(inst, instPath, - ante, antePath, + + Association assoc(inst, instPath, + ante, antePath, dep, depPath); - + assocs.push_back(assoc); } - + // cluster - service - - + + // node - service - - - + + + return assocs; } */ --- conga/ricci/modules/cluster/clumon/src/cim-provider/ClusterProvider.h 2006/06/14 21:44:37 1.1 +++ conga/ricci/modules/cluster/clumon/src/cim-provider/ClusterProvider.h 2007/09/11 02:45:27 1.2 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -46,17 +46,17 @@ -class ClusterProvider : +class ClusterProvider : public Pegasus::CIMInstanceProvider //, public Pegasus::CIMAssociationProvider { public: ClusterProvider (void) throw (); virtual ~ClusterProvider (void) throw (); - + // CIMProvider interface virtual void initialize (Pegasus::CIMOMHandle& cimom); virtual void terminate (void); - + // CIMInstanceProvider interface virtual void getInstance( const Pegasus::OperationContext & context, @@ -92,7 +92,7 @@ const Pegasus::OperationContext & context, const Pegasus::CIMObjectPath & ref, Pegasus::ResponseHandler & handler); - + /* // CIMAssociationProvider virtual void associatorNames( @@ -103,7 +103,7 @@ const Pegasus::String& role, const Pegasus::String& resultRole, Pegasus::ObjectPathResponseHandler& handler) ; - + virtual void associators(const Pegasus::OperationContext& context, const Pegasus::CIMObjectPath& objectName, const Pegasus::CIMName& associationClass, @@ -114,13 +114,13 @@ const Pegasus::Boolean includeClassOrigin, const Pegasus::CIMPropertyList& propertyList, Pegasus::ObjectResponseHandler& handler); - + virtual void referenceNames(const Pegasus::OperationContext& context, const Pegasus::CIMObjectPath& objectName, const Pegasus::CIMName& resultClass, const Pegasus::String& role, Pegasus::ObjectPathResponseHandler& handler); - + virtual void references(const Pegasus::OperationContext& context, const Pegasus::CIMObjectPath& objectName, const Pegasus::CIMName& resultClass, @@ -130,14 +130,14 @@ const Pegasus::CIMPropertyList& propertyList, Pegasus::ObjectResponseHandler& handler); */ - + private: void log(const Pegasus::String& str); ClusterMonitor _monitor; - + }; // class ClusterProvider - - + + }; // namespace ClusterMonitoring --- conga/ricci/modules/cluster/clumon/src/cim-provider/ClusterProviderMain.cpp 2006/08/09 16:50:42 1.2 +++ conga/ricci/modules/cluster/clumon/src/cim-provider/ClusterProviderMain.cpp 2007/09/11 02:45:27 1.3 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -35,6 +35,6 @@ { return new ClusterMonitoring::ClusterProvider(); } - + return (0); } --- conga/ricci/modules/cluster/clumon/src/cim-provider/SmartHandler.h 2006/06/14 21:44:37 1.1 +++ conga/ricci/modules/cluster/clumon/src/cim-provider/SmartHandler.h 2007/09/11 02:45:27 1.2 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -35,7 +35,7 @@ public: SmartHandler(cl &handler) : _handler(handler) { _handler.processing(); } virtual ~SmartHandler(void) { _handler.complete(); } - + private: cl& _handler; --- conga/ricci/modules/cluster/clumon/src/cim-provider/clusterCIM_test.cpp 2006/06/14 21:44:37 1.1 +++ conga/ricci/modules/cluster/clumon/src/cim-provider/clusterCIM_test.cpp 2007/09/11 02:45:27 1.2 @@ -7,14 +7,14 @@ PEGASUS_USING_STD; -int +int main(int argc, char** argv) { try { CIMClient client; string hostname; - + if (argc == 1) { cout << "Enter hostname: "; cin >> hostname; @@ -26,9 +26,9 @@ cout << " " << argv[0] << " " << endl; return 1; } - + // connect - + if (hostname == "localhost") client.connectLocal(); else { @@ -37,16 +37,16 @@ cin >> username; cout << "Enter password for user \"" + username + "\" on \"" + hostname + "\": "; cin >> password; - - client.connect(hostname.c_str(), + + client.connect(hostname.c_str(), PEGASUS_PORT, SSLContext("", NULL), username.c_str(), password.c_str()); } - - // print - + + // print + printClusters(client); printNodes(client); printServices(client); @@ -56,23 +56,23 @@ cerr << "Error: " << e.getMessage() << endl; exit(1); } - + return 0; } -void +void printClusters(CIMClient& client) { const CIMNamespaceName NAMESPACE = CIMNamespaceName("root/cimv2"); const CIMName CLASSNAME = CIMName("RedHat_Cluster"); - + Boolean deepInheritance = true; Boolean localOnly = true; Boolean includeQualifiers = false; Boolean includeClassOrigin = false; Array cimInstances; - + // // Enumerate Instances. // @@ -91,18 +91,18 @@ } } -void +void printNodes(CIMClient& client) { const CIMNamespaceName NAMESPACE = CIMNamespaceName("root/cimv2"); const CIMName CLASSNAME = CIMName("RedHat_ClusterNode"); - + Boolean deepInheritance = true; Boolean localOnly = true; Boolean includeQualifiers = false; Boolean includeClassOrigin = false; Array cimInstances; - + // // Enumerate Instances. // @@ -119,18 +119,18 @@ } } -void +void printServices(CIMClient& client) { const CIMNamespaceName NAMESPACE = CIMNamespaceName("root/cimv2"); const CIMName CLASSNAME = CIMName("RedHat_ClusterFailoverService"); - + Boolean deepInheritance = true; Boolean localOnly = true; Boolean includeQualifiers = false; Boolean includeClassOrigin = false; Array cimInstances; - + // // Enumerate Instances. // @@ -153,9 +153,9 @@ int size = inst.getPropertyCount(); for (int i=0; ifailedServices().size() != 0) // service failed code = (code & ~1) | 2; - + if (cluster->stoppedServices().size() != 0) // service not running code = (code & ~1) | 4; - + if (cluster->unclusteredNodes().size() != 0) // unavailable node code = (code & ~1) | 8; - + if (cluster->votes() < cluster->minQuorum()) // not quorate code = (code & ~1) | 16; - + if (cluster->unclusteredNodes().size() == cluster->nodes().size()) // cluster stopped code = (code & ~1) | 32; - + return code; } @@ -250,7 +250,7 @@ return "Cluster stopped (all services stopped)"; if (code & 16) return "Not quorate (all services stopped)"; - + String descr; if (code & 2) { String c = "Some services failed"; @@ -284,31 +284,31 @@ netsnmp_request_info *requests) { try { - + unsigned int num = 1; // MIB version 1 - + /* * We are never called for a GETNEXT if it's registered as a - * "instance", as it's "magically" handled for us. + * "instance", as it's "magically" handled for us. */ - + /* * a instance handler also only hands us one request at a time, so - * we don't need to loop over a list of requests; we'll only get one. + * we don't need to loop over a list of requests; we'll only get one. */ - + switch (reqinfo->mode) { - + case MODE_GET: snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, (u_char *) &num, sizeof(num)); break; - + default: /* - * we should never get here, so this is a really bad error + * we should never get here, so this is a really bad error */ return SNMP_ERR_GENERR; } @@ -329,31 +329,31 @@ counting_auto_ptr cluster = monitor.get_cluster(); if(cluster.get() == NULL) return SNMP_ERR_NOERROR; - + unsigned int num = cluster->failedServices().size(); - + /* * We are never called for a GETNEXT if it's registered as a - * "instance", as it's "magically" handled for us. + * "instance", as it's "magically" handled for us. */ - + /* * a instance handler also only hands us one request at a time, so - * we don't need to loop over a list of requests; we'll only get one. + * we don't need to loop over a list of requests; we'll only get one. */ - + switch (reqinfo->mode) { - + case MODE_GET: snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, (u_char *) &num, sizeof(num)); break; - + default: /* - * we should never get here, so this is a really bad error + * we should never get here, so this is a really bad error */ return SNMP_ERR_GENERR; } @@ -374,7 +374,7 @@ counting_auto_ptr cluster = monitor.get_cluster(); if(cluster.get() == NULL) return SNMP_ERR_NOERROR; - + list > l = cluster->failedServices(); String str; for (list >::iterator iter = l.begin(); @@ -382,31 +382,31 @@ iter++) if (str.empty()) str = (*iter)->name(); - else + else str += ", " + (*iter)->name(); - + /* * We are never called for a GETNEXT if it's registered as a - * "instance", as it's "magically" handled for us. + * "instance", as it's "magically" handled for us. */ - + /* * a instance handler also only hands us one request at a time, so - * we don't need to loop over a list of requests; we'll only get one. + * we don't need to loop over a list of requests; we'll only get one. */ - + switch (reqinfo->mode) { - + case MODE_GET: snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) str.c_str(), str.size()); break; - + default: /* - * we should never get here, so this is a really bad error + * we should never get here, so this is a really bad error */ return SNMP_ERR_GENERR; } @@ -427,32 +427,32 @@ counting_auto_ptr cluster = monitor.get_cluster(); if(cluster.get() == NULL) return SNMP_ERR_NOERROR; - + unsigned int code = getStatusCode(cluster.get()); String str = getStatusDescription(code); - + /* * We are never called for a GETNEXT if it's registered as a - * "instance", as it's "magically" handled for us. + * "instance", as it's "magically" handled for us. */ - + /* * a instance handler also only hands us one request at a time, so - * we don't need to loop over a list of requests; we'll only get one. + * we don't need to loop over a list of requests; we'll only get one. */ - + switch (reqinfo->mode) { - + case MODE_GET: snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) str.c_str(), str.size()); break; - + default: /* - * we should never get here, so this is a really bad error + * we should never get here, so this is a really bad error */ return SNMP_ERR_GENERR; } @@ -473,17 +473,17 @@ counting_auto_ptr cluster = monitor.get_cluster(); if(cluster.get() == NULL) return SNMP_ERR_NOERROR; - + unsigned int num = cluster->votes(); - + /* * We are never called for a GETNEXT if it's registered as a - * "instance", as it's "magically" handled for us. + * "instance", as it's "magically" handled for us. */ /* * a instance handler also only hands us one request at a time, so - * we don't need to loop over a list of requests; we'll only get one. + * we don't need to loop over a list of requests; we'll only get one. */ switch (reqinfo->mode) { @@ -494,10 +494,10 @@ &num, sizeof(num)); break; - + default: /* - * we should never get here, so this is a really bad error + * we should never get here, so this is a really bad error */ return SNMP_ERR_GENERR; } @@ -518,17 +518,17 @@ counting_auto_ptr cluster = monitor.get_cluster(); if(cluster.get() == NULL) return SNMP_ERR_NOERROR; - + unsigned int num = cluster->stoppedServices().size(); - + /* * We are never called for a GETNEXT if it's registered as a - * "instance", as it's "magically" handled for us. + * "instance", as it's "magically" handled for us. */ /* * a instance handler also only hands us one request at a time, so - * we don't need to loop over a list of requests; we'll only get one. + * we don't need to loop over a list of requests; we'll only get one. */ switch (reqinfo->mode) { @@ -539,10 +539,10 @@ &num, sizeof(num)); break; - + default: /* - * we should never get here, so this is a really bad error + * we should never get here, so this is a really bad error */ return SNMP_ERR_GENERR; } @@ -563,7 +563,7 @@ counting_auto_ptr cluster = monitor.get_cluster(); if(cluster.get() == NULL) return SNMP_ERR_NOERROR; - + list > l = cluster->stoppedServices(); String str; for (list >::iterator iter = l.begin(); @@ -571,31 +571,31 @@ iter++) if (str.empty()) str = (*iter)->name(); - else + else str += ", " + (*iter)->name(); - + /* * We are never called for a GETNEXT if it's registered as a - * "instance", as it's "magically" handled for us. + * "instance", as it's "magically" handled for us. */ - + /* * a instance handler also only hands us one request at a time, so - * we don't need to loop over a list of requests; we'll only get one. + * we don't need to loop over a list of requests; we'll only get one. */ - + switch (reqinfo->mode) { - + case MODE_GET: snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) str.c_str(), str.size()); break; - + default: /* - * we should never get here, so this is a really bad error + * we should never get here, so this is a really bad error */ return SNMP_ERR_GENERR; } @@ -616,19 +616,19 @@ counting_auto_ptr cluster = monitor.get_cluster(); if(cluster.get() == NULL) return SNMP_ERR_NOERROR; - + unsigned int num = cluster->clusteredNodes().size(); - + /* * We are never called for a GETNEXT if it's registered as a - * "instance", as it's "magically" handled for us. + * "instance", as it's "magically" handled for us. */ - + /* * a instance handler also only hands us one request at a time, so - * we don't need to loop over a list of requests; we'll only get one. + * we don't need to loop over a list of requests; we'll only get one. */ - + switch (reqinfo->mode) { case MODE_GET: @@ -637,10 +637,10 @@ &num, sizeof(num)); break; - + default: /* - * we should never get here, so this is a really bad error + * we should never get here, so this is a really bad error */ return SNMP_ERR_GENERR; } @@ -661,7 +661,7 @@ counting_auto_ptr cluster = monitor.get_cluster(); if(cluster.get() == NULL) return SNMP_ERR_NOERROR; - + list > l = cluster->clusteredNodes(); String str; for (list >::iterator iter = l.begin(); @@ -669,31 +669,31 @@ iter++) if (str.empty()) str = (*iter)->name(); - else + else str += ", " + (*iter)->name(); - + /* * We are never called for a GETNEXT if it's registered as a - * "instance", as it's "magically" handled for us. + * "instance", as it's "magically" handled for us. */ - + /* * a instance handler also only hands us one request at a time, so - * we don't need to loop over a list of requests; we'll only get one. + * we don't need to loop over a list of requests; we'll only get one. */ - + switch (reqinfo->mode) { - + case MODE_GET: snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) str.c_str(), str.size()); break; - + default: /* - * we should never get here, so this is a really bad error + * we should never get here, so this is a really bad error */ return SNMP_ERR_GENERR; } @@ -714,17 +714,17 @@ counting_auto_ptr cluster = monitor.get_cluster(); if(cluster.get() == NULL) return SNMP_ERR_NOERROR; - + unsigned int num = cluster->services().size(); - + /* * We are never called for a GETNEXT if it's registered as a - * "instance", as it's "magically" handled for us. + * "instance", as it's "magically" handled for us. */ /* * a instance handler also only hands us one request at a time, so - * we don't need to loop over a list of requests; we'll only get one. + * we don't need to loop over a list of requests; we'll only get one. */ switch (reqinfo->mode) { @@ -738,7 +738,7 @@ default: /* - * we should never get here, so this is a really bad error + * we should never get here, so this is a really bad error */ return SNMP_ERR_GENERR; } @@ -759,7 +759,7 @@ counting_auto_ptr cluster = monitor.get_cluster(); if(cluster.get() == NULL) return SNMP_ERR_NOERROR; - + list > l = cluster->services(); String str; for (list >::iterator iter = l.begin(); @@ -767,31 +767,31 @@ iter++) if (str.empty()) str = (*iter)->name(); - else + else str += ", " + (*iter)->name(); - + /* * We are never called for a GETNEXT if it's registered as a - * "instance", as it's "magically" handled for us. + * "instance", as it's "magically" handled for us. */ - + /* * a instance handler also only hands us one request at a time, so - * we don't need to loop over a list of requests; we'll only get one. + * we don't need to loop over a list of requests; we'll only get one. */ - + switch (reqinfo->mode) { - + case MODE_GET: snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) str.c_str(), str.size()); break; - + default: /* - * we should never get here, so this is a really bad error + * we should never get here, so this is a really bad error */ return SNMP_ERR_GENERR; } @@ -812,17 +812,17 @@ counting_auto_ptr cluster = monitor.get_cluster(); if(cluster.get() == NULL) return SNMP_ERR_NOERROR; - + String name = cluster->name(); - + /* * We are never called for a GETNEXT if it's registered as a - * "instance", as it's "magically" handled for us. + * "instance", as it's "magically" handled for us. */ /* * a instance handler also only hands us one request at a time, so - * we don't need to loop over a list of requests; we'll only get one. + * we don't need to loop over a list of requests; we'll only get one. */ switch (reqinfo->mode) { @@ -836,7 +836,7 @@ default: /* - * we should never get here, so this is a really bad error + * we should never get here, so this is a really bad error */ return SNMP_ERR_GENERR; } @@ -857,17 +857,17 @@ counting_auto_ptr cluster = monitor.get_cluster(); if(cluster.get() == NULL) return SNMP_ERR_NOERROR; - + unsigned int code = getStatusCode(cluster.get()); - + /* * We are never called for a GETNEXT if it's registered as a - * "instance", as it's "magically" handled for us. + * "instance", as it's "magically" handled for us. */ /* * a instance handler also only hands us one request at a time, so - * we don't need to loop over a list of requests; we'll only get one. + * we don't need to loop over a list of requests; we'll only get one. */ switch (reqinfo->mode) { @@ -881,7 +881,7 @@ default: /* - * we should never get here, so this is a really bad error + * we should never get here, so this is a really bad error */ return SNMP_ERR_GENERR; } @@ -902,17 +902,17 @@ counting_auto_ptr cluster = monitor.get_cluster(); if(cluster.get() == NULL) return SNMP_ERR_NOERROR; - + unsigned int num = cluster->unclusteredNodes().size(); - + /* * We are never called for a GETNEXT if it's registered as a - * "instance", as it's "magically" handled for us. + * "instance", as it's "magically" handled for us. */ /* * a instance handler also only hands us one request at a time, so - * we don't need to loop over a list of requests; we'll only get one. + * we don't need to loop over a list of requests; we'll only get one. */ switch (reqinfo->mode) { @@ -926,7 +926,7 @@ default: /* - * we should never get here, so this is a really bad error + * we should never get here, so this is a really bad error */ return SNMP_ERR_GENERR; } @@ -947,7 +947,7 @@ counting_auto_ptr cluster = monitor.get_cluster(); if(cluster.get() == NULL) return SNMP_ERR_NOERROR; - + list > l = cluster->unclusteredNodes(); String str; for (list >::iterator iter = l.begin(); @@ -955,31 +955,31 @@ iter++) if (str.empty()) str = (*iter)->name(); - else + else str += ", " + (*iter)->name(); - + /* * We are never called for a GETNEXT if it's registered as a - * "instance", as it's "magically" handled for us. + * "instance", as it's "magically" handled for us. */ - + /* * a instance handler also only hands us one request at a time, so - * we don't need to loop over a list of requests; we'll only get one. + * we don't need to loop over a list of requests; we'll only get one. */ - + switch (reqinfo->mode) { - + case MODE_GET: snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) str.c_str(), str.size()); break; - + default: /* - * we should never get here, so this is a really bad error + * we should never get here, so this is a really bad error */ return SNMP_ERR_GENERR; } @@ -1000,17 +1000,17 @@ counting_auto_ptr cluster = monitor.get_cluster(); if(cluster.get() == NULL) return SNMP_ERR_NOERROR; - + unsigned int num = cluster->nodes().size(); - + /* * We are never called for a GETNEXT if it's registered as a - * "instance", as it's "magically" handled for us. + * "instance", as it's "magically" handled for us. */ /* * a instance handler also only hands us one request at a time, so - * we don't need to loop over a list of requests; we'll only get one. + * we don't need to loop over a list of requests; we'll only get one. */ switch (reqinfo->mode) { @@ -1024,7 +1024,7 @@ default: /* - * we should never get here, so this is a really bad error + * we should never get here, so this is a really bad error */ return SNMP_ERR_GENERR; } @@ -1045,7 +1045,7 @@ counting_auto_ptr cluster = monitor.get_cluster(); if(cluster.get() == NULL) return SNMP_ERR_NOERROR; - + list > l = cluster->nodes(); String str; for (list >::iterator iter = l.begin(); @@ -1053,31 +1053,31 @@ iter++) if (str.empty()) str = (*iter)->name(); - else + else str += ", " + (*iter)->name(); - + /* * We are never called for a GETNEXT if it's registered as a - * "instance", as it's "magically" handled for us. + * "instance", as it's "magically" handled for us. */ - + /* * a instance handler also only hands us one request at a time, so - * we don't need to loop over a list of requests; we'll only get one. + * we don't need to loop over a list of requests; we'll only get one. */ - + switch (reqinfo->mode) { - + case MODE_GET: snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) str.c_str(), str.size()); break; - + default: /* - * we should never get here, so this is a really bad error + * we should never get here, so this is a really bad error */ return SNMP_ERR_GENERR; } @@ -1098,17 +1098,17 @@ counting_auto_ptr cluster = monitor.get_cluster(); if(cluster.get() == NULL) return SNMP_ERR_NOERROR; - + unsigned int num = cluster->runningServices().size(); - + /* * We are never called for a GETNEXT if it's registered as a - * "instance", as it's "magically" handled for us. + * "instance", as it's "magically" handled for us. */ /* * a instance handler also only hands us one request at a time, so - * we don't need to loop over a list of requests; we'll only get one. + * we don't need to loop over a list of requests; we'll only get one. */ switch (reqinfo->mode) { @@ -1122,7 +1122,7 @@ default: /* - * we should never get here, so this is a really bad error + * we should never get here, so this is a really bad error */ return SNMP_ERR_GENERR; } @@ -1143,7 +1143,7 @@ counting_auto_ptr cluster = monitor.get_cluster(); if(cluster.get() == NULL) return SNMP_ERR_NOERROR; - + list > l = cluster->runningServices(); String str; for (list >::iterator iter = l.begin(); @@ -1151,31 +1151,31 @@ iter++) if (str.empty()) str = (*iter)->name(); - else + else str += ", " + (*iter)->name(); - + /* * We are never called for a GETNEXT if it's registered as a - * "instance", as it's "magically" handled for us. + * "instance", as it's "magically" handled for us. */ - + /* * a instance handler also only hands us one request at a time, so - * we don't need to loop over a list of requests; we'll only get one. + * we don't need to loop over a list of requests; we'll only get one. */ - + switch (reqinfo->mode) { - + case MODE_GET: snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) str.c_str(), str.size()); break; - + default: /* - * we should never get here, so this is a really bad error + * we should never get here, so this is a really bad error */ return SNMP_ERR_GENERR; } @@ -1197,17 +1197,17 @@ counting_auto_ptr cluster = monitor.get_cluster(); if(cluster.get() == NULL) return SNMP_ERR_NOERROR; - + unsigned int num = cluster->minQuorum(); - + /* * We are never called for a GETNEXT if it's registered as a - * "instance", as it's "magically" handled for us. + * "instance", as it's "magically" handled for us. */ /* * a instance handler also only hands us one request at a time, so - * we don't need to loop over a list of requests; we'll only get one. + * we don't need to loop over a list of requests; we'll only get one. */ switch (reqinfo->mode) { @@ -1221,7 +1221,7 @@ default: /* - * we should never get here, so this is a really bad error + * we should never get here, so this is a really bad error */ return SNMP_ERR_GENERR; } @@ -1243,17 +1243,17 @@ counting_auto_ptr cluster = monitor.get_cluster(); if(cluster.get() == NULL) return SNMP_ERR_NOERROR; - + unsigned int num = cluster->quorate() ? 1 : 0; - + /* * We are never called for a GETNEXT if it's registered as a - * "instance", as it's "magically" handled for us. + * "instance", as it's "magically" handled for us. */ - + /* * a instance handler also only hands us one request at a time, so - * we don't need to loop over a list of requests; we'll only get one. + * we don't need to loop over a list of requests; we'll only get one. */ switch (reqinfo->mode) { @@ -1267,7 +1267,7 @@ default: /* - * we should never get here, so this is a really bad error + * we should never get here, so this is a really bad error */ return SNMP_ERR_GENERR; } --- conga/ricci/modules/cluster/clumon/src/snmp-agent/clusterMIB.h 2006/06/14 21:44:37 1.1 +++ conga/ricci/modules/cluster/clumon/src/snmp-agent/clusterMIB.h 2007/09/11 02:45:27 1.2 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* --- conga/ricci/modules/cluster/clumon/src/snmp-agent/clusterMonitorSnmp.cpp 2006/06/14 21:44:37 1.1 +++ conga/ricci/modules/cluster/clumon/src/snmp-agent/clusterMonitorSnmp.cpp 2007/09/11 02:45:27 1.2 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -37,8 +37,8 @@ initialize_clusterMIB(); initialize_nodesMIB(); initialize_servicesMIB(); - + // TODO: initialize others - } catch ( ... ) + } catch ( ... ) {} } --- conga/ricci/modules/cluster/clumon/src/snmp-agent/clusterMonitorSnmp.h 2006/06/14 21:44:37 1.1 +++ conga/ricci/modules/cluster/clumon/src/snmp-agent/clusterMonitorSnmp.h 2007/09/11 02:45:27 1.2 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* --- conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB.cpp 2006/06/14 21:44:37 1.1 +++ conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB.cpp 2007/09/11 02:45:27 1.2 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -85,7 +85,7 @@ OID_LENGTH (rhcNodesTable_oid), HANDLER_CAN_RONLY); - + if (!my_handler || !table_info || !iinfo) { snmp_log(LOG_ERR, "malloc failed in initialize_table_rhcNodesTable"); @@ -112,7 +112,7 @@ //#ifdef MAYBE_USE_THESE iinfo->make_data_context = rhcNodesTable_context_convert_function; iinfo->free_data_context = rhcNodesTable_data_free; - + /** pick *only* one of these if you use them */ //iinfo->free_loop_context = rhcNodesTable_loop_free; iinfo->free_loop_context_at_end = rhcNodesTable_loop_free; @@ -253,7 +253,7 @@ char *retval; size_t retval_len = 0; retval = - get_rhcNodeRunningServicesNames(data_context, + get_rhcNodeRunningServicesNames(data_context, &retval_len); snmp_set_var_typed_value(var, ASN_OCTET_STR, (const u_char *) retval, --- conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB.h 2006/06/14 21:44:37 1.1 +++ conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB.h 2007/09/11 02:45:27 1.2 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -39,9 +39,9 @@ config_require(rhcNodesTable_access) /** other required module components */ config_require(rhcNodesTable_checkfns) - + /* - * function declarations + * function declarations */ void init_rhcNodesTable(void); void initialize_table_rhcNodesTable(void); --- conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_access.cpp 2006/08/10 22:53:08 1.2 +++ conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_access.cpp 2007/09/11 02:45:27 1.3 @@ -47,12 +47,12 @@ class LoopContext { public: - LoopContext(counting_auto_ptr cluster) : - _cluster(cluster), + LoopContext(counting_auto_ptr cluster) : + _cluster(cluster), _nodes(_cluster->nodes()), _curr(_nodes.begin()) {} virtual ~LoopContext() {} - + counting_auto_ptr curr() { if (_curr == _nodes.end()) @@ -66,7 +66,7 @@ _curr++; return curr(); } - + private: counting_auto_ptr _cluster; list > _nodes; @@ -76,7 +76,7 @@ class DataContext { public: - DataContext(LoopContext& loop) : + DataContext(LoopContext& loop) : _node(loop.curr()) {} virtual ~DataContext() {} counting_auto_ptr getNode() @@ -122,14 +122,14 @@ counting_auto_ptr cluster = monitor.get_cluster(); if (cluster.get() == NULL) return NULL; - + LoopContext* loopctx = new LoopContext(cluster); *my_loop_context = loopctx; - + counting_auto_ptr node = loopctx->curr(); if (node.get() == NULL) return NULL; - + const String& name = node->name(); snmp_set_var_value(put_index_data, (u_char *) name.c_str(), name.size()); return put_index_data; @@ -155,11 +155,11 @@ LoopContext* loopctx = (LoopContext*) *my_loop_context; if (loopctx == NULL) return NULL; - + counting_auto_ptr node = loopctx->next(); if (node.get() == NULL) return NULL; - + const String& name = node->name(); snmp_set_var_value(put_index_data, (u_char *) name.c_str(), name.size()); return put_index_data; @@ -198,7 +198,7 @@ /* - * User-defined data access functions (per column) for data in table rhcNodesTable + * User-defined data access functions (per column) for data in table rhcNodesTable */ /* * NOTE: @@ -218,7 +218,7 @@ counting_auto_ptr node = datactx->getNode(); if (node.get() == NULL) return NULL; - + datactx->str_holder = node->name(); *ret_len = datactx->str_holder.size(); return (char*) datactx->str_holder.c_str(); @@ -237,7 +237,7 @@ counting_auto_ptr node = datactx->getNode(); if (node.get() == NULL) return NULL; - + datactx->long_holder = node->services().size(); *ret_len = sizeof(datactx->long_holder); return &datactx->long_holder; @@ -256,7 +256,7 @@ counting_auto_ptr node = datactx->getNode(); if (node.get() == NULL) return NULL; - + list > l = node->services(); String str; for (list >::iterator iter = l.begin(); @@ -264,9 +264,9 @@ iter++) if (str.empty()) str = (*iter)->name(); - else + else str += ", " + (*iter)->name(); - + datactx->str_holder = str; *ret_len = datactx->str_holder.size(); return (char*) datactx->str_holder.c_str(); @@ -278,21 +278,21 @@ // ## status ## -unsigned int +unsigned int getStatusCode(counting_auto_ptr node) { if (node->clustered()) // in cluster return 0; - + if (node->online()) // unavailable to cluster return 1; - + // OK return 2; } -String +String getStatusDescription(unsigned int code) { switch(code) { @@ -317,7 +317,7 @@ counting_auto_ptr node = datactx->getNode(); if (node.get() == NULL) return NULL; - + datactx->long_holder = getStatusCode(node); *ret_len = sizeof(datactx->long_holder); return &datactx->long_holder; @@ -336,7 +336,7 @@ counting_auto_ptr node = datactx->getNode(); if (node.get() == NULL) return NULL; - + unsigned int code = getStatusCode(node); datactx->str_holder = getStatusDescription(code); *ret_len = datactx->str_holder.size(); @@ -389,7 +389,7 @@ /* * return no errors. And there shouldn't be any!!! Ever!!! You - * should have checked the values long before this. + * should have checked the values long before this. */ return SNMP_ERR_NOERROR; } --- conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_access.h 2006/06/14 21:44:37 1.1 +++ conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_access.h 2007/09/11 02:45:27 1.2 @@ -41,7 +41,7 @@ Netsnmp_Free_Loop_Context rhcNodesTable_loop_free; Netsnmp_Make_Data_Context rhcNodesTable_context_convert_function; Netsnmp_Free_Data_Context rhcNodesTable_data_free; - + int rhcNodesTable_commit_row(void** my_data_context, int new_or_del); void* rhcNodesTable_create_data_context(netsnmp_variable_list* index_data); --- conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_checkfns.cpp 2006/06/14 21:44:37 1.1 +++ conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_checkfns.cpp 2007/09/11 02:45:27 1.2 @@ -12,7 +12,7 @@ /* - * standard headers + * standard headers */ #include #include --- conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_checkfns.h 2006/06/14 21:44:37 1.1 +++ conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_checkfns.h 2007/09/11 02:45:27 1.2 @@ -17,8 +17,8 @@ config_require(rhcNodesTable_checkfns_local) /* - * these functions are designed to check incoming values for - * columns in the rhcNodesTable table for legality with respect to + * these functions are designed to check incoming values for + * columns in the rhcNodesTable table for legality with respect to * datatype and value. */ }; --- conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_checkfns_local.cpp 2006/06/14 21:44:37 1.1 +++ conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_checkfns_local.cpp 2007/09/11 02:45:27 1.2 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* --- conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_checkfns_local.h 2006/06/14 21:44:37 1.1 +++ conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_checkfns_local.h 2007/09/11 02:45:27 1.2 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -22,7 +22,7 @@ /* * Note: this file originally auto-generated by mib2c using * : : mib2c.check_values_local.conf,v 5.1.2.1 2004/05/04 23:35:32 hardaker Exp $ - * + * */ @@ -32,14 +32,14 @@ extern "C" { /* - * these functions are designed to check incoming values for - * columns in the rhcNodesTable table for legality with respect to + * these functions are designed to check incoming values for + * columns in the rhcNodesTable table for legality with respect to * datatype and value according to local conventions. You should modify * them as appropriate. They will be called from parent check_value * functions that are auto-generated using mib2c and the parent functions * should NOT be modified. */ - + }; --- conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_columns.h 2006/06/14 21:44:37 1.1 +++ conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_columns.h 2007/09/11 02:45:27 1.2 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -30,7 +30,7 @@ /* - * column number definitions for table rhcNodesTable + * column number definitions for table rhcNodesTable */ #define COLUMN_RHCNODENAME 1 #define COLUMN_RHCNODESTATUSCODE 2 --- conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_enums.h 2006/06/14 21:44:37 1.1 +++ conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_enums.h 2007/09/11 02:45:27 1.2 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* --- conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB.cpp 2006/06/14 21:44:37 1.1 +++ conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB.cpp 2007/09/11 02:45:27 1.2 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -111,7 +111,7 @@ //#ifdef MAYBE_USE_THESE iinfo->make_data_context = rhcServicesTable_context_convert_function; iinfo->free_data_context = rhcServicesTable_data_free; - + /** pick *only* one of these if you use them */ //iinfo->free_loop_context = rhcServicesTable_loop_free; iinfo->free_loop_context_at_end = rhcServicesTable_loop_free; @@ -180,7 +180,7 @@ default: /* == the other SET modes */ ci = (struct commitInfo*) netsnmp_oid_stash_get_data(commitStorage, - suffix + 1, + suffix + 1, suffix_len - 1); break; @@ -271,7 +271,7 @@ case MODE_SET_RESERVE1: ci = (struct commitInfo*) netsnmp_oid_stash_get_data(commitStorage, - suffix + 1, + suffix + 1, suffix_len - 1); if (!ci) { --- conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB.h 2006/06/14 21:44:37 1.1 +++ conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB.h 2007/09/11 02:45:27 1.2 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -40,7 +40,7 @@ config_require(rhcServicesTable_checkfns) /* - * function declarations + * function declarations */ void init_rhcServicesTable(void); void initialize_table_rhcServicesTable(void); --- conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_access.cpp 2006/08/10 22:53:08 1.2 +++ conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_access.cpp 2007/09/11 02:45:27 1.3 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -46,12 +46,12 @@ class LoopContext { public: - LoopContext(counting_auto_ptr cluster) : - _cluster(cluster), + LoopContext(counting_auto_ptr cluster) : + _cluster(cluster), _services(cluster->services()), _curr(_services.begin()) {} virtual ~LoopContext() {} - + counting_auto_ptr curr() { if (_curr == _services.end()) @@ -65,7 +65,7 @@ _curr++; return curr(); } - + private: counting_auto_ptr _cluster; list > _services; @@ -75,10 +75,10 @@ class DataContext { public: - DataContext(LoopContext& loop) : + DataContext(LoopContext& loop) : _service(loop.curr()) {} virtual ~DataContext() {} - + counting_auto_ptr getService() { return _service; @@ -122,14 +122,14 @@ counting_auto_ptr cluster = monitor.get_cluster(); if (cluster.get() == NULL) return NULL; - + LoopContext* loopctx = new LoopContext(cluster); *my_loop_context = loopctx; - + counting_auto_ptr service = loopctx->curr(); if (service.get() == NULL) return NULL; - + const String& name = service->name(); snmp_set_var_value(put_index_data, (u_char *) name.c_str(), name.size()); return put_index_data; @@ -155,11 +155,11 @@ LoopContext* loopctx = (LoopContext*) *my_loop_context; if (loopctx == NULL) return NULL; - + counting_auto_ptr service = loopctx->next(); if (service.get() == NULL) return NULL; - + const String& name = service->name(); snmp_set_var_value(put_index_data, (u_char *) name.c_str(), name.size()); return put_index_data; @@ -199,7 +199,7 @@ /* - * User-defined data access functions (per column) for data in table rhcServicesTable + * User-defined data access functions (per column) for data in table rhcServicesTable */ /* * NOTE: @@ -219,7 +219,7 @@ counting_auto_ptr service = datactx->getService(); if (service.get() == NULL) return NULL; - + datactx->str_holder = service->name(); *ret_len = datactx->str_holder.size(); return (char*) datactx->str_holder.c_str(); @@ -238,7 +238,7 @@ counting_auto_ptr service = datactx->getService(); if (service.get() == NULL) return NULL; - + if (service->autostart()) datactx->str_holder = "automatic"; else @@ -260,10 +260,10 @@ counting_auto_ptr service = datactx->getService(); if (service.get() == NULL) return NULL; - + if (!service->running()) return NULL; - + datactx->str_holder = service->nodename(); *ret_len = datactx->str_holder.size(); return (char*) datactx->str_holder.c_str(); @@ -274,13 +274,13 @@ // ## status ## -unsigned int +unsigned int getStatusCode(counting_auto_ptr service) { if (service->failed()) // failed return 2; - + if (service->running()) // running return 0; @@ -288,7 +288,7 @@ // stopped return 1; } -String +String getStatusDescription(unsigned int code) { switch(code) { @@ -313,7 +313,7 @@ counting_auto_ptr service = datactx->getService(); if (service.get() == NULL) return NULL; - + datactx->long_holder = getStatusCode(service); *ret_len = sizeof(datactx->long_holder); return &datactx->long_holder; @@ -332,7 +332,7 @@ counting_auto_ptr service = datactx->getService(); if (service.get() == NULL) return NULL; - + unsigned int code = getStatusCode(service); datactx->str_holder = getStatusDescription(code); *ret_len = datactx->str_holder.size(); @@ -383,7 +383,7 @@ /* * return no errors. And there shouldn't be any!!! Ever!!! You - * should have checked the values long before this. + * should have checked the values long before this. */ return SNMP_ERR_NOERROR; } --- conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_access.h 2006/06/14 21:44:37 1.1 +++ conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_access.h 2007/09/11 02:45:27 1.2 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -41,10 +41,10 @@ Netsnmp_Free_Loop_Context rhcServicesTable_loop_free; Netsnmp_Make_Data_Context rhcServicesTable_context_convert_function; Netsnmp_Free_Data_Context rhcServicesTable_data_free; - + int rhcServicesTable_commit_row(void** my_data_context, int new_or_del); void *rhcServicesTable_create_data_context(netsnmp_variable_list* index_data); - + /** column accessors */ char *get_rhcServiceName(void *data_context, size_t * ret_len); long *get_rhcServiceStatusCode(void *data_context, size_t * ret_len); --- conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_checkfns.cpp 2006/06/14 21:44:37 1.1 +++ conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_checkfns.cpp 2007/09/11 02:45:27 1.2 @@ -11,7 +11,7 @@ ********************************************************************/ /* - * standard headers + * standard headers */ #include --- conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_checkfns.h 2006/06/14 21:44:37 1.1 +++ conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_checkfns.h 2007/09/11 02:45:27 1.2 @@ -16,9 +16,9 @@ config_require(rhcServicesTable_checkfns_local) /* - * these functions are designed to check incoming values for - * columns in the rhcServicesTable table for legality with respect to + * these functions are designed to check incoming values for + * columns in the rhcServicesTable table for legality with respect to * datatype and value. */ - + #endif // servicesMIB_checkfns_h --- conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_checkfns_local.cpp 2006/06/14 21:44:37 1.1 +++ conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_checkfns_local.cpp 2007/09/11 02:45:27 1.2 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* --- conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_checkfns_local.h 2006/06/14 21:44:37 1.1 +++ conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_checkfns_local.h 2007/09/11 02:45:27 1.2 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -29,8 +29,8 @@ #define servicesMIB_checkfns_local_h /* - * these functions are designed to check incoming values for - * columns in the rhcServicesTable table for legality with respect to + * these functions are designed to check incoming values for + * columns in the rhcServicesTable table for legality with respect to * datatype and value according to local conventions. You should modify * them as appropriate. They will be called from parent check_value * functions that are auto-generated using mib2c and the parent functions --- conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_columns.h 2006/06/14 21:44:37 1.1 +++ conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_columns.h 2007/09/11 02:45:27 1.2 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -29,7 +29,7 @@ #define servicesMIB_columns_h /* - * column number definitions for table rhcServicesTable + * column number definitions for table rhcServicesTable */ #define COLUMN_RHCSERVICENAME 1 #define COLUMN_RHCSERVICESTATUSCODE 2 --- conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_enums.h 2006/06/14 21:44:37 1.1 +++ conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_enums.h 2007/09/11 02:45:27 1.2 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* --- conga/ricci/modules/log/LogParser.cpp 2007/02/05 21:25:53 1.9 +++ conga/ricci/modules/log/LogParser.cpp 2007/09/11 02:45:28 1.10 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -60,7 +60,7 @@ "gfs2", "openais", "groupd", - "qdiskd", + "qdiskd", "dlm_controld", "gfs_controld", "clurgmgrd", @@ -91,7 +91,7 @@ "ext2", "ext3", "ext3-fs", - "swap", + "swap", "mount", "automount"}; @@ -112,43 +112,43 @@ const set& elements) : name(name), elements(elements) {} - + String name; set elements; set match; }; -static const vector& +static const vector& get_sets() { static vector sets; static Mutex mutex; static bool init = false; - + MutexLocker l(mutex); if (!init) { init = true; - tag_set clu("cluster", - set(cluster, + tag_set clu("cluster", + set(cluster, cluster + sizeof(cluster)/sizeof(char*))); clu.match.insert("fence_"); sets.push_back(clu); - - sets.push_back(tag_set("cluster service manager", - set(cluster_service_manager, + + sets.push_back(tag_set("cluster service manager", + set(cluster_service_manager, cluster_service_manager + sizeof(cluster_service_manager)/sizeof(char*)))); - - sets.push_back(tag_set("lvs", - set(LVS, + + sets.push_back(tag_set("lvs", + set(LVS, LVS + sizeof(LVS)/sizeof(char*)))); - - sets.push_back(tag_set("storage", - set(storage, + + sets.push_back(tag_set("storage", + set(storage, storage + sizeof(storage)/sizeof(char*)))); - - tag_set SEL("selinux", - set(selinux, + + tag_set SEL("selinux", + set(selinux, selinux + sizeof(selinux)/sizeof(char*))); SEL.match.insert("pam_"); sets.push_back(SEL); @@ -178,7 +178,7 @@ return files; if (path[0] != '/') return files; - + struct stat st; if (stat(path.c_str(), &st)) // throw String("unable to stat ") + path; @@ -186,17 +186,17 @@ if (S_ISREG(st.st_mode)) { if (st.st_mtime >= age_time) files.insert(path); - + // get rotated logs for (int i=0; i<25; i++) get_files(path + "." + utils::to_string(i), files, age_time); - + return files; } else if (S_ISDIR(st.st_mode)) ; // process directory else return files; - + DIR* d = opendir(path.c_str()); if (d == NULL) throw String("unable to open directory ") + path; @@ -228,13 +228,13 @@ vector words = utils::split(entry); if (words.size() < 6) throw String("invalid log entry format"); - if (words[4] == "last" && + if (words[4] == "last" && words[5] == "message") throw String("LogEntry: last message repetition"); - if (words[5] == "printk:" && - entry.find("suppressed") != entry.npos) + if (words[5] == "printk:" && + entry.find("suppressed") != entry.npos) throw String("LogEntry: printk repetition"); - + // get current year (not present in log files) char buff[100]; time_t current_time = ::time(0); @@ -254,7 +254,7 @@ } if (age < 0) throw String("error in LogEntry() - negative age"); - + // domain & pid String d = utils::rstrip(utils::to_lower(words[4]), ":"); String::size_type i = d.find("["); @@ -273,12 +273,12 @@ if (words[5][words[5].size()-1] == ':') idx = 6; } - + // message for ( ; idx::size_type j=4; j<6; j++) { String t(utils::strip(utils::to_lower(words[j]))); @@ -305,7 +305,7 @@ tags.insert(tmp_tag); } } - + // tags (from tag sets) vector sets = get_sets(); set tags_c(tags); @@ -327,7 +327,7 @@ tags.erase(""); } -String +String LogEntry::compare_str() const { String b(utils::to_string(age)); @@ -349,7 +349,7 @@ x.set_attr("pid", pid); x.set_attr("age", utils::to_string(age)); x.set_attr("msg", msg); - + for (set::const_iterator iter = matched_tags.begin(); iter != matched_tags.end(); iter++) { @@ -357,7 +357,7 @@ t.set_attr("tag", *iter); x.add_child(t); } - + return x; } @@ -367,9 +367,9 @@ -set +set LogParser::get_entries(long long age, - const std::list& domains, + const std::list& domains, const list& paths) { set ret; @@ -379,11 +379,11 @@ age_time = 0; else age_time -= age; - - + + // set of requested tags set req_tags(domains.begin(), domains.end()); - + // get log paths set files; for (list::const_iterator iter = paths.begin(); @@ -394,7 +394,7 @@ get_files("/var/log/messages", files, age_time); get_files("/var/log/syslog", files, age_time); } - + // process log files for (set::const_iterator iter = files.begin(); iter != files.end(); @@ -426,6 +426,6 @@ } catch ( ... ) {} } } - + return ret; } --- conga/ricci/modules/log/LogParser.h 2006/08/10 22:53:08 1.3 +++ conga/ricci/modules/log/LogParser.h 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -35,23 +35,23 @@ { public: LogEntry(const String& entry); - + long long age; String domain; String msg; String pid; - + std::set tags; std::set matched_tags; - + XMLObject xml() const; - + bool operator < (const LogEntry&) const; - + private: - + String compare_str() const; - + }; @@ -59,12 +59,12 @@ class LogParser { public: - - std::set get_entries(long long age, - const std::list& tags, + + std::set get_entries(long long age, + const std::list& tags, const std::list& paths); - - + + }; --- conga/ricci/modules/log/LoggingModule.cpp 2006/08/10 22:53:08 1.3 +++ conga/ricci/modules/log/LoggingModule.cpp 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -47,15 +47,15 @@ { FcnMap api_1_0; api_1_0["get"] = get; - + ApiFcnMap api_fcn_map; api_fcn_map["1.0"] = api_1_0; - + return api_fcn_map; } -VarMap +VarMap get(const VarMap& args) { long long age; @@ -67,24 +67,24 @@ if (iter == args.end()) throw APIerror("missing age variable"); age = iter->second.get_int(); - + iter = args.find("tags"); if (iter != args.end()) tags = iter->second.get_list_str(); - + iter = args.find("paths"); if (iter != args.end()) paths = iter->second.get_list_str(); - + iter = args.find("intersection"); if (iter != args.end()) intersection = iter->second.get_bool(); } catch ( String e ) { throw APIerror(e); } - + // clean up - + list t; for (list::const_iterator iter = tags.begin(); iter != tags.end(); @@ -102,11 +102,11 @@ t.push_back(s); } paths.swap(t); - + // command - - set entries = LogParser().get_entries(age, - tags, + + set entries = LogParser().get_entries(age, + tags, paths); // union or intersection? if (intersection) { @@ -119,17 +119,17 @@ intersect.insert(*iter); entries.swap(intersect); } - + // response - + list result_list; for (set::const_iterator iter = entries.begin(); iter != entries.end(); iter++) result_list.push_back(iter->xml()); - + Variable var("log_entries", result_list); - + VarMap ret; ret.insert(pair(var.name(), var)); return ret; --- conga/ricci/modules/log/LoggingModule.h 2006/06/02 00:14:29 1.1 +++ conga/ricci/modules/log/LoggingModule.h 2007/09/11 02:45:28 1.2 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -32,9 +32,9 @@ public: LoggingModule(); virtual ~LoggingModule(); - + private: - + }; --- conga/ricci/modules/log/main.cpp 2006/08/15 04:15:53 1.3 +++ conga/ricci/modules/log/main.cpp 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* --- conga/ricci/modules/rpm/PackageHandler.cpp 2007/03/03 05:15:32 1.14 +++ conga/ricci/modules/rpm/PackageHandler.cpp 2007/09/11 02:45:28 1.15 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -37,7 +37,7 @@ #define YUM_PATH "/usr/bin/yum" -static bool +static bool RHEL4=false, RHEL5=false, FC5=false, FC6=false; static void set_release(); @@ -88,10 +88,10 @@ PackageInstaller::available_rpms() { map rpms; - + if (!available()) return rpms; - + if (RHEL4) { String out, err; int status; @@ -115,7 +115,7 @@ String version = words[l-2] + "-" + words[l-1].substr(0, words[l-1].rfind(".")); rpms[name] = version; } - + } else if (FC5 || FC6 || RHEL5) { String out, err; int status; @@ -144,7 +144,7 @@ rpms[name] = version; } } - + return rpms; } @@ -153,7 +153,7 @@ { if (rpms.empty()) return true; - + if (RHEL4) { String out, err; int status; @@ -165,7 +165,7 @@ if (status != 0) throw String(UP2DATE_PATH) + " failed"; return true; - + } else if (FC5 || FC6 || RHEL5) { vector rpms_to_install, rpms_to_upgrade; String out, err; @@ -225,7 +225,7 @@ return false; } return true; - } else + } else return false; } @@ -249,7 +249,7 @@ Package::~Package() {} -XMLObject +XMLObject Package::xml() const { XMLObject xml("rpm"); @@ -285,7 +285,7 @@ PackageSet::~PackageSet() {} -XMLObject +XMLObject PackageSet::xml() const { XMLObject xml("set"); @@ -308,9 +308,9 @@ PackageHandler::PackageHandler() { set_release(); - + // get installed packages - + String out, err; int status; vector args; @@ -336,7 +336,7 @@ pack.version = words[l-2] + "-" + words[l-1]; _packages[name] = pack; } - + // probe repositories if (repo_available()) { map avail_rpms = _pi.available_rpms(); @@ -350,8 +350,8 @@ pack.repo_version = version; } } - - + + // build sets _sets = build_sets(); for (map::iterator iter = _sets.begin(); @@ -364,41 +364,41 @@ {} -std::map& +std::map& PackageHandler::packages() { return _packages; } -std::map& +std::map& PackageHandler::sets() { return _sets; } -std::map +std::map PackageHandler::build_sets() { map sets; - + PackageSet set = build_cluster_base_set(); sets[set.name] = set; - + if (RHEL4 || FC5) { set = build_cluster_base_gulm_set(); sets[set.name] = set; } - + set = build_cluster_services_set(); sets[set.name] = set; - + set = build_cluster_storage_set(); sets[set.name] = set; - + set = build_linux_virtual_server_set(); sets[set.name] = set; - + return sets; } @@ -406,13 +406,13 @@ PackageHandler::build_cluster_base_set() { PackageSet set("Cluster Base"); - + if (RHEL4 || FC5) { set.packages.push_back("ccs"); set.packages.push_back("cman"); set.packages.push_back("dlm"); set.packages.push_back("fence"); - + struct utsname uts; uname(&uts); String kernel(uts.release); @@ -429,7 +429,7 @@ } else if (RHEL5 || FC6) { set.packages.push_back("cman"); } - + return set; } @@ -437,13 +437,13 @@ PackageHandler::build_cluster_base_gulm_set() { PackageSet set("Cluster Base - Gulm"); - + if (RHEL4 || FC5) { set.packages.push_back("ccs"); set.packages.push_back("gulm"); } else throw String("GULM not available in CS5"); - + return set; } @@ -465,10 +465,10 @@ struct utsname uts; uname(&uts); String kernel(uts.release); - + PackageSet set("Clustered Storage"); set.packages.push_back("lvm2-cluster"); - + if (RHEL4 || FC5) { set.packages.push_back("GFS"); if (kernel.find("smp") != kernel.npos) { @@ -488,11 +488,11 @@ set.packages.push_back("kmod-gfs-xen"); } } - + return set; } -PackageSet +PackageSet PackageHandler::build_linux_virtual_server_set() { PackageSet set("Linux Virtual Server"); @@ -508,7 +508,7 @@ set.installed = true; set.in_repo = true; set.upgradeable = false; - + for (list::const_iterator name_iter = set.packages.begin(); name_iter != set.packages.end(); name_iter++) { @@ -533,13 +533,13 @@ set.upgradeable = false; } -void -PackageHandler::install(const std::list& packages, +void +PackageHandler::install(const std::list& packages, const std::list& sets, bool upgrade) { vector rpms; - + PackageHandler h_pre; for (list::const_iterator iter = packages.begin(); iter != packages.end(); @@ -568,7 +568,7 @@ } } } - + for (list::const_iterator iter = sets.begin(); iter != sets.end(); iter++) { @@ -602,7 +602,7 @@ } } } - + if (!_pi.install(rpms)) { String msg("Failed to install packages"); if (!repo_available()) @@ -628,7 +628,7 @@ static bool release_set = false; if (!release_set) { String release(utils::strip(File::open("/etc/redhat-release"))); - + if (release.find("Nahant") != release.npos) RHEL4 = true; else if (release.find("Bordeaux") != release.npos) @@ -639,7 +639,7 @@ RHEL5 = true; else throw String("Unsupported OS"); - + release_set = true; } } --- conga/ricci/modules/rpm/PackageHandler.h 2006/10/12 19:13:11 1.5 +++ conga/ricci/modules/rpm/PackageHandler.h 2007/09/11 02:45:28 1.6 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -36,17 +36,17 @@ Package(); Package(const String& name); virtual ~Package(); - + String name; String summary; String description; String version; String repo_version; - + XMLObject xml() const; - + private: - + }; // class Package @@ -56,20 +56,20 @@ PackageSet(); PackageSet(const String& name); virtual ~PackageSet(); - + String name; String summary; String description; bool installed; bool in_repo; bool upgradeable; - + std::list packages; - + XMLObject xml() const; - + private: - + }; // class PackageSet @@ -78,11 +78,11 @@ public: PackageInstaller(); virtual ~PackageInstaller(); - + bool available(); std::map available_rpms(); bool install(std::vector rpm_names); - + }; @@ -91,34 +91,34 @@ public: PackageHandler(); virtual ~PackageHandler(); - + std::map& packages(); std::map& sets(); - + void populate_set(PackageSet& set); - - + + static bool repo_available(); - + static std::map build_sets(); static PackageSet build_cluster_base_set(); static PackageSet build_cluster_base_gulm_set(); static PackageSet build_cluster_services_set(); static PackageSet build_cluster_storage_set(); static PackageSet build_linux_virtual_server_set(); - + static void install(const std::list& packages, const std::list& sets, bool upgrade=true); - + private: - + std::map _packages; std::map _sets; - + static PackageInstaller _pi; - - + + }; // class PackageHandler --- conga/ricci/modules/rpm/RpmModule.cpp 2006/10/12 19:13:11 1.3 +++ conga/ricci/modules/rpm/RpmModule.cpp 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -52,15 +52,15 @@ api_1_0["query"] = query; api_1_0["install"] = install; api_1_0["repository_configured"] = repository_configured; - + ApiFcnMap api_fcn_map; api_fcn_map["1.0"] = api_1_0; - + return api_fcn_map; } -VarMap +VarMap install(const VarMap& args) { list rpms_list, sets_list; @@ -69,11 +69,11 @@ VarMap::const_iterator iter = args.find("rpms"); if (iter != args.end()) rpms_list = iter->second.get_list_XML(); - + iter = args.find("sets"); if (iter != args.end()) sets_list = iter->second.get_list_XML(); - + upgrade = true; iter = args.find("upgrade"); if (iter != args.end()) @@ -81,8 +81,8 @@ } catch ( String e ) { throw APIerror(e); } - - // command + + // command list rpms; for (list::const_iterator iter = rpms_list.begin(); iter != rpms_list.end(); @@ -94,7 +94,7 @@ rpms.push_back(pack); } } - + list sets; for (list::const_iterator iter = sets_list.begin(); iter != sets_list.end(); @@ -106,22 +106,22 @@ sets.push_back(set); } } - + PackageHandler::install(rpms, sets, upgrade); return VarMap(); } -VarMap +VarMap repository_configured(const VarMap& args) { Variable var("repository_configured", PackageHandler::repo_available()); - + VarMap ret; ret.insert(pair(var.name(), var)); return ret; } -VarMap +VarMap lists(const VarMap& args) { bool rpms, sets, installed, installable, upgradeable; @@ -130,22 +130,22 @@ VarMap::const_iterator iter = args.find("rpms"); if (iter != args.end()) rpms = iter->second.get_bool(); - + sets = false; iter = args.find("sets"); if (iter != args.end()) sets = iter->second.get_bool(); - + installed = false; iter = args.find("installed"); if (iter != args.end()) installed = iter->second.get_bool(); - + installable = false; iter = args.find("installable"); if (iter != args.end()) installable = iter->second.get_bool(); - + upgradeable = false; iter = args.find("upgradeable"); if (iter != args.end()) @@ -153,13 +153,13 @@ } catch ( String e ) { throw APIerror(e); } - - + + VarMap ret; - + if (sets || rpms) { PackageHandler handler; - + if (rpms) { list rpm_list; for (map::const_iterator iter = handler.packages().begin(); @@ -184,7 +184,7 @@ Variable var("rpms", rpm_list); ret.insert(pair(var.name(), var)); } - + if (sets) { list set_list; for (map::const_iterator iter = handler.sets().begin(); @@ -210,11 +210,11 @@ ret.insert(pair(var.name(), var)); } } - + return ret; } -VarMap +VarMap query(const VarMap& args) { list search_list; @@ -226,8 +226,8 @@ } catch ( String e ) { throw APIerror(e); } - - + + list result_list; PackageHandler handler; for (list::const_iterator iter = search_list.begin(); @@ -249,9 +249,9 @@ } } } - + Variable var("result", result_list); - + VarMap ret; ret.insert(pair(var.name(), var)); return ret; --- conga/ricci/modules/rpm/RpmModule.h 2006/04/07 16:42:40 1.1 +++ conga/ricci/modules/rpm/RpmModule.h 2007/09/11 02:45:28 1.2 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -32,9 +32,9 @@ public: RpmModule(); virtual ~RpmModule(); - + private: - + }; --- conga/ricci/modules/rpm/main.cpp 2006/08/15 04:15:53 1.4 +++ conga/ricci/modules/rpm/main.cpp 2007/09/11 02:45:28 1.5 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* --- conga/ricci/modules/service/ServiceManager.cpp 2007/02/24 09:39:22 1.11 +++ conga/ricci/modules/service/ServiceManager.cpp 2007/09/11 02:45:28 1.12 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -39,7 +39,7 @@ #define DESC_SIG String("# description:") -static bool +static bool RHEL4=false, RHEL5=false, FC5=false, FC6=false; static void set_release(); @@ -65,12 +65,12 @@ {} -XMLObject +XMLObject Service::xml(bool descr) const { if (!_name.get()) throw String("internal: service not initialized"); - + XMLObject xml("service"); xml.set_attr("name", name()); xml.set_attr("enabled", enabled()?"true":"false"); @@ -79,7 +79,7 @@ return xml; } -String +String Service::name() const { if (!_name.get()) @@ -87,7 +87,7 @@ return *_name; } -bool +bool Service::enabled() const { if (!_enabled.get()) @@ -95,7 +95,7 @@ return *_enabled; } -bool +bool Service::running() const { if (!_running.get()) @@ -103,17 +103,17 @@ return *_running; } -String +String Service::description() const { if (!_descr.get()) { String path(INITD_DIR_PATH); path += name(); - + String initd(File::open(path)); - + list desc_lines; - + vector lines = utils::split(initd, "\n"); for (vector::const_iterator iter = lines.begin(); iter != lines.end(); @@ -132,7 +132,7 @@ break; break; } - + String desc; for (list::const_iterator l_iter = desc_lines.begin(); l_iter != desc_lines.end(); @@ -143,14 +143,14 @@ s = utils::lstrip(s); desc += s; } - + _descr = counting_auto_ptr(new String(desc)); } - + return *_descr; } -void +void Service::enable() { if (!enabled()) { @@ -159,7 +159,7 @@ } } -void +void Service::disable() { if (enabled()) { @@ -168,7 +168,7 @@ } } -void +void Service::start() { running(); @@ -176,7 +176,7 @@ *_running = true; } -void +void Service::restart() { running(); @@ -184,7 +184,7 @@ *_running = true; } -void +void Service::stop() { running(); @@ -192,7 +192,7 @@ *_running = false; } -void +void Service::enable_service(const String& name, bool on) { String out, err; @@ -209,12 +209,12 @@ throw String("chkconfig failed for service ") + name; } -bool +bool Service::service_running(const String& name) { String path(INITD_DIR_PATH); path += name; - + String out, err; int status; vector args; @@ -224,12 +224,12 @@ return status == 0; } -void +void Service::run_service(const String& name, ActionState state) { String path(INITD_DIR_PATH); path += name; - + String out, err; int status; vector args; @@ -285,7 +285,7 @@ {} -XMLObject +XMLObject ServiceSet::xml(bool descr) const { XMLObject xml("set"); @@ -296,7 +296,7 @@ return xml; } -String +String ServiceSet::name() const { if (!_name.get() || servs.empty()) @@ -304,7 +304,7 @@ return *_name; } -bool +bool ServiceSet::enabled() const { name(); @@ -316,7 +316,7 @@ return true; } -bool +bool ServiceSet::running() const { name(); @@ -328,14 +328,14 @@ return true; } -String +String ServiceSet::description() const { name(); return *_descr; } -void +void ServiceSet::enable() { name(); @@ -349,7 +349,7 @@ } } -void +void ServiceSet::disable() { name(); @@ -363,7 +363,7 @@ } } -void +void ServiceSet::start() { name(); @@ -377,7 +377,7 @@ } } -void +void ServiceSet::restart() { name(); @@ -390,7 +390,7 @@ } } -void +void ServiceSet::stop() { name(); @@ -411,7 +411,7 @@ ServiceManager::ServiceManager() { set_release(); - + String out, err; int status; vector args; @@ -429,14 +429,14 @@ continue; String name = words[0]; bool enabled = false; - for (vector::size_type i=2; + for (vector::size_type i=2; i < words.size() - 1; i++) if (words[i].find("on") != String::npos) enabled = true; _servs[name] = Service(name, enabled); } - + _sets = generate_sets(); } @@ -448,7 +448,7 @@ ServiceManager::generate_sets() { map sets; - + list servs; String name = "Cluster Base"; String descr = "Cluster infrastructure: ccs, cman, fence"; @@ -463,8 +463,8 @@ ServiceSet s(name, descr); if (populate_set(s, servs)) sets[name] = s; - - + + if (RHEL4 || FC5) { servs.clear(); name = "Cluster Base - Gulm"; @@ -475,8 +475,8 @@ if (populate_set(s, servs)) sets[name] = s; } - - + + servs.clear(); name = "Cluster Service Manager"; descr = "Cluster Service Manager: rgmanager"; @@ -484,8 +484,8 @@ servs.push_back("rgmanager"); if (populate_set(s, servs)) sets[name] = s; - - + + servs.clear(); name = "Clustered Storage"; if (RHEL4 || FC5) { @@ -501,8 +501,8 @@ s = ServiceSet(name, descr); if (populate_set(s, servs)) sets[name] = s; - - + + servs.clear(); name = "Linux Virtual Server"; descr = "Red Hat's LVS implementation: pulse, piranha"; @@ -511,13 +511,13 @@ servs.push_back("piranha-gui"); if (populate_set(s, servs)) sets[name] = s; - - + + return sets; } -bool -ServiceManager::populate_set(ServiceSet& ss, +bool +ServiceManager::populate_set(ServiceSet& ss, std::list servs) { for (list::iterator n_iter = servs.begin(); @@ -532,8 +532,8 @@ } -void -ServiceManager::enable(const std::list& services, +void +ServiceManager::enable(const std::list& services, const std::list& sets) { // check @@ -547,21 +547,21 @@ iter++) if (_sets.find(*iter) == _sets.end()) throw String("no such service set: ") + *iter; - + // apply for (list::const_iterator iter = services.begin(); iter != services.end(); iter++) _servs[*iter].enable(); - + for (list::const_iterator iter = sets.begin(); iter != sets.end(); iter++) _sets[*iter].enable(); } -void -ServiceManager::disable(const std::list& services, +void +ServiceManager::disable(const std::list& services, const std::list& sets) { // check @@ -575,21 +575,21 @@ iter++) if (_sets.find(*iter) == _sets.end()) throw String("no such service set: ") + *iter; - + // apply for (list::const_iterator iter = services.begin(); iter != services.end(); iter++) _servs[*iter].disable(); - + for (list::const_iterator iter = sets.begin(); iter != sets.end(); iter++) _sets[*iter].disable(); } -void -ServiceManager::start(const std::list& services, +void +ServiceManager::start(const std::list& services, const std::list& sets) { // check @@ -603,21 +603,21 @@ iter++) if (_sets.find(*iter) == _sets.end()) throw String("no such service set: ") + *iter; - + // apply for (list::const_iterator iter = services.begin(); iter != services.end(); iter++) _servs[*iter].start(); - + for (list::const_iterator iter = sets.begin(); iter != sets.end(); iter++) _sets[*iter].start(); } -void -ServiceManager::restart(const std::list& services, +void +ServiceManager::restart(const std::list& services, const std::list& sets) { // check @@ -631,21 +631,21 @@ iter++) if (_sets.find(*iter) == _sets.end()) throw String("no such service set: ") + *iter; - + // apply for (list::const_iterator iter = services.begin(); iter != services.end(); iter++) _servs[*iter].restart(); - + for (list::const_iterator iter = sets.begin(); iter != sets.end(); iter++) _sets[*iter].restart(); } -void -ServiceManager::stop(const std::list& services, +void +ServiceManager::stop(const std::list& services, const std::list& sets) { // check @@ -659,52 +659,52 @@ iter++) if (_sets.find(*iter) == _sets.end()) throw String("no such service set: ") + *iter; - + // apply for (list::const_iterator iter = services.begin(); iter != services.end(); iter++) _servs[*iter].stop(); - + for (list::const_iterator iter = sets.begin(); iter != sets.end(); iter++) _sets[*iter].stop(); } -void -ServiceManager::lists(std::list& services, +void +ServiceManager::lists(std::list& services, std::list& sets) { services.clear(); sets.clear(); - + for (map::const_iterator iter = _servs.begin(); iter != _servs.end(); iter++) services.push_back(iter->second); - + for (map::const_iterator iter = _sets.begin(); iter != _sets.end(); iter++) sets.push_back(iter->second); } -void -ServiceManager::query(const std::list& serv_names, - const std::list& set_names, - std::list& services, +void +ServiceManager::query(const std::list& serv_names, + const std::list& set_names, + std::list& services, std::list& sets) { services.clear(); sets.clear(); - + for (list::const_iterator iter = serv_names.begin(); iter != serv_names.end(); iter++) if (_servs.find(*iter) != _servs.end()) services.push_back(_servs[*iter]); - + for (list::const_iterator iter = set_names.begin(); iter != set_names.end(); iter++) @@ -734,7 +734,7 @@ FC6 = true; else if (release.find("Tikanga") != release.npos) RHEL5 = true; - + release_set = true; } } --- conga/ricci/modules/service/ServiceManager.h 2007/02/24 09:39:22 1.4 +++ conga/ricci/modules/service/ServiceManager.h 2007/09/11 02:45:28 1.5 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -40,38 +40,38 @@ public: Service(); virtual ~Service(); - + String name() const; bool enabled() const; bool running() const; String description() const; - + void enable(); void disable(); void restart(); void start(); void stop(); - + XMLObject xml(bool descriptions) const; - + private: Service(const String& name, bool enabled); - + mutable counting_auto_ptr _name; mutable counting_auto_ptr _descr; mutable counting_auto_ptr _enabled; mutable counting_auto_ptr _running; - + enum ActionState { START, STOP, RESTART }; - + static void enable_service(const String& name, bool on); static bool service_running(const String& name); static void run_service(const String& name, ActionState state); - + friend class ServiceManager; }; @@ -82,26 +82,26 @@ ServiceSet(); ServiceSet(const String& name, const String& description); virtual ~ServiceSet(); - + String name() const; bool enabled() const; bool running() const; String description() const; - + void enable(); void disable(); void start(); void restart(); void stop(); - + std::list servs; - + XMLObject xml(bool descriptions) const; - + private: mutable counting_auto_ptr _name; mutable counting_auto_ptr _descr; - + }; @@ -110,30 +110,30 @@ public: ServiceManager(); virtual ~ServiceManager(); - + void enable(const std::list& services, const std::list& sets); void disable(const std::list& services, const std::list& sets); - + void start(const std::list& services, const std::list& sets); void restart(const std::list& services, const std::list& sets); void stop(const std::list& services, const std::list& sets); - - void lists(std::list& services, + + void lists(std::list& services, std::list& sets); - - void query(const std::list& serv_names, - const std::list& set_names, - std::list& services, + + void query(const std::list& serv_names, + const std::list& set_names, + std::list& services, std::list& sets); - + private: std::map _servs; std::map _sets; - + std::map generate_sets(); - + bool populate_set(ServiceSet& ss, std::list servs); - + }; --- conga/ricci/modules/service/ServiceModule.cpp 2007/02/23 22:02:57 1.4 +++ conga/ricci/modules/service/ServiceModule.cpp 2007/09/11 02:45:28 1.5 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -58,15 +58,15 @@ api_1_0["stop"] = stop; api_1_0["list"] = lists; api_1_0["query"] = query; - + ApiFcnMap api_fcn_map; api_fcn_map["1.0"] = api_1_0; - + return api_fcn_map; } -VarMap +VarMap enable(const VarMap& args) { list serv_list; @@ -78,7 +78,7 @@ } catch ( String e ) { throw APIerror(e); } - + list services, sets; for (list::const_iterator iter = serv_list.begin(); iter != serv_list.end(); @@ -88,13 +88,13 @@ else if (iter->tag() == "set") sets.push_back(iter->get_attr("name")); } - + ServiceManager().enable(services, sets); - + return VarMap(); } -VarMap +VarMap disable(const VarMap& args) { list serv_list; @@ -106,7 +106,7 @@ } catch ( String e ) { throw APIerror(e); } - + list services, sets; for (list::const_iterator iter = serv_list.begin(); iter != serv_list.end(); @@ -116,13 +116,13 @@ else if (iter->tag() == "set") sets.push_back(iter->get_attr("name")); } - + ServiceManager().disable(services, sets); - + return VarMap(); } -VarMap +VarMap start(const VarMap& args) { list serv_list; @@ -134,7 +134,7 @@ } catch ( String e ) { throw APIerror(e); } - + list services, sets; for (list::const_iterator iter = serv_list.begin(); iter != serv_list.end(); @@ -144,13 +144,13 @@ else if (iter->tag() == "set") sets.push_back(iter->get_attr("name")); } - + ServiceManager().start(services, sets); - + return VarMap(); } -VarMap +VarMap restart(const VarMap& args) { list serv_list; @@ -162,7 +162,7 @@ } catch ( String e ) { throw APIerror(e); } - + list services, sets; for (list::const_iterator iter = serv_list.begin(); iter != serv_list.end(); @@ -172,13 +172,13 @@ else if (iter->tag() == "set") sets.push_back(iter->get_attr("name")); } - + ServiceManager().restart(services, sets); - + return VarMap(); } -VarMap +VarMap stop(const VarMap& args) { list serv_list; @@ -190,7 +190,7 @@ } catch ( String e ) { throw APIerror(e); } - + list services, sets; for (list::const_iterator iter = serv_list.begin(); iter != serv_list.end(); @@ -200,13 +200,13 @@ else if (iter->tag() == "set") sets.push_back(iter->get_attr("name")); } - + ServiceManager().stop(services, sets); - + return VarMap(); } -VarMap +VarMap lists(const VarMap& args) { bool descr; @@ -218,11 +218,11 @@ } catch ( String e ) { throw APIerror(e); } - + // command - + list xml_list; - + list services; list sets; ServiceManager().lists(services, sets); @@ -234,16 +234,16 @@ iter != sets.end(); iter++) xml_list.push_back(iter->xml(descr)); - + // response Variable var("services", xml_list); - + VarMap ret; ret.insert(pair(var.name(), var)); return ret; } -VarMap +VarMap query(const VarMap& args) { list search_list; @@ -253,7 +253,7 @@ if (iter == args.end()) throw APIerror("missing search variable"); search_list = iter->second.get_list_XML(); - + descr = false; iter = args.find("description"); if (iter != args.end()) @@ -261,9 +261,9 @@ } catch ( String e ) { throw APIerror(e); } - + // command - + list serv_names, set_names; for (list::const_iterator iter = search_list.begin(); iter != search_list.end(); @@ -273,16 +273,16 @@ else if (iter->tag() == "set") set_names.push_back(iter->get_attr("name")); } - + list services; list sets; - ServiceManager().query(serv_names, - set_names, - services, + ServiceManager().query(serv_names, + set_names, + services, sets); - + // response - + list result_list; for (list::const_iterator iter = services.begin(); iter != services.end(); @@ -292,9 +292,9 @@ iter != sets.end(); iter++) result_list.push_back(iter->xml(descr)); - + Variable var("result", result_list); - + VarMap ret; ret.insert(pair(var.name(), var)); return ret; --- conga/ricci/modules/service/ServiceModule.h 2006/04/07 16:42:40 1.1 +++ conga/ricci/modules/service/ServiceModule.h 2007/09/11 02:45:28 1.2 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -32,9 +32,9 @@ public: ServiceModule(); virtual ~ServiceModule(); - + private: - + }; --- conga/ricci/modules/service/main.cpp 2006/08/15 04:15:53 1.4 +++ conga/ricci/modules/service/main.cpp 2007/09/11 02:45:28 1.5 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* --- conga/ricci/modules/storage/BD.cpp 2006/10/06 03:10:13 1.4 +++ conga/ricci/modules/storage/BD.cpp 2007/09/11 02:45:28 1.5 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -41,9 +41,9 @@ // ##### BD ##### -BD::BD(const String& mapper_type, - const String& mapper_id, - const String& bd_type, +BD::BD(const String& mapper_type, + const String& mapper_id, + const String& bd_type, const String& path, bool check_path) : content(ContentFactory().probe(path)), @@ -55,7 +55,7 @@ if (check_path) { // if (access(path.c_str(), F_OK) != 0) // throw String("file non-existant"); - + // size (can be overwritten by descendants) String out, err; int status; @@ -78,71 +78,71 @@ else _props.set(Variable("size", size)); } - + _props.set(Variable("path", path)); removable(false); - + } BD::~BD() {} -String +String BD::path() const { return _props.get("path").get_string(); } -long long +long long BD::size() const { return _props.get("size").get_int(); } -String +String BD::state_ind() const { XMLObject t; t.add_child(_props.xml()); t.add_child(content->xml()); - + return utils::hash_str(generateXML(t) + path() + _mapper_id); } -String +String BD::mapper_id() const { return _mapper_id; } -String +String BD::mapper_type() const { return _mapper_type; } - -bool + +bool BD::removable() const { return _props.get("removable").get_bool(); } -void +void BD::removable(bool removable) { _props.set(Variable("removable", removable)); } -counting_auto_ptr +counting_auto_ptr BD::apply(const BDParsed& bd_parsed) { if (bd_parsed.content->_replacement.get()) { // replace content - + content->remove(); - + // first this->apply_props_before_resize(bd_parsed.props); // second - size @@ -155,22 +155,22 @@ } // third this->apply_props_after_resize(bd_parsed.props); - + counting_auto_ptr new_bd = BDFactory().get_bd(path()); ContentFactory().create_content(new_bd, bd_parsed.content); } else { // modify content - + long long orig_size = this->size(); long long new_size = bd_parsed.props.get("size").get_int(); - + // first this->apply_props_before_resize(bd_parsed.props); - content->apply_props_before_resize(path(), + content->apply_props_before_resize(path(), orig_size, new_size, bd_parsed.content->props); - + // second - size if (orig_size > new_size) { content->shrink(path(), new_size, bd_parsed.content->props); @@ -184,22 +184,22 @@ throw; } } - + // third this->apply_props_after_resize(bd_parsed.props); - content->apply_props_after_resize(path(), + content->apply_props_after_resize(path(), orig_size, new_size, bd_parsed.content->props); } - + utils::clear_cache(); return BDFactory().get_bd(path()); } -XMLObject +XMLObject BD::xml() const { XMLObject bd(BD_TYPE_TAG); @@ -210,7 +210,7 @@ bd.set_attr("state_ind", state_ind()); bd.add_child(_props.xml()); bd.add_child(content->xml()); - + return bd; } @@ -224,29 +224,29 @@ // ##### BDTemplate ##### -BDTemplate::BDTemplate(const String& mapper_type, - const String& mapper_id, - const String& mapper_state_ind, +BDTemplate::BDTemplate(const String& mapper_type, + const String& mapper_id, + const String& mapper_state_ind, const String& bd_type) : mapper_type(mapper_type), mapper_id(mapper_id), - mapper_state_ind(mapper_state_ind), + mapper_state_ind(mapper_state_ind), bd_type(bd_type), content(counting_auto_ptr(new ContentNone(""))) { - + } BDTemplate::BDTemplate(const XMLObject& xml) { if (xml.tag() != BD_TEMPLATE_TYPE_TAG) throw String("not BD template"); - + mapper_type = xml.get_attr("mapper_type"); mapper_id = xml.get_attr("mapper_id"); mapper_state_ind = xml.get_attr("mapper_state_ind"); - - counting_auto_ptr mapper = + + counting_auto_ptr mapper = MapperFactory::get_mapper(mapper_type, mapper_id); if (mapper->state_ind() != mapper_state_ind) throw MidAir(); @@ -254,9 +254,9 @@ bd_type = BD_LV_TYPE; else if (mapper_type == MAPPER_PT_TYPE) bd_type = BD_PART_TYPE; - else + else throw String("BDTemplate(): not implemented"); - + XMLObject content_xml; const list& kids = xml.children(); for (list::const_iterator kid_iter = kids.begin(); @@ -270,11 +270,11 @@ if (kid.tag() == CONTENT_TYPE_TAG) content_xml = kid; } - + // validate props and content - + list > bd_candidates; - for (list >::const_iterator t_iter = + for (list >::const_iterator t_iter = mapper->new_targets.begin(); t_iter != mapper->new_targets.end(); t_iter++) { @@ -283,7 +283,7 @@ bd_candidates.push_back(*t_iter); } catch ( ... ) {} } - + // bd_candidates have valid props, verify content bool valid = false; for (list >::const_iterator iter = bd_candidates.begin(); @@ -305,7 +305,7 @@ {} -XMLObject +XMLObject BDTemplate::xml() const { XMLObject bd(BD_TEMPLATE_TYPE_TAG); @@ -314,7 +314,7 @@ bd.set_attr("mapper_state_ind", mapper_state_ind); bd.add_child(props.xml()); bd.add_child(content->xml()); - + return bd; } @@ -329,20 +329,20 @@ { if (xml.tag() != BD_TYPE_TAG) throw String("not BD"); - + path = xml.get_attr("path"); state_ind = xml.get_attr("state_ind"); if (path.empty() || state_ind.empty()) throw String("BDParsed missing identification"); - + // get BD try { bd = BDFactory::get_bd(path); } catch ( ... ) { throw MidAir(); } - + for (list::const_iterator iter = xml.children().begin(); iter != xml.children().end(); iter++) { @@ -356,7 +356,7 @@ throw; } catch ( ... ) {} } - + // ### validate ### if (bd->state_ind() != state_ind) throw MidAir(); @@ -364,9 +364,9 @@ if (!content.get()) throw String("missing content tag"); // content validated self - - - + + + } BDParsed::~BDParsed() --- conga/ricci/modules/storage/BD.h 2006/08/10 22:53:09 1.4 +++ conga/ricci/modules/storage/BD.h 2007/09/11 02:45:28 1.5 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -40,21 +40,21 @@ public: BDParsed(const XMLObject& xml); virtual ~BDParsed(); - + counting_auto_ptr content; - + Props props; - + // MapperType mapper_type; // String mapper_id; // BDType bd_type; String path; String state_ind; - - + + counting_auto_ptr bd; - - + + }; // class BDParsed @@ -62,53 +62,53 @@ { public: virtual ~BD(); - + String path() const; virtual String state_ind() const; virtual long long size() const; String mapper_id() const; String mapper_type() const; - + XMLObject xml() const; - + counting_auto_ptr content; - + Props _props; - + virtual bool removable() const; virtual void removable(bool removable); virtual void remove() = 0; - + virtual counting_auto_ptr apply(const BDParsed& bd); // return new bd - - - - + + + + protected: - BD(const String& mapper_type, - const String& mapper_id, - const String& bd_type, + BD(const String& mapper_type, + const String& mapper_id, + const String& bd_type, const String& path, bool check_path = true); - + String _mapper_type; String _mapper_id; String _bd_type; String _path; - - - virtual void shrink(unsigned long long new_size, + + + virtual void shrink(unsigned long long new_size, const Props& new_props) = 0; - virtual void expand(unsigned long long new_size, + virtual void expand(unsigned long long new_size, const Props& new_props) = 0; - + virtual String apply_props_before_resize(const Props& new_props) = 0; // return path virtual String apply_props_after_resize(const Props& new_props) = 0; // return path - - - + + + private: - + }; // class BD @@ -117,31 +117,31 @@ public: BDTemplate(const XMLObject& xml); virtual ~BDTemplate(); - + XMLObject xml() const; - - - + + + String mapper_type; String mapper_id; String mapper_state_ind; String bd_type; - + Props props; - + counting_auto_ptr content; // valid only if not constructed from XML - + counting_auto_ptr content_parsed; // valid only if constructed from XML - + protected: - BDTemplate(const String& mapper_type, - const String& mapper_id, - const String& mapper_state_ind, + BDTemplate(const String& mapper_type, + const String& mapper_id, + const String& mapper_state_ind, const String& bd_type); - - + + private: - + }; // class BDTemplate --- conga/ricci/modules/storage/BDFactory.cpp 2006/09/26 01:16:13 1.4 +++ conga/ricci/modules/storage/BDFactory.cpp 2007/09/11 02:45:28 1.5 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -35,26 +35,26 @@ using namespace std; -counting_auto_ptr +counting_auto_ptr BDFactory::get_bd(const String& path) { try { return counting_auto_ptr(new LV(path)); } catch ( ... ) {} - + try { return counting_auto_ptr(new Partition(path)); } catch ( ... ) {} - + try { return counting_auto_ptr(new MDRaidTarget(path)); } catch ( ... ) {} - + return counting_auto_ptr(new HD(path)); } -counting_auto_ptr +counting_auto_ptr BDFactory::create_bd(const BDTemplate& bd_temp) { if (bd_temp.bd_type == BD_LV_TYPE) @@ -65,7 +65,7 @@ } -counting_auto_ptr +counting_auto_ptr BDFactory::modify_bd(const BDParsed& parsed_bd) { counting_auto_ptr old_bd = get_bd(parsed_bd.path); @@ -82,7 +82,7 @@ throw MidAir(); if (!old_bd->removable()) throw String("invalid call: bd not removable"); - + old_bd->remove(); return MapperFactory::get_mapper(old_bd->mapper_type(), old_bd->mapper_id()); --- conga/ricci/modules/storage/BDFactory.h 2006/08/10 22:53:09 1.3 +++ conga/ricci/modules/storage/BDFactory.h 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -34,15 +34,15 @@ class BDFactory { public: - + static counting_auto_ptr create_bd(const BDTemplate& bd_temp); - + static counting_auto_ptr get_bd(const String& path); - + static counting_auto_ptr modify_bd(const BDParsed& bd); - + static counting_auto_ptr remove_bd(const BDParsed& bd); - + }; --- conga/ricci/modules/storage/ClusterNotQuorateError.h 2007/03/05 20:45:17 1.3 +++ conga/ricci/modules/storage/ClusterNotQuorateError.h 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -34,7 +34,7 @@ : Except(5, String("Cluster is not quorate")) {} virtual ~ClusterNotQuorateError() {} - + }; --- conga/ricci/modules/storage/ClusterNotRunningError.h 2007/03/05 20:45:17 1.2 +++ conga/ricci/modules/storage/ClusterNotRunningError.h 2007/09/11 02:45:28 1.3 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -34,7 +34,7 @@ : Except(7, String("Cluster infrastructure is not active")) {} virtual ~ClusterNotRunningError() {} - + }; --- conga/ricci/modules/storage/ClvmdError.h 2007/03/05 20:45:17 1.3 +++ conga/ricci/modules/storage/ClvmdError.h 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -34,7 +34,7 @@ : Except(4, String("clvmd failed to start")) {} virtual ~ClvmdError() {} - + }; --- conga/ricci/modules/storage/Content.cpp 2006/08/10 22:53:09 1.3 +++ conga/ricci/modules/storage/Content.cpp 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -43,22 +43,22 @@ {} -String +String Content::path() const { return _props.get("path").get_string(); } -String +String Content::state_ind() const { XMLObject xml; xml.add_child(_props.xml()); - + return utils::hash_str(generateXML(xml) + path()); } -void +void Content::add_replacement(const counting_auto_ptr& replacement) { _avail_replacements.push_back(replacement); @@ -70,7 +70,7 @@ return false; } -XMLObject +XMLObject Content::xml() const { XMLObject xml(CONTENT_TYPE_TAG); @@ -78,19 +78,19 @@ // xml.set_attr("path", path()); // xml.set_attr("state_ind", state_ind()); xml.add_child(_props.xml()); - + XMLObject replacements(CONTENT_REPLACEMENTS_TAG); for (list >::const_iterator iter = _avail_replacements.begin(); iter != _avail_replacements.end(); iter++) replacements.add_child((*iter)->xml()); xml.add_child(replacements); - + XMLObject replacement(CONTENT_NEW_CONTENT_TAG); if (_replacement.get()) replacement.add_child(_replacement->xml()); xml.add_child(replacement); - + return xml; } @@ -110,12 +110,12 @@ { if (xml.tag() != CONTENT_TEMPLATE_TYPE_TAG) throw String("not Content template"); - + attrs = xml.attrs(); - + type = xml.get_attr("type"); - - + + const list& kids = xml.children(); for (list::const_iterator kid_iter = kids.begin(); kid_iter != kids.end(); @@ -125,38 +125,38 @@ break; } catch ( ... ) {} } - + // validate props counting_auto_ptr orig_ct; - for (list >::const_iterator iter = + for (list >::const_iterator iter = content->_avail_replacements.begin(); iter != content->_avail_replacements.end(); iter++) if ((*iter)->attrs == attrs) orig_ct = *iter; - + if (orig_ct.get()) { orig_ct->_props.validate(_props); - } else + } else throw MidAir(); } ContentTemplate::~ContentTemplate() {} -XMLObject +XMLObject ContentTemplate::xml() const { XMLObject xml(CONTENT_TEMPLATE_TYPE_TAG); - + xml.set_attr("type", type); for (map::const_iterator iter = attrs.begin(); iter != attrs.end(); - iter++) + iter++) xml.set_attr(iter->first, iter->second); - + xml.add_child(_props.xml()); - + return xml; } @@ -173,14 +173,14 @@ throw String("not Content") + xml.tag(); if (!content.get()) throw String("content null pointer!!!"); - + const XMLObject& orig_xml = content->xml(); for (std::map::const_iterator iter = orig_xml.attrs().begin(); iter != orig_xml.attrs().end(); iter++) if (xml.get_attr(iter->first) != iter->second) throw String("not a matching content"); - + for (list::const_iterator iter = xml.children().begin(); iter != xml.children().end(); iter++) { @@ -188,25 +188,25 @@ props = Props(*iter); continue; } catch ( ... ) {} - + // replacement if (iter->tag() == CONTENT_NEW_CONTENT_TAG) { if (iter->children().size() > 1) throw String("invalid number of replacement contents"); - else if (iter->children().size() == 1) - _replacement = + else if (iter->children().size() == 1) + _replacement = counting_auto_ptr(new ContentTemplate(iter->children().front(), content)); } } - + // ### validation ### - + content->_props.validate(props);; - + // validate replacement if (_replacement.get()) { bool replacement_found = false; - for (list >::const_iterator iter = + for (list >::const_iterator iter = content->_avail_replacements.begin(); iter != content->_avail_replacements.end(); iter++) { --- conga/ricci/modules/storage/Content.h 2006/08/10 22:53:09 1.3 +++ conga/ricci/modules/storage/Content.h 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -38,14 +38,14 @@ class ContentParsed { public: - ContentParsed(const XMLObject& xml, + ContentParsed(const XMLObject& xml, counting_auto_ptr& content); virtual ~ContentParsed(); - + Props props; counting_auto_ptr content; counting_auto_ptr _replacement; - + }; @@ -53,77 +53,77 @@ { public: virtual ~Content(); - + String path() const; String state_ind() const; - + virtual XMLObject xml() const; - + const String type; - + Props _props; - + counting_auto_ptr _replacement; - + virtual void add_replacement(const counting_auto_ptr& replacement); std::list > _avail_replacements; - - - + + + // internal virtual bool expandable(long long& max_size) const = 0; virtual bool shrinkable(long long& min_size) const = 0; - - + + // modifying fcns virtual void shrink(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props) = 0; virtual void expand(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props) = 0; - + virtual void apply_props_before_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props) = 0; virtual void apply_props_after_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props) = 0; - + virtual bool removable() const; virtual void remove() = 0; - - + + protected: Content(const String& type, const String& path); - + private: - - + + }; class ContentTemplate { public: - ContentTemplate(const XMLObject& xml, + ContentTemplate(const XMLObject& xml, counting_auto_ptr& content); // content to perform validation against virtual ~ContentTemplate(); - + virtual XMLObject xml() const; - + Props _props; - + String type; - + std::map attrs; // update if necessary - + protected: ContentTemplate(const String& type); - - + + }; --- conga/ricci/modules/storage/ContentExtendedPartition.cpp 2006/08/10 22:53:09 1.2 +++ conga/ricci/modules/storage/ContentExtendedPartition.cpp 2007/09/11 02:45:28 1.3 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -36,7 +36,7 @@ {} -bool +bool ContentExtendedPartition::removable() const { // TODO: removable based on logical parts @@ -46,6 +46,6 @@ void ContentExtendedPartition::remove() { - // for now, just return, + // for now, just return, return; } --- conga/ricci/modules/storage/ContentExtendedPartition.h 2006/08/10 22:53:09 1.2 +++ conga/ricci/modules/storage/ContentExtendedPartition.h 2007/09/11 02:45:28 1.3 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -32,13 +32,13 @@ public: ContentExtendedPartition(const String& path); virtual ~ContentExtendedPartition(); - + virtual bool removable() const; virtual void remove(); - - + + private: - + }; --- conga/ricci/modules/storage/ContentFS.cpp 2006/10/06 03:10:13 1.5 +++ conga/ricci/modules/storage/ContentFS.cpp 2007/09/11 02:45:28 1.6 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -37,8 +37,8 @@ -ContentFS::ContentFS(const String& path, - const String& name, +ContentFS::ContentFS(const String& path, + const String& name, const String& module) : Content(CONTENT_FS_TYPE, path), _name(name), @@ -49,21 +49,21 @@ {} -bool +bool ContentFS::removable() const { return false; } -void +void ContentFS::remove() { if (!this->removable()) throw String("FS not removable"); - + FstabLocker lock; MountHandler mh; - + // mountpoint list l = mh.mounts(mh.maj_min(path())); list backup; @@ -80,13 +80,13 @@ throw UMountError(iter->mountpoint); } } - + list f = mh.fstabs(mh.maj_min(path())); for (list::const_iterator iter = f.begin(); iter != f.end(); iter++) mh.fstab_remove(iter->devname, iter->mountpoint); - + create_content_none(BDFactory::get_bd(path())); } @@ -102,14 +102,14 @@ -void +void ContentFS::mount_props_probe(const String& path, const String& fsname, Props& props) { FstabLocker l; MountHandler mh; - + // mountpoint pair maj_min = mh.maj_min(path); list mounts = mh.mounts(maj_min); @@ -124,36 +124,36 @@ if (fstabs.size()) fstabpoint = fstabs.front().mountpoint; ill_mnts.remove(fstabpoint); - - - + + + bool mountable = mount_fs_supported(fsname); props.set(Variable("mountable", mountable)); if (mountable) - props.set(Variable("mountpoint", - mountpoint, - 0, - 128, - ILLEGAL_MOUNT_CHARS, + props.set(Variable("mountpoint", + mountpoint, + 0, + 128, + ILLEGAL_MOUNT_CHARS, ill_mnts)); if (mountable || !fstabpoint.empty()) - props.set(Variable("fstabpoint", - fstabpoint, - 0, - 128, - ILLEGAL_MOUNT_CHARS, + props.set(Variable("fstabpoint", + fstabpoint, + 0, + 128, + ILLEGAL_MOUNT_CHARS, ill_mnts)); } -void +void ContentFS::mount_props_apply(const String& path, const String& fsname, const Props& old_props, const Props& new_props) { FstabLocker l; - + // mountpoint if (old_props.has("mountpoint")) { String mnt_curr = old_props.get("mountpoint").get_string(); @@ -168,7 +168,7 @@ throw String("mount failed"); } } - + // fstab if (old_props.has("fstabpoint")) { String mnt_curr = old_props.get("fstabpoint").get_string(); @@ -189,7 +189,7 @@ } } -bool +bool ContentFS::mount_props_mounted(const Props& props) { if (props.has("mountpoint")) @@ -200,7 +200,7 @@ - + @@ -217,27 +217,27 @@ -void +void ContentFSTemplate::mount_props_template(const String& fsname, Props& props) { bool mountable = ContentFS::mount_fs_supported(fsname); props.set(Variable("mountable", mountable)); - + if (mountable) { list illegal_mps = MountHandler().used_dirs(); - props.set(Variable("mountpoint", - "", - 0, - 128, - ILLEGAL_MOUNT_CHARS, + props.set(Variable("mountpoint", + "", + 0, + 128, + ILLEGAL_MOUNT_CHARS, illegal_mps)); props.set(Variable("fstab", false, true)); props.set(Variable("mount", false, true)); } } -void +void ContentFSTemplate::mount_props_create(const String& path, const String& fsname, const Props& props) @@ -250,15 +250,15 @@ } catch ( ... ) {} bool mount = props.get("mount").get_bool(); bool fstab = props.get("fstab").get_bool(); - + if (mountpoint.size()) { FstabLocker l; if (mount) - MountHandler().mount(path, + MountHandler().mount(path, mountpoint, fsname); if (fstab) - MountHandler().fstab_add(label.empty() ? path : String("LABEL=") + label, + MountHandler().fstab_add(label.empty() ? path : String("LABEL=") + label, mountpoint, fsname); } @@ -275,7 +275,7 @@ list l = MountHandler().fstypes(); if (find(l.begin(), l.end(), fsname) != l.end()) return true; - + String out, err; int status; vector args; --- conga/ricci/modules/storage/ContentFS.h 2006/09/26 03:02:57 1.6 +++ conga/ricci/modules/storage/ContentFS.h 2007/09/11 02:45:28 1.7 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -35,14 +35,14 @@ { public: virtual ~ContentFS(); - + virtual XMLObject xml() const; - + virtual bool removable() const; virtual void remove(); - - - + + + static bool mount_fs_supported(const String& fsname); // true if mountable // these fcns extract/place info from/into props static bool mount_props_mounted(const Props& props); // true if mounted @@ -53,13 +53,13 @@ const String& module, const Props& old_props, const Props& new_props); - - + + protected: ContentFS(const String& path, const String& name, const String& module); String _name; String _module; - + }; @@ -67,19 +67,19 @@ { public: virtual ~ContentFSTemplate(); - + static void mount_props_template(const String& module, Props &props); static void mount_props_create(const String& path, const String& module, const Props &props); - - + + protected: ContentFSTemplate(const String& name); String _name; - - + + }; --- conga/ricci/modules/storage/ContentFactory.cpp 2006/08/10 22:53:09 1.3 +++ conga/ricci/modules/storage/ContentFactory.cpp 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -34,29 +34,29 @@ using namespace std; -counting_auto_ptr +counting_auto_ptr ContentFactory::probe(const String& path) { try { return counting_auto_ptr(new PV(path)); } catch ( ... ) {} - + try { return counting_auto_ptr(new PTSource(path)); } catch ( ... ) {} - + try { return counting_auto_ptr(new MDRaidSource(path)); } catch ( ... ) {} - + try { return FSController().get_fs(path); } catch ( ... ) {} - + return counting_auto_ptr(new ContentNone(path)); } -counting_auto_ptr +counting_auto_ptr ContentFactory::create_content(const counting_auto_ptr& bd, const counting_auto_ptr& content) { @@ -73,9 +73,9 @@ return probe(bd->path()); } } - throw String("creation of content ") + content->_replacement->type + + throw String("creation of content ") + content->_replacement->type + " not implemented"; } - + return bd->content; } --- conga/ricci/modules/storage/ContentFactory.h 2006/08/10 22:53:09 1.3 +++ conga/ricci/modules/storage/ContentFactory.h 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -34,13 +34,13 @@ class ContentFactory { public: - + counting_auto_ptr probe(const String& path); - - counting_auto_ptr + + counting_auto_ptr create_content(const counting_auto_ptr& bd, const counting_auto_ptr& content); - + }; --- conga/ricci/modules/storage/ContentNone.cpp 2006/10/06 03:10:13 1.4 +++ conga/ricci/modules/storage/ContentNone.cpp 2007/09/11 02:45:28 1.5 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -44,47 +44,47 @@ -bool +bool ContentNone::expandable(long long& max_size) const { max_size = LLONG_MAX; return true; } -bool +bool ContentNone::shrinkable(long long& min_size) const { min_size = 0; return true; } -void +void ContentNone::shrink(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props) {} -void +void ContentNone::expand(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props) {} -void +void ContentNone::apply_props_before_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props) {} -void +void ContentNone::apply_props_after_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props) {} -bool +bool ContentNone::removable() const { return true; @@ -101,7 +101,7 @@ ContentNone::xml() const { XMLObject xml = this->Content::xml(); - + /* list remove_us = xml.children(); for (list::iterator iter = remove_us.begin(); @@ -109,7 +109,7 @@ iter++) xml.remove_child(*iter); */ - + return xml; } @@ -117,22 +117,22 @@ -void +void create_content_none(const counting_auto_ptr& bd) { long long size = bd->_props.get("size").get_int(); if (size > 2 * 1024 * 1024) size = 2 * 1024 * 1024; - + vector args; String out, err; int status; - + args.push_back("if=/dev/zero"); args.push_back(String("of=") + bd->path()); args.push_back(String("bs=") + utils::to_string(size)); args.push_back("count=1"); - + if (utils::execute("/bin/dd", args, out, err, status)) throw command_not_found_error_msg("dd"); if (status) --- conga/ricci/modules/storage/ContentNone.h 2006/08/10 22:53:09 1.3 +++ conga/ricci/modules/storage/ContentNone.h 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -40,34 +40,34 @@ public: ContentNone(const String& path); virtual ~ContentNone(); - + virtual XMLObject xml() const; - - + + virtual bool expandable(long long& max_size) const; virtual bool shrinkable(long long& min_size) const; - + virtual void shrink(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props); virtual void expand(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props); virtual void apply_props_before_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props); virtual void apply_props_after_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props); - + virtual bool removable() const; virtual void remove(); - - + + private: - + }; --- conga/ricci/modules/storage/ContentUnusable.cpp 2006/08/10 22:53:09 1.2 +++ conga/ricci/modules/storage/ContentUnusable.cpp 2007/09/11 02:45:28 1.3 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -38,49 +38,49 @@ {} -bool +bool ContentUnusable::expandable(long long& max_size) const { return false; } -bool +bool ContentUnusable::shrinkable(long long& min_size) const { return false; } -void +void ContentUnusable::shrink(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props) { throw String("ContentUnusable is not shrinkable"); } -void +void ContentUnusable::expand(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props) { throw String("ContentUnusable is not expandable"); } -void +void ContentUnusable::apply_props_before_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props) {} -void +void ContentUnusable::apply_props_after_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props) {} -bool +bool ContentUnusable::removable() const { return false; @@ -97,6 +97,6 @@ ContentUnusable::xml() const { XMLObject xml = this->Content::xml(); - + return xml; } --- conga/ricci/modules/storage/ContentUnusable.h 2006/08/10 22:53:09 1.2 +++ conga/ricci/modules/storage/ContentUnusable.h 2007/09/11 02:45:28 1.3 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -32,34 +32,34 @@ public: ContentUnusable(const String& path); virtual ~ContentUnusable(); - + virtual XMLObject xml() const; - - + + virtual bool expandable(long long& max_size) const; virtual bool shrinkable(long long& min_size) const; - + virtual void shrink(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props); virtual void expand(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props); virtual void apply_props_before_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props); virtual void apply_props_after_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props); - + virtual bool removable() const; virtual void remove(); - - + + private: - + }; --- conga/ricci/modules/storage/ExtendedFS.cpp 2006/12/21 21:23:17 1.8 +++ conga/ricci/modules/storage/ExtendedFS.cpp 2007/09/11 02:45:28 1.9 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -38,16 +38,16 @@ ExtendedFS::ExtendedFS(const String& path) : - ContentFS(path, + ContentFS(path, PRETTY_NAME, "ext2"), _journaled(false) { String magic(FileMagic::get_description(path)); - if (magic.find("ext3") == magic.npos && + if (magic.find("ext3") == magic.npos && magic.find("ext2") == magic.npos) throw path + ": not an " + _name; - + // dumpe2fs String out, err; int status; @@ -66,7 +66,7 @@ vector words = utils::split(utils::strip(line)); if (words.size() < 3) continue; - + if (words[0] == "Filesystem" && words[1] == "features:") { if (find(words.begin(), words.end(), "dir_index") != words.end()) _props.set(Variable("dir_index", true, true)); @@ -76,7 +76,7 @@ _journaled = true; continue; } - + if (words.size() == 3) { if (words[0] == "Block" && words[1] == "size:") _props.set(Variable("block_size", utils::to_long(words[2]))); @@ -100,21 +100,21 @@ } } } - + long long block_count = _props.get("block_count").get_int(); - + if (_journaled) _module = "ext3"; else _module = "ext2"; - + // journaling - _props.set(Variable("has_journal", - _journaled, + _props.set(Variable("has_journal", + _journaled, (!_journaled && block_count > 1024))); - - mount_props_probe(path, - _module, + + mount_props_probe(path, + _module, _props); } @@ -122,15 +122,15 @@ {} -bool +bool ExtendedFS::expandable(long long& max_size) const { bool mounted = mount_props_mounted(_props); - + long long bs = _props.get("block_size").get_int(); long long bc = _props.get("block_count").get_int(); long long size = bs * bc; - + long long step = size; if (bs == 1024) step = 256LL * 1024 * 1024; // 256 MB @@ -138,23 +138,23 @@ step = 2LL * 1024 * 1024 * 1024; // 2GB else if (bs == 4096) step = 16LL * 1024 * 1024 * 1024; // 16GB - + max_size = ((size + step - 1) / step) * step; return mounted && _journaled; } -void +void ExtendedFS::expand(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props) { String extend_cmd("/usr/sbin/ext2online"); if (access(extend_cmd.c_str(), X_OK)) extend_cmd = "/sbin/resize2fs"; - + vector args; args.push_back(path); - + String out, err; int status; if (utils::execute(extend_cmd, args, out, err, status)) @@ -163,22 +163,22 @@ throw String(extend_cmd + " failed"); } -bool +bool ExtendedFS::shrinkable(long long& min_size) const { return false; } -void +void ExtendedFS::shrink(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props) {} -void +void ExtendedFS::apply_props_before_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props) { // has_journal @@ -186,7 +186,7 @@ bool j_new = new_props.get("has_journal").get_bool(); if (!j_old && j_new) enable_journal(path); - + // dir_index bool index_old = _props.get("dir_index").get_bool(); bool index_new = new_props.get("dir_index").get_bool(); @@ -207,9 +207,9 @@ if (status) throw bin + " failed"; } - - - + + + // label /* String old_label = _props.get("label").get_string(); @@ -217,9 +217,9 @@ if (old_label != new_label) { FstabLocker lock; MountHandler mh; - + list l = mh.fstabs(mh.maj_min(path)); - + vector args; args.push_back("-L"); args.push_back(new_label); @@ -230,14 +230,14 @@ throw command_not_found_error_msg(); if (status) throw String("tune2fs failed"); - + args.clear(); args.push_back("1"); if (utils::execute("/bin/sleep", args, out, err, status, false)) throw command_not_found_error_msg(); if (status) throw String("sleep failed"); - + for (list::const_iterator iter = l.begin(); iter != l.end(); iter++) @@ -254,10 +254,10 @@ { FstabLocker lock; MountHandler mh; - + list mounts = mh.mounts(mh.maj_min(path)); list fstabs = mh.fstabs(mh.maj_min(path)); - + list rollback; try { // umount @@ -268,7 +268,7 @@ throw UMountError(iter->mountpoint); rollback.push_back(*iter); } - + // add journal vector args; String out, err, bin("/sbin/tune2fs"); @@ -280,7 +280,7 @@ if (status) throw bin + " failed"; _module = "ext3"; - + } catch ( ... ) { for (list::const_iterator iter = rollback.begin(); iter != rollback.end(); @@ -290,7 +290,7 @@ } catch ( ... ) {} throw; } - + // modify fstab for (list::const_iterator iter = fstabs.begin(); iter != fstabs.end(); @@ -298,7 +298,7 @@ mh.fstab_remove(iter->devname, iter->mountpoint); mh.fstab_add(iter->devname, iter->mountpoint, _module); } - + // mount for (list::const_iterator iter = mounts.begin(); iter != mounts.end(); @@ -307,19 +307,19 @@ throw String("mount failed"); } -void +void ExtendedFS::apply_props_after_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props) { mount_props_apply(path, - _module, + _module, _props, new_props); } -bool +bool ExtendedFS::removable() const { return true; @@ -329,7 +329,7 @@ -void +void create_extended_fs(const String& path, const counting_auto_ptr& templ) { @@ -337,7 +337,7 @@ String bs = utils::to_string(templ->_props.get("block_size").get_int()); bool dir_index = templ->_props.get("dir_index").get_bool(); bool has_journal = templ->_props.get("has_journal").get_bool(); - + vector args; if (!label.empty()) { args.push_back("-L"); @@ -354,14 +354,14 @@ if (has_journal) args.push_back("-j"); args.push_back(path); - + String out, err; int status; if (utils::execute(MKE2FS_path, args, out, err, status)) throw command_not_found_error_msg(MKE2FS_path); if (status != 0) throw MKE2FS_path + " failed"; - + // mountpoints ContentFSTemplate::mount_props_create(path, (has_journal) ? "ext3" : "ext2", @@ -373,26 +373,26 @@ { if (access(MKE2FS_path.c_str(), X_OK|R_OK)) throw String("no mke2fs exists"); - + bool ext3_supported = ContentFS::mount_fs_supported("ext3"); - - _props.set(Variable("label", - "", - 0, - 16, - ILLEGAL_LABEL_CHARS, + + _props.set(Variable("label", + "", + 0, + 16, + ILLEGAL_LABEL_CHARS, list())); - + _props.set(Variable("dir_index", true, true)); - - _props.set(Variable("has_journal", - ext3_supported, + + _props.set(Variable("has_journal", + ext3_supported, ext3_supported)); - - mount_props_template(ext3_supported ? "ext3" : "ext2", + + mount_props_template(ext3_supported ? "ext3" : "ext2", _props); - - + + // block_size list b_sizes; b_sizes.push_back(1024); --- conga/ricci/modules/storage/ExtendedFS.h 2006/09/26 03:02:57 1.4 +++ conga/ricci/modules/storage/ExtendedFS.h 2007/09/11 02:45:28 1.5 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -37,35 +37,35 @@ public: ExtendedFS(const String& path); virtual ~ExtendedFS(); - + const static String PRETTY_NAME; - + virtual bool expandable(long long& max_size) const; virtual bool shrinkable(long long& min_size) const; virtual void shrink(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props); virtual void expand(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props); - + virtual void apply_props_before_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props); virtual void apply_props_after_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props); - + virtual bool removable() const; - + private: - + bool _journaled; - + void enable_journal(const String& path); - + }; @@ -77,11 +77,11 @@ public: ExtendedFSTemplate(); virtual ~ExtendedFSTemplate(); - - + + private: - - + + }; --- conga/ricci/modules/storage/FSController.cpp 2007/09/09 14:18:38 1.9 +++ conga/ricci/modules/storage/FSController.cpp 2007/09/11 02:45:28 1.10 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -61,7 +61,7 @@ return members; } -counting_auto_ptr +counting_auto_ptr FSController::get_fs(const String& path) { try { @@ -79,11 +79,11 @@ return counting_auto_ptr(new UnsupportedFS(path)); } -std::list > +std::list > FSController::get_available_fss() { list > cnts; - + try { cnts.push_back(counting_auto_ptr(new ExtendedFSTemplate())); } catch ( ... ) {} @@ -96,17 +96,17 @@ try { cnts.push_back(counting_auto_ptr(new SwapFSTemplate())); } catch ( ... ) {} - + return cnts; } -counting_auto_ptr +counting_auto_ptr FSController::create_fs(const counting_auto_ptr& bd, const counting_auto_ptr& cont_templ) { if (cont_templ->type != CONTENT_FS_TYPE) throw String("content_template not of filesystem type"); - + String fs_type = cont_templ->attrs["fs_type"]; if (fs_type == ExtendedFS::PRETTY_NAME) create_extended_fs(bd->path(), cont_templ); @@ -118,7 +118,7 @@ create_swap_fs(bd->path(), cont_templ); else throw String("unknown fs type \"") + fs_type + "\""; - + utils::clear_cache(); return get_fs(bd->path()); } --- conga/ricci/modules/storage/FSController.h 2007/06/27 08:14:23 1.3 +++ conga/ricci/modules/storage/FSController.h 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -34,20 +34,20 @@ { public: std::list get_fs_group_ids(const String& name); - + counting_auto_ptr get_fs(const String& path); - + std::list > get_available_fss(); - + counting_auto_ptr create_fs(const counting_auto_ptr& bd, const counting_auto_ptr& cont_templ); - + private: - - - - - + + + + + }; --- conga/ricci/modules/storage/FileMagic.cpp 2006/09/23 09:26:58 1.3 +++ conga/ricci/modules/storage/FileMagic.cpp 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -32,32 +32,32 @@ { const char* buff = 0; magic_t cookie = 0; - + try { cookie = magic_open(MAGIC_SYMLINK|MAGIC_DEVICES|MAGIC_ERROR); if (!cookie) throw String("initialization of libmagic failure"); - + if (magic_filename.empty()) { if (magic_load(cookie, NULL)) throw String("initialization of libmagic failure: invalid default magic file"); } else if (magic_load(cookie, magic_filename.c_str())) throw String("initialization of libmagic failure: invalid magic file: ") + magic_filename; - + String descr; buff = magic_file(cookie, filename.c_str()); if (buff) descr = buff; - + if (descr.empty()) throw String("nothing detected"); if (descr == "data") throw String("unknown data detected"); - + magic_close(cookie); cookie = 0; // free((char*) buff); buff = 0; - + return descr; } catch ( ... ) { if (cookie) --- conga/ricci/modules/storage/FileMagic.h 2006/09/14 17:52:04 1.1 +++ conga/ricci/modules/storage/FileMagic.h 2007/09/11 02:45:28 1.2 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* --- conga/ricci/modules/storage/GFS1.cpp 2007/03/20 15:35:59 1.4 +++ conga/ricci/modules/storage/GFS1.cpp 2007/09/11 02:45:28 1.5 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -45,7 +45,7 @@ const static String MKFS_GFS1_path("/sbin/mkfs.gfs"); const static long long DEF_JSIZE = 128 * 1024 * 1024; -static void +static void detect_gfs1(const String& filename, long long &block_size, String& locking_protocol, @@ -60,14 +60,14 @@ long long bs; String proto, table; detect_gfs1(path, bs, proto, table); - + _props.set(Variable("block_size", bs)); - + // cluster String cluster = table.substr(0, table.find(":")); String name = table.substr(table.find(":") + 1); _props.set(Variable("clustered", proto != "lock_nolock")); - Variable proto_var("locking_protocol", + Variable proto_var("locking_protocol", proto.substr(proto.find("_") + 1)); proto_var.set_conditional_bool_if("clustered"); _props.set(proto_var); @@ -77,10 +77,10 @@ Variable name_var("gfs_fsname", name); name_var.set_conditional_bool_if("clustered"); _props.set(name_var); - + // mountpoints - mount_props_probe(path, - _module, + mount_props_probe(path, + _module, _props); } @@ -88,48 +88,48 @@ {} -bool +bool GFS1::expandable(long long& max_size) const { return false; } -void +void GFS1::expand(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props) {} -bool +bool GFS1::shrinkable(long long& min_size) const { return false; } -void +void GFS1::shrink(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props) {} -void +void GFS1::apply_props_before_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props) {} -void +void GFS1::apply_props_after_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props) { // mountpoints mount_props_apply(path, _module, _props, new_props); } -bool +bool GFS1::removable() const { return true; @@ -139,7 +139,7 @@ -void +void create_GFS1(const String& path, const counting_auto_ptr& templ) { @@ -147,7 +147,7 @@ String jnum = utils::to_string(templ->_props.get("journals_num").get_int()); long long jsize_bytes = templ->_props.get("journal_size").get_int(); String jsize = utils::to_string(jsize_bytes / 1024 / 1024); - + bool clustered = templ->_props.get("clustered").get_bool(); String proto("nolock"); String table; @@ -158,37 +158,37 @@ templ->_props.get("gfs_fsname").get_string(); } proto = String("lock_") + proto; - - + + vector args; args.push_back("-b"); args.push_back(bs); - + args.push_back("-J"); args.push_back(jsize); - + args.push_back("-j"); args.push_back(jnum); - + args.push_back("-O"); // no prompt - + args.push_back("-p"); args.push_back(proto); - + if (!table.empty()) { args.push_back("-t"); args.push_back(table); } - + args.push_back(path); - + String out, err; int status; if (utils::execute(MKFS_GFS1_path, args, out, err, status)) throw command_not_found_error_msg(MKFS_GFS1_path); if (status) throw MKFS_GFS1_path + " " + path + " failed"; - + // mountpoints ContentFSTemplate::mount_props_create(path, gfs1_module, templ->_props); } @@ -198,12 +198,12 @@ { if (access(MKFS_GFS1_path.c_str(), X_OK|R_OK)) throw String("no mkfs.gfs exists"); - + // ## general options ## - + // mountpoints mount_props_template(gfs1_module, _props); - + // block_size list b_sizes; b_sizes.push_back(512); @@ -211,20 +211,20 @@ b_sizes.push_back(2048); b_sizes.push_back(4096); _props.set(Variable("block_size", 4096, b_sizes)); - + // journals _props.set(Variable("journals_num", 1, 1, 128, 1)); list jsizes; - long long jsize = 32 * 1024 * 1024; + long long jsize = 32 * 1024 * 1024; for (int i = 1; i<11; i++) { jsizes.push_back(jsize); jsize *= 2; } _props.set(Variable("journal_size", DEF_JSIZE, jsizes)); - - + + // ## cluster options ## - + bool cluster_exists = false; XMLObject cluster_conf; try { @@ -238,7 +238,7 @@ String cluster = cluster_conf.get_attr("name"); String name = "unique_gfs_name"; String proto = "dlm"; - + long long jnum = 1; if (cluster_exists) { for (list::const_iterator iter = cluster_conf.children().begin(); @@ -251,20 +251,20 @@ } _props.set(Variable("journals_num", jnum, 1, 128, 1)); } - + _props.set(Variable("clustered", cluster_exists, cluster_exists)); - + Variable proto_var("locking_protocol", proto); proto_var.set_conditional_bool_if("clustered"); _props.set(proto_var); Variable cluster_var("cluster_name", cluster); cluster_var.set_conditional_bool_if("clustered"); _props.set(cluster_var); - Variable name_var("gfs_fsname", + Variable name_var("gfs_fsname", name, 1, 16, - NAMES_ILLEGAL_CHARS, + NAMES_ILLEGAL_CHARS, list()); name_var.set_conditional_bool_if("clustered"); _props.set(name_var); @@ -286,39 +286,39 @@ String& locking_table) { // IMPORTANT: gfs saves metadata as BigEndian - + int fd = open(filename.c_str(), O_RDONLY); if (fd < 0) throw String("GFS1_detect: cannot open ") + filename; - + try { struct gfs_sb sb; - + int ret; do { const static int sb_offset = GFS_SB_ADDR * GFS_BASIC_BLOCK; if (lseek(fd, sb_offset, SEEK_SET) != sb_offset) throw String("lseek failed for ") + filename; ret = read(fd, &sb, sizeof(sb)); - } while (ret == -1 && + } while (ret == -1 && errno == EINTR); if (ret != (int) sizeof(sb)) throw String("read of gfs superblock failed for ") + filename; - + if (ntohl(sb.sb_header.mh_magic) != GFS_MAGIC || ntohl(sb.sb_header.mh_type) != GFS_METATYPE_SB || ntohl(sb.sb_fs_format) != GFS_FORMAT_FS || ntohl(sb.sb_multihost_format) != GFS_FORMAT_MULTI) throw filename + " does not contain gfs"; - + block_size = ntohl(sb.sb_bsize); - + sb.sb_lockproto[sizeof(sb.sb_lockproto) - 1] = '\0'; locking_protocol = String(sb.sb_lockproto); - + sb.sb_locktable[sizeof(sb.sb_locktable) - 1] = '\0'; locking_table = String(sb.sb_locktable); - + while (close(fd)) if (errno != EINTR) break; --- conga/ricci/modules/storage/GFS1.h 2006/09/26 03:17:41 1.1 +++ conga/ricci/modules/storage/GFS1.h 2007/09/11 02:45:28 1.2 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -37,31 +37,31 @@ public: GFS1(const String& path); virtual ~GFS1(); - + const static String PRETTY_NAME; - + virtual bool expandable(long long& max_size) const; virtual bool shrinkable(long long& min_size) const; virtual void shrink(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props); virtual void expand(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props); - + virtual void apply_props_before_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props); virtual void apply_props_after_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props); - + virtual bool removable() const; - + private: - + }; @@ -70,10 +70,10 @@ public: GFS1Template(); virtual ~GFS1Template(); - + private: - - + + }; --- conga/ricci/modules/storage/GFS2.cpp 2007/03/20 15:35:59 1.5 +++ conga/ricci/modules/storage/GFS2.cpp 2007/09/11 02:45:28 1.6 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -51,7 +51,7 @@ const static String MKFS_GFS2_path("/sbin/mkfs.gfs2"); const static long long DEF_JSIZE = 32 * 1024 * 1024; -static void +static void detect_gfs2(const String& filename, long long &block_size, String& locking_protocol, @@ -66,14 +66,14 @@ long long bs; String proto, table; detect_gfs2(path, bs, proto, table); - + _props.set(Variable("block_size", bs)); - + // cluster String cluster = table.substr(0, table.find(":")); String name = table.substr(table.find(":") + 1); _props.set(Variable("clustered", proto != "lock_nolock")); - Variable proto_var("locking_protocol", + Variable proto_var("locking_protocol", proto.substr(proto.find("_") + 1)); proto_var.set_conditional_bool_if("clustered"); _props.set(proto_var); @@ -83,7 +83,7 @@ Variable name_var("gfs_fsname", name); name_var.set_conditional_bool_if("clustered"); _props.set(name_var); - + // mountpoints mount_props_probe(path, _module, _props); } @@ -92,48 +92,48 @@ {} -bool +bool GFS2::expandable(long long& max_size) const { return false; } -void +void GFS2::expand(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props) {} -bool +bool GFS2::shrinkable(long long& min_size) const { return false; } -void +void GFS2::shrink(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props) {} -void +void GFS2::apply_props_before_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props) {} -void +void GFS2::apply_props_after_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props) { // mountpoints mount_props_apply(path, _module, _props, new_props); } -bool +bool GFS2::removable() const { return true; @@ -143,14 +143,14 @@ -void +void create_GFS2(const String& path, const counting_auto_ptr& templ) { String jnum = utils::to_string(templ->_props.get("journals_num").get_int()); long long jsize_bytes = templ->_props.get("journal_size").get_int(); String jsize = utils::to_string(jsize_bytes / 1024 / 1024); - + bool clustered = templ->_props.get("clustered").get_bool(); String proto("nolock"); String table; @@ -161,34 +161,34 @@ templ->_props.get("gfs_fsname").get_string(); } proto = String("lock_") + proto; - - + + vector args; args.push_back("-J"); args.push_back(jsize); - + args.push_back("-j"); args.push_back(jnum); - + args.push_back("-O"); // no prompt - + args.push_back("-p"); args.push_back(proto); - + if (!table.empty()) { args.push_back("-t"); args.push_back(table); } - + args.push_back(path); - + String out, err; int status; if (utils::execute(MKFS_GFS2_path, args, out, err, status)) throw command_not_found_error_msg(MKFS_GFS2_path); if (status) throw MKFS_GFS2_path + " " + path + " failed"; - + // mountpoints ContentFSTemplate::mount_props_create(path, gfs2_module, templ->_props); } @@ -198,25 +198,25 @@ { if (access(MKFS_GFS2_path.c_str(), X_OK|R_OK)) throw String("no mkfs.gfs2 exists"); - + // ## general options ## - + // mountpoints mount_props_template(gfs2_module, _props); - + // journals _props.set(Variable("journals_num", 1, 1, 128, 1)); list jsizes; - long long jsize = 8*1024*1024; + long long jsize = 8*1024*1024; for (int i = 1; i<11; i++) { jsizes.push_back(jsize); jsize *= 2; } _props.set(Variable("journal_size", DEF_JSIZE, jsizes)); - - + + // ## cluster options ## - + bool cluster_exists = false; XMLObject cluster_conf; try { @@ -229,7 +229,7 @@ } catch ( ... ) {} String cluster = cluster_conf.get_attr("name"); String name = "unique_gfs_name"; - + long long jnum = 1; if (cluster_exists) { for (list::const_iterator iter = cluster_conf.children().begin(); @@ -239,20 +239,20 @@ jnum = iter->children().size(); _props.set(Variable("journals_num", jnum, 1, 128, 1)); } - + _props.set(Variable("clustered", cluster_exists, cluster_exists)); - + Variable proto_var("locking_protocol", String("dlm")); proto_var.set_conditional_bool_if("clustered"); _props.set(proto_var); Variable cluster_var("cluster_name", cluster); cluster_var.set_conditional_bool_if("clustered"); _props.set(cluster_var); - Variable name_var("gfs_fsname", + Variable name_var("gfs_fsname", name, 1, 16, - NAMES_ILLEGAL_CHARS, + NAMES_ILLEGAL_CHARS, list()); name_var.set_conditional_bool_if("clustered"); _props.set(name_var); @@ -274,39 +274,39 @@ String& locking_table) { // IMPORTANT: gfs2 saves metadata as BigEndian - + int fd = open(filename.c_str(), O_RDONLY); if (fd < 0) throw String("GFS2_detect: cannot open ") + filename; - + try { struct gfs2_sb sb; - + int ret; do { const static int sb_offset = GFS2_SB_ADDR * GFS2_BASIC_BLOCK; if (lseek(fd, sb_offset, SEEK_SET) != sb_offset) throw String("lseek failed for ") + filename; ret = read(fd, &sb, sizeof(sb)); - } while (ret == -1 && + } while (ret == -1 && errno == EINTR); if (ret != (int) sizeof(sb)) throw String("read of gfs2 superblock failed for ") + filename; - + if (ntohl(sb.sb_header.mh_magic) != GFS2_MAGIC || ntohl(sb.sb_header.mh_type) != GFS2_METATYPE_SB || ntohl(sb.sb_fs_format) != GFS2_FORMAT_FS || ntohl(sb.sb_multihost_format) != GFS2_FORMAT_MULTI) throw filename + " does not contain gfs2"; - + block_size = ntohl(sb.sb_bsize); - + sb.sb_lockproto[sizeof(sb.sb_lockproto) - 1] = '\0'; locking_protocol = String(sb.sb_lockproto); - + sb.sb_locktable[sizeof(sb.sb_locktable) - 1] = '\0'; locking_table = String(sb.sb_locktable); - + while (close(fd)) if (errno != EINTR) break; --- conga/ricci/modules/storage/GFS2.h 2006/09/26 03:17:41 1.1 +++ conga/ricci/modules/storage/GFS2.h 2007/09/11 02:45:28 1.2 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -37,31 +37,31 @@ public: GFS2(const String& path); virtual ~GFS2(); - + const static String PRETTY_NAME; - + virtual bool expandable(long long& max_size) const; virtual bool shrinkable(long long& min_size) const; virtual void shrink(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props); virtual void expand(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props); - + virtual void apply_props_before_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props); virtual void apply_props_after_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props); - + virtual bool removable() const; - + private: - + }; @@ -70,10 +70,10 @@ public: GFS2Template(); virtual ~GFS2Template(); - + private: - - + + }; --- conga/ricci/modules/storage/HD.cpp 2006/10/06 03:10:13 1.5 +++ conga/ricci/modules/storage/HD.cpp 2007/09/11 02:45:28 1.6 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -40,7 +40,7 @@ vector args; String out, err; int status; - + /* // size args.push_back("--getss"); @@ -58,12 +58,12 @@ size *= utils::to_long(utils::strip(lines[1])); _props.set(Variable("size", size)); */ - - + + // vendor & model String vendor("unknown"); String model(vendor); - + args.clear(); out.clear(); args.push_back(String("/proc/ide") + path.substr(String("/dev").size()) + "/model"); if (utils::execute("/bin/cat", args, out, err, status)) @@ -75,11 +75,11 @@ if (words.size() > 1) { vendor = words[0]; model = ""; - for (vector::size_type i=1; i::size_type i=1; i +counting_auto_ptr create_LV(const BDTemplate& bd_temp) { // everything is already validated :) - + String vgname = bd_temp.props.get("vgname").get_string(); - - + + // if VG is marked as clustered, but cluster locking is not available, throw if (!LVM::clustered_enabled() && bd_temp.props.get("clustered").get_bool()) throw LVMClusterLockingError(); - - + + String lvname = bd_temp.props.get("lvname").get_string(); long long size = bd_temp.props.get("size").get_int(); - + bool snapshot = bd_temp.props.get("snapshot").get_bool(); if (snapshot) { String origin = bd_temp.props.get("snapshot_origin").get_string(); @@ -60,15 +60,15 @@ LVM::lvcreate_snap(lvname, origin_path, size); } else LVM::lvcreate(vgname, lvname, size); - + utils::clear_cache(); - + counting_auto_ptr bd = BDFactory::get_bd(String("/dev/") + vgname + "/" + lvname); if (!snapshot) ContentFactory().create_content(bd, bd_temp.content_parsed); - + utils::clear_cache(); - + return BDFactory::get_bd(String("/dev/") + vgname + "/" + lvname); } @@ -78,14 +78,14 @@ // ##### LV ##### -LV::LV(const String& path) : +LV::LV(const String& path) : BD(MAPPER_VG_TYPE, VG_PREFIX + LVM::vgname_from_lvpath(path), BD_LV_TYPE, path) { LVM::probe_lv(_path, _props); - + if (content->removable()) { removable(true); if (content->type == CONTENT_NONE_TYPE) { @@ -98,24 +98,24 @@ } else content->add_replacement(counting_auto_ptr(new ContentNoneTemplate())); } - + // LVs under snapshots can be neither removed nor resized if (_props.get("snapshots").get_list_str().size()) { removable(false); - + long long extent_size = _props.get("extent_size").get_int(); long long size = _props.get("size").get_int(); - _props.set(Variable("size", + _props.set(Variable("size", size, size, size, extent_size)); } - + // snapshots should neither replace nor resize content if (_props.get("snapshot").get_bool()) { content->_avail_replacements.clear(); - + // adjust size based on snap_percent long long usage = _props.get("snapshot_usage_percent").get_int(); const Variable size_var(_props.get("size")); @@ -163,86 +163,86 @@ -String +String LV::state_ind() const { Props tmp_props(_props); - + // remove "snapshot_usage_percent" as its change shouldn't affect state_ind tmp_props.set(Variable("snapshot_usage_percent", (long long) 0)); - + XMLObject t; t.add_child(tmp_props.xml()); t.add_child(content->xml()); - + return utils::hash_str(generateXML(t) + path() + _mapper_id); } -counting_auto_ptr +counting_auto_ptr LV::apply(const BDParsed& bd_parsed) { // if VG is marked as clustered, but cluster locking is not available, throw if (_props.get("clustered").get_bool() && !LVM::clustered_enabled()) throw LVMClusterLockingError(); - + // snapshots neither resize nor replace content, see LV() - + if (_props.get("snapshot").get_bool()) { long long orig_size = this->size(); long long new_size = bd_parsed.props.get("size").get_int(); - + // first this->apply_props_before_resize(bd_parsed.props); - content->apply_props_before_resize(path(), + content->apply_props_before_resize(path(), orig_size, orig_size, bd_parsed.content->props); - + // second - size if (orig_size > new_size) { this->shrink(new_size, bd_parsed.props); } else if (orig_size < new_size) { this->expand(new_size, bd_parsed.props); } - + // third this->apply_props_after_resize(bd_parsed.props); - content->apply_props_after_resize(path(), + content->apply_props_after_resize(path(), + orig_size, orig_size, - orig_size, bd_parsed.content->props); - + utils::clear_cache(); return BDFactory().get_bd(path()); } else return this->BD::apply(bd_parsed); } -void -LV::shrink(unsigned long long new_size, +void +LV::shrink(unsigned long long new_size, const Props& new_props) { LVM::lvreduce(_path, new_size); } -void -LV::expand(unsigned long long new_size, +void +LV::expand(unsigned long long new_size, const Props& new_props) { LVM::lvextend(_path, new_size); } -String +String LV::apply_props_before_resize(const Props& new_props) { return path(); } -String +String LV::apply_props_after_resize(const Props& new_props) { return path(); } -void +void LV::remove() { // if VG is marked as clustered, but cluster locking is not available, throw @@ -261,10 +261,10 @@ // ##### LVTemplate ##### -LVTemplate::LVTemplate(const String& mapper_id, +LVTemplate::LVTemplate(const String& mapper_id, const String& mapper_state_ind) : BDTemplate(MAPPER_VG_TYPE, - mapper_id, + mapper_id, mapper_state_ind, BD_LV_TYPE) { --- conga/ricci/modules/storage/LV.h 2006/08/10 22:53:09 1.4 +++ conga/ricci/modules/storage/LV.h 2007/09/11 02:45:28 1.5 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -35,38 +35,38 @@ public: LV(const String& path); virtual ~LV(); - + virtual String state_ind() const; - + virtual void remove(); - + virtual counting_auto_ptr apply(const BDParsed& bd); // return new bd - + protected: - - virtual void shrink(unsigned long long new_size, + + virtual void shrink(unsigned long long new_size, const Props& new_props); - virtual void expand(unsigned long long new_size, + virtual void expand(unsigned long long new_size, const Props& new_props); - + virtual String apply_props_before_resize(const Props& new_props); // return path virtual String apply_props_after_resize(const Props& new_props); // return path - + private: - + }; // class LV class LVTemplate : public BDTemplate { public: - LVTemplate(const String& mapper_id, + LVTemplate(const String& mapper_id, const String& mapper_state_ind); virtual ~LVTemplate(); - - + + private: - + }; // class LVTemplate --- conga/ricci/modules/storage/LVM.cpp 2007/03/05 20:45:17 1.12 +++ conga/ricci/modules/storage/LVM.cpp 2007/09/11 02:45:28 1.13 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -59,7 +59,7 @@ uuid(uuid), attrs(attrs), format(format) {} - + String path; String vgname; long long extent_size; @@ -151,15 +151,15 @@ -String +String LVM::vgname_from_lvpath(const String& lvpath) { check_locking(); - + vector args; args.push_back("lvdisplay"); args.push_back("-c"); - + String out, err; int status; if (utils::execute(LVM_BIN_PATH, args, out, err, status)) @@ -169,7 +169,7 @@ throw LVMClusterLockingError(); throw String("lvdisplay failed"); } - + vector lines = utils::split(out, "\n"); for (vector::iterator iter = lines.begin(); iter != lines.end(); @@ -182,11 +182,11 @@ throw String("no such LV"); } -String +String LVM::vgname_from_pvpath(const String& path) { check_locking(); - + map pvs(probe_pvs()); map::const_iterator iter = pvs.find(path); if (iter == pvs.end()) @@ -195,11 +195,11 @@ } -void +void LVM::probe_lv(const String& lvpath, Props& props) { check_locking(); - + vector args; args.push_back("lvs"); args.push_back("--nosuffix"); @@ -213,7 +213,7 @@ // if LVS_HAS_ALL_OPTION: // arglist.append("--all") args.push_back(lvpath); - + String out, err; int status; if (utils::execute(LVM_BIN_PATH, args, out, err, status)) @@ -223,41 +223,41 @@ throw LVMClusterLockingError(); throw String("lvs failed"); } - + String line = utils::strip(out); vector words = utils::split(line, ";"); if (words.size() < LVS_OPTIONS_LENGTH) throw String("lvs failed, missing words"); - + String vgname(utils::strip(words[LVS_VG_NAME_IDX])); props.set(Variable("vgname", vgname)); - + String lvname(utils::strip(words[LVS_NAME_IDX])); // remove [] if there (used to mark hidden lvs) lvname = utils::lstrip(lvname, "["); lvname = utils::rstrip(lvname, "]"); props.set(Variable("lvname", lvname)); - + long long extent_size = utils::to_long(words[LVS_EXTENT_SIZE_IDX]); props.set(Variable("extent_size", extent_size)); - + // size long long lv_size = utils::to_long(words[LVS_SIZE_IDX]); long long vg_extents_free = utils::to_long(words[LVS_VG_FREE_COUNT]); long long free = vg_extents_free * extent_size; props.set(Variable("size", lv_size, extent_size, lv_size + free, extent_size)); - + props.set(Variable("uuid", words[LVS_UUID_IDX])); - + String attrs = words[LVS_ATTR_IDX]; props.set(Variable("attrs", attrs)); - + props.set(Variable("mirrored", attrs[0] == 'm')); - + // clustered String vg_attrs = words[LVS_VG_ATTR_IDX]; props.set(Variable("clustered", vg_attrs[5] == 'c')); - + // snapshots String origin = words[LVS_SNAP_ORIGIN_IDX]; props.set(Variable("snapshot", origin != "")); @@ -299,17 +299,17 @@ -void +void LVM::probe_pv(const String& path, Props& props) { check_locking(); - + map pvs(probe_pvs()); map::const_iterator iter = pvs.find(path); if (iter == pvs.end()) throw String("no such pv: ") + path; const PV_data& data = iter->second; - + props.set(Variable("vgname", data.vgname)); props.set(Variable("extent_size", data.extent_size)); props.set(Variable("size", data.size)); @@ -322,14 +322,14 @@ -void +void LVM::probe_vg(const String& vgname, Props& props, list >& sources, list >& targets) { check_locking(); - + // pv to vg mappings map pv_to_vg; map pvs_data(probe_pvs()); @@ -337,17 +337,17 @@ iter != pvs_data.end(); iter++) pv_to_vg[iter->first] = iter->second.vgname; - + // probe vg if (!vgname.empty()) { - + vector words = vg_props(vgname); - + props.set(Variable("vgname", words[VGS_NAME_IDX])); - + String vg_attrs(words[VGS_ATTR_IDX]); props.set(Variable("attrs", vg_attrs)); - + long long size = utils::to_long(words[VGS_SIZE_IDX]); long long extent_size = utils::to_long(words[VGS_EXTENT_SIZE_IDX]); long long extents_free = utils::to_long(words[VGS_EXTENT_FREE_IDX]); @@ -355,24 +355,24 @@ props.set(Variable("extents_total", size/extent_size)); props.set(Variable("extents_free", extents_free)); props.set(Variable("extents_used", size/extent_size - extents_free)); - + long long max_lvs = utils::to_long(words[VGS_MAX_LVS_IDX]); if (max_lvs == 0) max_lvs = 256; props.set(Variable("max_lvs", max_lvs)); - + long long max_pvs = utils::to_long(words[VGS_MAX_PVS_IDX]); if (max_pvs == 0) max_pvs = 256; props.set(Variable("max_pvs", max_pvs)); - + props.set(Variable("uuid", words[VGS_UUID_IDX])); - + // clustered bool clustered = (vg_attrs[5] == 'c'); props.set(Variable("clustered", clustered, true)); } - + // PVS for (map::iterator iter = pv_to_vg.begin(); iter != pv_to_vg.end(); @@ -382,8 +382,8 @@ } if (sources.empty() && !vgname.empty()) throw String("invalid mapper_id"); - - + + // LVS String out, err; int status; @@ -410,7 +410,7 @@ } -void +void LVM::pvcreate(const String& path) { vector args; @@ -418,7 +418,7 @@ args.push_back("-y"); args.push_back("-f"); args.push_back(path); - + String out, err; int status; if (utils::execute(LVM_BIN_PATH, args, out, err, status, false)) @@ -428,7 +428,7 @@ utils::clear_cache(); } -void +void LVM::pvremove(const String& path) { vector args; @@ -436,7 +436,7 @@ args.push_back("-y"); args.push_back("-f"); args.push_back(path); - + String out, err; int status; if (utils::execute(LVM_BIN_PATH, args, out, err, status, false)) @@ -447,16 +447,16 @@ } -void -LVM::vgcreate(const String& vgname, - long long extent_size, - bool clustered, +void +LVM::vgcreate(const String& vgname, + long long extent_size, + bool clustered, const list& pv_paths) { if (clustered && !clustered_enabled()) throw LVMClusterLockingError(); - + vector args; args.push_back("vgcreate"); args.push_back("--physicalextentsize"); @@ -468,7 +468,7 @@ iter != pv_paths.end(); iter++) args.push_back(*iter); - + String out, err; int status; if (utils::execute(LVM_BIN_PATH, args, out, err, status, false)) @@ -478,13 +478,13 @@ utils::clear_cache(); } -void +void LVM::vgremove(const String& vgname) { vector args; args.push_back("vgremove"); args.push_back(vgname); - + String out, err; int status; if (utils::execute(LVM_BIN_PATH, args, out, err, status, false)) @@ -494,7 +494,7 @@ utils::clear_cache(); } -void +void LVM::vgextend(const String& vgname, const std::list& pv_paths) { @@ -505,7 +505,7 @@ iter != pv_paths.end(); iter++) args.push_back(*iter); - + String out, err; int status; if (utils::execute(LVM_BIN_PATH, args, out, err, status, false)) @@ -515,7 +515,7 @@ utils::clear_cache(); } -void +void LVM::vgreduce(const String& vgname, const String& pv_path) { @@ -532,14 +532,14 @@ utils::clear_cache(); } -void +void LVM::vgchange(const String& vgname, bool clustered) { if (clustered && !clustered_enabled()) throw LVMClusterLockingError(); - + vector args; args.push_back("vgchange"); args.push_back("-c"); @@ -555,7 +555,7 @@ } -void +void LVM::lvcreate(const String& vgname, const String& lvname, long long size) @@ -567,7 +567,7 @@ args.push_back("--size"); args.push_back(utils::to_string(size / 1024) + "k"); args.push_back(vgname); - + String out, err; int status; if (utils::execute(LVM_BIN_PATH, args, out, err, status, false)) @@ -576,7 +576,7 @@ throw String("lvcreate failed"); utils::clear_cache(); } -void +void LVM::lvcreate_snap(const String& lvname, const String& origin_path, long long size) @@ -589,7 +589,7 @@ args.push_back("--size"); args.push_back(utils::to_string(size / 1024) + "k"); args.push_back(origin_path); - + String out, err; int status; if (utils::execute(LVM_BIN_PATH, args, out, err, status, false)) @@ -599,27 +599,27 @@ utils::clear_cache(); } -void +void LVM::lvremove(const String& path) { vector args; args.push_back("lvchange"); args.push_back("-an"); args.push_back(path); - + String out, err; int status; if (utils::execute(LVM_BIN_PATH, args, out, err, status, false)) throw command_not_found_error_msg(LVM_BIN_PATH); if (status != 0) throw String("Unable to deactivate LV (might be in use by other cluster nodes)"); - + try { args.clear(); args.push_back("lvremove"); args.push_back("--force"); args.push_back(path); - + if (utils::execute(LVM_BIN_PATH, args, out, err, status, false)) throw command_not_found_error_msg(LVM_BIN_PATH); if (status != 0) @@ -636,18 +636,18 @@ } } -void +void LVM::lvreduce(const String& path, long long new_size) { long long size_k = new_size / 1024; - + vector args; args.push_back("lvreduce"); args.push_back("-f"); args.push_back("-L"); args.push_back(utils::to_string(size_k) + "k"); args.push_back(path); - + String out, err; int status; if (utils::execute(LVM_BIN_PATH, args, out, err, status, false)) @@ -657,17 +657,17 @@ utils::clear_cache(); } -void +void LVM::lvextend(const String& path, long long new_size) { long long size_k = new_size / 1024; - + vector args; args.push_back("lvextend"); args.push_back("-L"); args.push_back(utils::to_string(size_k) + "k"); args.push_back(path); - + String out, err; int status; if (utils::execute(LVM_BIN_PATH, args, out, err, status, false)) @@ -678,14 +678,14 @@ } -bool +bool LVM::clustered_enabled() { String locking_type = get_locking_type(); return (locking_type == "2" || locking_type == "3"); } -void +void LVM::enable_clustered() { String out, err; @@ -698,7 +698,7 @@ throw String("Failed to enable LVM's clustered locking"); } -void +void LVM::disable_clustered() { String out, err; @@ -716,11 +716,11 @@ cluster_quorate() { // called only if cluster locking is enabled - + bool use_magma = true; - if (access("/sbin/magma_tool", X_OK)) + if (access("/sbin/magma_tool", X_OK)) use_magma = false; - + if (use_magma) { // use magma_tool String out, err; @@ -735,9 +735,9 @@ } else { // use cman_tool String cman_tool_path = "/sbin/cman_tool"; - if (access(cman_tool_path.c_str(), X_OK)) + if (access(cman_tool_path.c_str(), X_OK)) cman_tool_path = "/usr/sbin/cman_tool"; - + String out, err; int status; vector args; @@ -746,7 +746,7 @@ throw command_not_found_error_msg("cman_tool"); if (status) throw ClusterNotRunningError(); - + long long quorum = -1; long long votes = -1; vector lines = utils::split(utils::strip(out), "\n"); @@ -762,11 +762,11 @@ votes = utils::to_long(words[1]); if (words.size() < 3) continue; - if (words[0] == "Total" && + if (words[0] == "Total" && words[1] == "votes:") votes = utils::to_long(words[2]); } - + if (quorum <= 0 || votes < 0) throw String("Unable to determine cluster quorum status"); @@ -774,13 +774,13 @@ } } -void +void LVM::check_locking() { if (clustered_enabled()) { if (!cluster_quorate()) throw ClusterNotQuorateError(); - + // try to start clvmd, if not running String out, err; int status; @@ -842,7 +842,7 @@ throw LVMClusterLockingError(); throw String("vgs failed"); } - + vector lines = utils::split(out, "\n"); for (vector::iterator iter = lines.begin(); iter != lines.end(); @@ -872,7 +872,7 @@ probe_pvs() { map pvs; - + String out, err; int status; vector args; @@ -887,17 +887,17 @@ args.push_back(PVS_OPTIONS); if (utils::execute(LVM_BIN_PATH, args, out, err, status)) throw command_not_found_error_msg(LVM_BIN_PATH); - + bool use_pvdisplay = false; if (status) { if (err.find("Skipping clustered") != err.npos) throw LVMClusterLockingError(); // wouldn't `pvdisplay -c` fail if `pvs` has already failed? - // `pvs` fails if it cannot read one hard drive (common in SANs), + // `pvs` fails if it cannot read one hard drive (common in SANs), // while pvdisplay reports without failure use_pvdisplay = true; } - + if (use_pvdisplay) { args.clear(); args.push_back("pvdisplay"); @@ -909,7 +909,7 @@ throw LVMClusterLockingError(); throw String("pvs and pvdisplay failed"); } - + vector lines = utils::split(utils::strip(out), "\n"); for (vector::iterator iter = lines.begin(); iter != lines.end(); @@ -927,7 +927,7 @@ if (vgname.empty()) size_free = size; String uuid(words[PVDISPLAY_c_UUID_IDX]); - + // pvdisplay doesn't report attr and format // guess // FIXME: probe somewhere else @@ -937,7 +937,7 @@ else attrs = "a-"; String format = "lvm2"; - + pvs[path] = PV_data(path, vgname, extent_size, @@ -948,7 +948,7 @@ format); } } - + } else { vector lines = utils::split(utils::strip(out), "\n"); for (vector::iterator iter = lines.begin(); @@ -964,7 +964,7 @@ String uuid(words[PVS_UUID_IDX]); String attrs(words[PVS_ATTR_IDX]); String format(words[PVS_FMT_IDX]); - + pvs[path] = PV_data(path, vgname, extent_size, @@ -976,7 +976,7 @@ } } } - + return pvs; } --- conga/ricci/modules/storage/LVM.h 2006/12/12 13:11:51 1.5 +++ conga/ricci/modules/storage/LVM.h 2007/09/11 02:45:28 1.6 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -35,24 +35,24 @@ class LVM { public: - + static String vgname_from_lvpath(const String& lvpath); static String vgname_from_pvpath(const String& pvpath); static void probe_lv(const String& lvpath, Props& props); static void probe_pv(const String& pvpath, Props& props); - + static void probe_vg(const String& vgname, Props& props, std::list >& sources, std::list >& targets); - - + + static void pvcreate(const String& path); static void pvremove(const String& path); - - static void vgcreate(const String& vgname, - long long extent_size, - bool clustered, + + static void vgcreate(const String& vgname, + long long extent_size, + bool clustered, const std::list& pv_paths); static void vgremove(const String& vgname); static void vgextend(const String& vgname, @@ -61,7 +61,7 @@ const String& pv_path); static void vgchange(const String& vgname, bool clustered); - + static void lvcreate(const String& vgname, const String& lvname, long long size); @@ -69,16 +69,16 @@ const String& origin_path, long long size); static void lvremove(const String& path); - + static void lvreduce(const String& path, long long new_size); static void lvextend(const String& path, long long new_size); - + static bool vg_clustered(const String& vgname); static void check_locking(); static bool clustered_enabled(); static void enable_clustered(); static void disable_clustered(); - + }; --- conga/ricci/modules/storage/LVMClusterLockingError.h 2007/03/05 20:45:17 1.2 +++ conga/ricci/modules/storage/LVMClusterLockingError.h 2007/09/11 02:45:28 1.3 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -34,7 +34,7 @@ : Except(6, String("LVM cluster locking is not enabled")) {} virtual ~LVMClusterLockingError() {} - + }; --- conga/ricci/modules/storage/MDRaid.cpp 2006/09/26 01:16:13 1.7 +++ conga/ricci/modules/storage/MDRaid.cpp 2007/09/11 02:45:28 1.8 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -29,11 +29,11 @@ using namespace std; -list +list get_MDRaid_ids() { list ids; - + try { list raids = mdadm::raids(); for (list::const_iterator iter = raids.begin(); @@ -41,7 +41,7 @@ iter++) ids.push_back(MDRAID_PREFIX + iter->path); } catch ( ... ) {} - + return ids; } @@ -57,22 +57,22 @@ _raid = mdadm::probe_path(raid_path); if (_raid.path != raid_path) throw String("not mdraid"); - + for (list::const_iterator iter = _raid.devices.begin(); iter != _raid.devices.end(); iter++) sources.push_back(BDFactory::get_bd(iter->path)); - + try { targets.push_back(BDFactory::get_bd(_raid.path)); } catch ( ... ) {} - + _props.set(Variable("raid", _raid.name)); _props.set(Variable("raid_level", _raid.level)); _props.set(Variable("uuid", _raid.uuid)); _props.set(Variable("num_devices", _raid.num_devices)); _props.set(Variable("num_spares", (long long) _raid.devices.size() - _raid.num_devices)); - + if (targets.empty()) _props.set(Variable("active", false, true)); else { @@ -86,11 +86,11 @@ else _props.set(Variable("active", true)); */ - + if (targets.front()->content->removable()) removable(true); - - list > mappers = + + list > mappers = MapperFactory::get_mappers(MAPPER_PT_TYPE); for (list >::iterator iter_map = mappers.begin(); iter_map != mappers.end(); @@ -111,7 +111,7 @@ {} -void +void MDRaid::apply(const MapperParsed& mp) { bool active_old = _props.get("active").get_bool(); @@ -123,7 +123,7 @@ mdadm::start_raid(_raid); } -void +void MDRaid::__add_sources(const list >& bds) { for (list >::const_iterator iter = bds.begin(); @@ -132,13 +132,13 @@ mdadm::add_source(_raid.path, (*iter)->path()); } -void +void MDRaid::__remove() { // throw String("MDRaid::_remove() not yet implemented"); - + mdadm::stop_raid(_raid); - + for (list::const_iterator iter = _raid.devices.begin(); iter != _raid.devices.end(); iter++) @@ -149,33 +149,33 @@ -counting_auto_ptr +counting_auto_ptr create_MDRaid(const MapperTemplate& temp) { // throw String("create_MDRaid() not yet implemented"); - + // everything is already validated, but number of sources if (temp.sources.size() < 2) throw String("create_MDRaid requires@least two sources"); - + list devs; for (list >::const_iterator iter = temp.sources.begin(); iter != temp.sources.end(); iter++) devs.push_back((*iter)->path()); - + String raid_path = mdadm::create_raid(temp.props.get("level").get_string(), devs); - + return counting_auto_ptr(new MDRaid(MDRAID_PREFIX + raid_path)); - + /* String vgname = temp.props.get("vgname").get_string(); long long extent_size = temp.props.get("extent_size").get_int(); - + try { utils::clear_cache(); - + list pv_paths; for (list >::const_iterator iter = temp.sources.begin(); iter != temp.sources.end(); @@ -186,7 +186,7 @@ if (bd->content->type == CONTENT_NONE_TYPE) LVM::pvcreate(bd->path()); } - + // create VG LVM::vgcreate(vgname, extent_size, pv_paths); } catch ( ... ) { @@ -201,7 +201,7 @@ } throw; } - + return counting_auto_ptr(new VG(VG_PREFIX + vgname)); */ } @@ -214,8 +214,8 @@ MapperTemplate(MAPPER_MDRAID_TYPE) { // throw String("MDRaidTemplate() not yet implemented"); - - list > mappers = + + list > mappers = MapperFactory::get_mappers(MAPPER_PT_TYPE); for (list >::iterator iter_map = mappers.begin(); iter_map != mappers.end(); @@ -232,7 +232,7 @@ throw String("not enough sources for mdraid"); props.set(Variable("min_sources", (long long) 2)); props.set(Variable("max_sources", (long long) new_sources.size())); - + list levels = mdadm::valid_raid_levels(); props.set(Variable("level", levels.front(), levels)); } --- conga/ricci/modules/storage/MDRaid.h 2006/08/10 22:53:09 1.2 +++ conga/ricci/modules/storage/MDRaid.h 2007/09/11 02:45:28 1.3 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -39,19 +39,19 @@ public: MDRaid(const String& id); virtual ~MDRaid(); - + virtual void apply(const MapperParsed&); - + protected: - + virtual void __add_sources(const std::list >& bds); virtual void __remove(); - + private: - + mdraid _raid; - - + + }; // MDRaid @@ -60,10 +60,10 @@ public: MDRaidTemplate(); virtual ~MDRaidTemplate(); - + private: - - + + }; --- conga/ricci/modules/storage/MDRaidSource.cpp 2006/08/10 22:53:09 1.3 +++ conga/ricci/modules/storage/MDRaidSource.cpp 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -29,7 +29,7 @@ MDRaidSource::MDRaidSource(const String& path) : MapperSource(MAPPER_MDRAID_TYPE, - "BUG", + "BUG", SOURCE_MDRAID_TYPE, path), _raid(mdadm::probe_path(path)) @@ -43,12 +43,12 @@ _raid_source = counting_auto_ptr(new mdraid_source(*iter)); if ( ! _raid_source.get()) throw String("MDRaidSource, null pointer"); - + _mapper_id = MDRAID_PREFIX + _raid.path; - + _props.set(Variable("raid", _raid.name)); _props.set(Variable("raid_level", _raid.level)); - + String state; switch (_raid_source->type) { case MDRAID_S_ACTIVE: @@ -64,7 +64,7 @@ throw String("invalid mdraid_source_type"); } _props.set(Variable("state", state)); - + if (_raid_source->type == MDRAID_S_ACTIVE) _props.set(Variable("failed", false, true)); else if (_raid_source->type == MDRAID_S_SPARE) @@ -77,7 +77,7 @@ {} -bool +bool MDRaidSource::removable() const { bool res = _raid_source->type == MDRAID_S_FAILED || @@ -85,7 +85,7 @@ return res; } -void +void MDRaidSource::remove() { if ( ! removable()) @@ -93,10 +93,10 @@ mdadm::remove_source(_raid.path, path()); } -void +void MDRaidSource::apply_props_before_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props) { bool failed_old = _props.get("failed").get_bool(); --- conga/ricci/modules/storage/MDRaidSource.h 2006/08/10 22:53:09 1.2 +++ conga/ricci/modules/storage/MDRaidSource.h 2007/09/11 02:45:28 1.3 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -33,21 +33,21 @@ public: MDRaidSource(const String& path); virtual ~MDRaidSource(); - - + + virtual bool removable() const; virtual void remove(); - + virtual void apply_props_before_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props); - + private: - + mdraid _raid; counting_auto_ptr _raid_source; - + }; --- conga/ricci/modules/storage/MDRaidTarget.cpp 2006/09/26 01:16:13 1.4 +++ conga/ricci/modules/storage/MDRaidTarget.cpp 2007/09/11 02:45:28 1.5 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -33,9 +33,9 @@ -MDRaidTarget::MDRaidTarget(const String& path) : +MDRaidTarget::MDRaidTarget(const String& path) : BD(MAPPER_MDRAID_TYPE, - "BUG", + "BUG", BD_MDRAID_TYPE, path) { @@ -43,11 +43,11 @@ if (_raid.path != path) throw String("not MDRaidTarget, but source"); _mapper_id = MDRAID_PREFIX + _raid.path; - + // props _props.set(Variable("raid", _raid.name)); _props.set(Variable("raid_level", _raid.level)); - + // content if (content->removable()) { // removable(true); @@ -68,34 +68,34 @@ -void -MDRaidTarget::shrink(unsigned long long new_size, +void +MDRaidTarget::shrink(unsigned long long new_size, const Props& new_props) { throw String("MDRaidTarget not resizable"); } -void -MDRaidTarget::expand(unsigned long long new_size, +void +MDRaidTarget::expand(unsigned long long new_size, const Props& new_props) { throw String("MDRaidTarget not resizable"); } -String +String MDRaidTarget::apply_props_before_resize(const Props& new_props) { return path(); } -String +String MDRaidTarget::apply_props_after_resize(const Props& new_props) { return path(); } -void +void MDRaidTarget::remove() { content->remove(); - - // nothing to be done, will be removed as part of MDRaid removal, + + // nothing to be done, will be removed as part of MDRaid removal, // MDRaidTarget should not be marked as removable, because itself cannot be removed } --- conga/ricci/modules/storage/MDRaidTarget.h 2006/08/10 22:53:09 1.2 +++ conga/ricci/modules/storage/MDRaidTarget.h 2007/09/11 02:45:28 1.3 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -34,23 +34,23 @@ public: MDRaidTarget(const String& path); virtual ~MDRaidTarget(); - + virtual void remove(); - + protected: - - virtual void shrink(unsigned long long new_size, + + virtual void shrink(unsigned long long new_size, const Props& new_props); - virtual void expand(unsigned long long new_size, + virtual void expand(unsigned long long new_size, const Props& new_props); - + virtual String apply_props_before_resize(const Props& new_props); // return path virtual String apply_props_after_resize(const Props& new_props); // return path - + private: - + mdraid _raid; - + }; // class MDRaidTarget_h --- conga/ricci/modules/storage/Mapper.cpp 2006/08/10 22:53:09 1.3 +++ conga/ricci/modules/storage/Mapper.cpp 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -44,20 +44,20 @@ {} -bool +bool Mapper::removable() const { return _props.get("removable").get_bool(); } -void +void Mapper::removable(bool removable) { _props.set(Variable("removable", removable)); } -void +void Mapper::add_sources(const list& parsed_bds) { list paths; @@ -69,10 +69,10 @@ paths.push_back(iter->path); bds.push_back(iter->bd); } - + if (bds.empty()) return; - + for (list >::const_iterator bd_iter = bds.begin(); bd_iter != bds.end(); bd_iter++) { @@ -86,7 +86,7 @@ if (!found) throw MidAir(); } - + this->__add_sources(bds); utils::clear_cache(); } @@ -96,17 +96,17 @@ { if (!_props.get("removable").get_bool()) throw String("mapper not removable"); - + for (list >::const_iterator iter = targets.begin(); iter != targets.end(); iter++) (*iter)->remove(); - + this->__remove(); } -String +String Mapper::state_ind() const { XMLObject xml("hash"); @@ -122,51 +122,51 @@ return utils::hash_str(generateXML(xml)); } -XMLObject +XMLObject Mapper::xml() const { XMLObject xml(MAPPER_TYPE_TAG); - + xml.set_attr("mapper_type", _mapper_type); xml.set_attr("mapper_id", _mapper_id); xml.set_attr("state_ind", state_ind()); - + xml.add_child(_props.xml()); - + XMLObject sources_xml(MAPPER_SOURCES_TAG); for (list >::const_iterator iter = sources.begin(); iter != sources.end(); iter++) sources_xml.add_child((*iter)->xml()); xml.add_child(sources_xml); - + XMLObject targets_xml(MAPPER_TARGETS_TAG); for (list >::const_iterator iter = targets.begin(); iter != targets.end(); iter++) targets_xml.add_child((*iter)->xml()); xml.add_child(targets_xml); - + /* XMLObject mappings(MAPPER_MAPPINGS_TAG); xml.add_child(mappings); */ - - + + XMLObject new_sources_xml(MAPPER_NEW_SOURCES_TAG); for (list >::const_iterator iter = new_sources.begin(); iter != new_sources.end(); iter++) new_sources_xml.add_child((*iter)->xml()); xml.add_child(new_sources_xml); - + XMLObject new_targets_xml(MAPPER_NEW_TARGETS_TAG); for (list >::const_iterator iter = new_targets.begin(); iter != new_targets.end(); iter++) new_targets_xml.add_child((*iter)->xml()); xml.add_child(new_targets_xml); - + return xml; } @@ -180,7 +180,7 @@ { if (xml.tag() != MAPPER_TYPE_TAG) throw String("not Mapper"); - + mapper_type = xml.get_attr("mapper_type"); mapper_id = xml.get_attr("mapper_id"); state_ind = xml.get_attr("state_ind"); @@ -188,14 +188,14 @@ mapper_id.empty() || state_ind.empty()) throw String("MapperParsed missing identification"); - + // get Mapper try { mapper = MapperFactory::get_mapper(mapper_type, mapper_id); } catch ( ... ) { throw MidAir(); } - + for (list::const_iterator iter = xml.children().begin(); iter != xml.children().end(); iter++) { @@ -204,12 +204,12 @@ continue; } catch ( ... ) {} } - + // ### validate ### if (mapper->state_ind() != state_ind) throw MidAir(); mapper->_props.validate(props);; - + } MapperParsed::~MapperParsed() @@ -228,32 +228,32 @@ { if (xml.tag() != MAPPER_TEMPLATE_TYPE_TAG) throw String("not mapper template"); - - list > mapper_temps = + + list > mapper_temps = MapperFactory::get_mapper_templates(xml.get_attr("mapper_type")); if (mapper_temps.size() != 1) throw String("invalid number of mapper_templates returned"); counting_auto_ptr orig_mapp = mapper_temps.front(); mapper_type = orig_mapp->mapper_type; - + const list& kids = xml.children(); for (list::const_iterator kid_iter = kids.begin(); kid_iter != kids.end(); kid_iter++) { const XMLObject& kid = *kid_iter; - + try { props = Props(kid); continue; } catch ( ... ) {} - + if (kid.tag() == MAPPER_SOURCES_TAG) { for (list::const_iterator bd_iter = kid.children().begin(); bd_iter != kid.children().end(); bd_iter++) { BDParsed bdp(*bd_iter); counting_auto_ptr bd; - for (list >::const_iterator obd_iter = + for (list >::const_iterator obd_iter = orig_mapp->new_sources.begin(); obd_iter != orig_mapp->new_sources.end(); obd_iter++) { @@ -279,50 +279,50 @@ {} -XMLObject +XMLObject MapperTemplate::xml() const { XMLObject xml(MAPPER_TEMPLATE_TYPE_TAG); - + xml.set_attr("mapper_type", mapper_type); // xml.set_attr("state_ind", state_ind()); - + xml.add_child(props.xml()); - + XMLObject sources_xml(MAPPER_SOURCES_TAG); for (list >::const_iterator iter = sources.begin(); iter != sources.end(); iter++) sources_xml.add_child((*iter)->xml()); xml.add_child(sources_xml); - + XMLObject targets_xml(MAPPER_TARGETS_TAG); for (list >::const_iterator iter = targets.begin(); iter != targets.end(); iter++) targets_xml.add_child((*iter)->xml()); xml.add_child(targets_xml); - + /* XMLObject mappings(MAPPER_MAPPINGS_TAG); xml.add_child(mappings); */ - - - + + + XMLObject new_sources_xml(MAPPER_NEW_SOURCES_TAG); for (list >::const_iterator iter = new_sources.begin(); iter != new_sources.end(); iter++) new_sources_xml.add_child((*iter)->xml()); xml.add_child(new_sources_xml); - + XMLObject new_targets_xml(MAPPER_NEW_TARGETS_TAG); for (list >::const_iterator iter = new_targets.begin(); iter != new_targets.end(); iter++) new_targets_xml.add_child((*iter)->xml()); xml.add_child(new_targets_xml); - + return xml; } --- conga/ricci/modules/storage/Mapper.h 2006/08/10 22:53:09 1.3 +++ conga/ricci/modules/storage/Mapper.h 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -41,42 +41,42 @@ { public: virtual ~Mapper(); - + String state_ind() const; - + Props _props; - + virtual XMLObject xml() const; - - - + + + std::list > sources; std::list > targets; - + std::list > new_sources; std::list > new_targets; - + virtual bool removable() const; virtual void removable(bool removable); virtual void remove(); - + virtual void apply(const MapperParsed&) = 0; - + virtual void add_sources(const std::list& bds); - + protected: Mapper(const String& type, const String& id); - + String _mapper_type; String _mapper_id; - + virtual void __add_sources(const std::list >& bds) = 0; virtual void __remove() = 0; - - + + private: - - + + }; // class Mapper @@ -85,15 +85,15 @@ public: MapperParsed(const XMLObject& xml); virtual ~MapperParsed(); - + Props props; - + String mapper_type; String mapper_id; String state_ind; - + counting_auto_ptr mapper; - + }; @@ -102,27 +102,27 @@ public: MapperTemplate(const XMLObject& xml); virtual ~MapperTemplate(); - + virtual XMLObject xml() const; - - + + std::list > sources; std::list > targets; - + std::list > new_sources; std::list > new_targets; - - + + String mapper_type; - + Props props; - + protected: MapperTemplate(const String& type); - + private: - - + + }; // class MapperTemplate --- conga/ricci/modules/storage/MapperFactory.cpp 2006/08/10 22:53:09 1.3 +++ conga/ricci/modules/storage/MapperFactory.cpp 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -35,7 +35,7 @@ -list > +list > MapperFactory::get_mapper_ids(const String& mapper_type) { list > id_pairs; @@ -70,7 +70,7 @@ return id_pairs; } -counting_auto_ptr +counting_auto_ptr MapperFactory::get_mapper(const String& mapper_type, const String& mapper_id) { @@ -85,7 +85,7 @@ throw String("no such mapper type"); } -list > +list > MapperFactory::get_mappers(const String& mapper_type, const String& mapper_id) { @@ -95,7 +95,7 @@ iter != id_pairs.end(); iter++) { if ((mapper_type.empty() || mapper_type == iter->first) && - (mapper_id.empty() || mapper_id == iter->second)) + (mapper_id.empty() || mapper_id == iter->second)) try { mappers.push_back(get_mapper(iter->first, iter->second)); // } catch ( String e ) { @@ -127,7 +127,7 @@ return temps; } -counting_auto_ptr +counting_auto_ptr MapperFactory::create_mapper(const MapperTemplate& mapper_temp) { mapper_temp.props.validate(); @@ -140,7 +140,7 @@ throw String("no such mapper type"); } -counting_auto_ptr +counting_auto_ptr MapperFactory::modify_mapper(const MapperParsed& mapper_parsed) { mapper_parsed.mapper->apply(mapper_parsed); @@ -154,7 +154,7 @@ } -counting_auto_ptr +counting_auto_ptr MapperFactory::add_sources(const String& mapper_type, const String& mapper_id, const String& mapper_state_ind, @@ -163,7 +163,7 @@ counting_auto_ptr mapper = get_mapper(mapper_type, mapper_id); if (mapper->state_ind() != mapper_state_ind) throw MidAir(); - + mapper->add_sources(bds); return get_mapper(mapper_type, mapper_id); } --- conga/ricci/modules/storage/MapperFactory.h 2006/08/10 22:53:09 1.3 +++ conga/ricci/modules/storage/MapperFactory.h 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -31,35 +31,35 @@ class MapperFactory { public: - - static std::list > + + static std::list > get_mapper_ids(const String& mapper_type=""); - - static counting_auto_ptr + + static counting_auto_ptr get_mapper(const String& mapper_type, const String& mapper_id); - - static std::list > + + static std::list > get_mappers(const String& mapper_type="", const String& mapper_id=""); - + static std::list > get_mapper_templates(const String& mapper_type); - - static counting_auto_ptr + + static counting_auto_ptr create_mapper(const MapperTemplate& mapper_temp); - - static counting_auto_ptr + + static counting_auto_ptr modify_mapper(const MapperParsed& mapper_temp); - + static void remove_mapper(const MapperParsed& mapper); - - static counting_auto_ptr + + static counting_auto_ptr add_sources(const String& mapper_type, const String& mapper_id, const String& mapper_state_ind, const std::list& bds); - + }; --- conga/ricci/modules/storage/MapperSource.cpp 2006/08/10 22:53:09 1.3 +++ conga/ricci/modules/storage/MapperSource.cpp 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -28,8 +28,8 @@ using namespace std; -MapperSource::MapperSource(const String& mapper_type, - const String& mapper_id, +MapperSource::MapperSource(const String& mapper_type, + const String& mapper_id, const String& type, const String& path) : Content(CONTENT_MS_TYPE, path), @@ -42,13 +42,13 @@ {} -bool +bool MapperSource::expandable(long long& max_size) const { return false; } -bool +bool MapperSource::shrinkable(long long& min_size) const { return false; @@ -56,53 +56,53 @@ void MapperSource::shrink(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props) {} void MapperSource::expand(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props) {} void MapperSource::apply_props_before_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props) {} void MapperSource::apply_props_after_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props) {} -bool +bool MapperSource::removable() const { return false; } -void +void MapperSource::remove() { throw String("MapperSource not removable"); } -XMLObject +XMLObject MapperSource::xml() const { XMLObject xml = this->Content::xml(); - + // xml.set_attr("source_type", "source_type"); xml.set_attr("mapper_type", _mapper_type); xml.set_attr("mapper_id", _mapper_id); - + return xml; } --- conga/ricci/modules/storage/MapperSource.h 2006/08/10 22:53:09 1.3 +++ conga/ricci/modules/storage/MapperSource.h 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -32,45 +32,45 @@ class MapperSource : public Content { public: - MapperSource(const String& mapper_type, - const String& mapper_id, - const String& type, + MapperSource(const String& mapper_type, + const String& mapper_id, + const String& type, const String& path); virtual ~MapperSource(); - + XMLObject xml() const; - - + + virtual bool expandable(long long& max_size) const; virtual bool shrinkable(long long& min_size) const; - + virtual void shrink(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props); virtual void expand(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props); virtual void apply_props_before_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props); virtual void apply_props_after_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props); - + virtual bool removable() const; virtual void remove(); - + protected: String _mapper_type; String _mapper_id; String _type; - - + + private: - - + + }; @@ -78,12 +78,12 @@ { public: virtual ~MapperSourceTemplate(); - + protected: MapperSourceTemplate(const String& mapper_type); - + String _mapper_type; - + }; --- conga/ricci/modules/storage/MidAir.h 2006/04/07 16:42:40 1.2 +++ conga/ricci/modules/storage/MidAir.h 2007/09/11 02:45:28 1.3 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -30,11 +30,11 @@ class MidAir : public Except { public: - MidAir() + MidAir() : Except(1, "Mid-Air collision") {} virtual ~MidAir() {} - + }; --- conga/ricci/modules/storage/MountHandler.cpp 2007/08/24 22:06:29 1.7 +++ conga/ricci/modules/storage/MountHandler.cpp 2007/09/11 02:45:28 1.8 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -42,7 +42,7 @@ using namespace std; - + static String mtab_path("/etc/mtab"); static String fstab_path("/etc/fstab"); static String mounts_path("/proc/mounts"); @@ -54,18 +54,18 @@ static int locker_counter = 0; -static list +static list follow_links(const String& path); -static String +static String find_path(const String& devname); static void create_dir(const String& path); -Mountpoint::Mountpoint(const String& devname, - const String& mountpoint, - const String& fstype, +Mountpoint::Mountpoint(const String& devname, + const String& mountpoint, + const String& fstype, const std::pair& major_minor) : devname(devname), mountpoint(mountpoint), @@ -86,33 +86,33 @@ {} -std::pair +std::pair MountHandler::maj_min(const String& devname) const { MutexLocker l1(mutex); - + String path(follow_links(find_path(devname)).back()); - + struct stat st; - if (stat(path.c_str(), &st)) + if (stat(path.c_str(), &st)) throw String("stat(") + path + ") failed: " + String(strerror(errno)); - if (!S_ISBLK(st.st_mode)) + if (!S_ISBLK(st.st_mode)) throw path + " is not a block device"; - - return pair(major(st.st_rdev), + + return pair(major(st.st_rdev), minor(st.st_rdev)); } -std::list +std::list MountHandler::get_entries(const String& filename) const { MutexLocker l1(mutex); FstabLocker l2; - + char buff[1024]; struct mntent mntbuff; list ret; - + FILE* fstab = setmntent(filename.c_str(), "r"); if (!fstab) throw String("unable to open ") + filename + ": " + String(strerror(errno)); @@ -133,14 +133,14 @@ } -std::list +std::list MountHandler::mounts() const { MutexLocker l1(mutex); - + list ret = get_entries(mtab_path); - - + + FILE* file = fopen("/proc/swaps", "r"); if (!file) throw String("unable to open /proc/swaps: ") + String(strerror(errno)); @@ -168,7 +168,7 @@ free(ptr); throw; } - + if (line.empty()) continue; if (line[0] == '/') { @@ -183,60 +183,60 @@ ; } catch ( ... ) { while (fclose(file) && errno == EINTR) - ; + ; throw; } - + return ret; } -std::list +std::list MountHandler::mounts(const std::pair& maj_min) const { MutexLocker l1(mutex); - + list ret, l = mounts(); for (list::const_iterator iter = l.begin(); iter != l.end(); - iter++) + iter++) if (iter->major_minor == maj_min) ret.push_back(*iter); return ret; } -std::list +std::list MountHandler::fstabs() const { MutexLocker l1(mutex); - + return get_entries(fstab_path); } -std::list +std::list MountHandler::fstabs(const std::pair& maj_min) const { MutexLocker l1(mutex); - + list ret, l = fstabs(); for (list::const_iterator iter = l.begin(); iter != l.end(); - iter++) + iter++) if (iter->major_minor == maj_min) ret.push_back(*iter); return ret; } -bool +bool MountHandler::mount(const String& devname, const String& mountpoint, const String& fstype) const { MutexLocker l1(mutex); - + String out, err, bin; int status; vector args; - + if (fstype == "swap") { bin = "/sbin/swapon"; args.clear(); @@ -244,7 +244,7 @@ } else { // make sure dir exists create_dir(mountpoint); - + bin = "/bin/mount"; args.clear(); args.push_back(devname); @@ -252,27 +252,27 @@ args.push_back("-t"); args.push_back(fstype); } - - if (utils::execute(bin, + + if (utils::execute(bin, args, - out, - err, + out, + err, status, false)) throw command_not_found_error_msg(bin); return !status; } -bool +bool MountHandler::umount(const String& devname, const String& mountpoint) const { MutexLocker l1(mutex); - + String out, err, bin; int status; vector args; - + if (mountpoint == "swap") { bin = "/sbin/swapoff"; args.clear(); @@ -282,36 +282,36 @@ args.clear(); args.push_back(mountpoint); } - - if (utils::execute(bin, + + if (utils::execute(bin, args, - out, - err, + out, + err, status, false)) throw command_not_found_error_msg(bin); return !status; } -bool +bool MountHandler::fstab_add(const String& devname, const String& mountpoint, const String& fstype) const { MutexLocker l1(mutex); FstabLocker l2; - + String dev(utils::strip(devname)); String mnt(utils::strip(mountpoint)); String type(utils::strip(fstype)); - + // verify devname pair mm = maj_min(dev); - + // make sure dir exists if (type != "swap") create_dir(mnt); - + list tabs(fstabs()); for (list::const_iterator iter = tabs.begin(); iter != tabs.end(); @@ -323,7 +323,7 @@ if (mnt != "swap") throw mnt + String("is already in fstab"); } - + FILE* fstab = setmntent(fstab_path.c_str(), "r+"); if (!fstab) throw String("unable to open ") + fstab_path + ": " + String(strerror(errno)); @@ -336,7 +336,7 @@ st.mnt_opts = (char*) "defaults"; st.mnt_freq = 0; st.mnt_passno = 0; - + success = !addmntent(fstab, &st); } catch ( ... ) { endmntent(fstab); @@ -352,10 +352,10 @@ { MutexLocker l1(mutex); FstabLocker l2; - + String dev(utils::strip(devname)); String mnt(utils::strip(mountpoint)); - + String buff; bool modified = false; FILE* fstab = fopen(fstab_path.c_str(), "r"); @@ -385,7 +385,7 @@ free(ptr); throw; } - + vector words = utils::split(utils::strip(line)); if (words.size() < 2) buff += line; @@ -402,10 +402,10 @@ ; } catch ( ... ) { while (fclose(fstab) && errno == EINTR) - ; + ; throw; } - + // write changes if (modified) { fstab = fopen(fstab_path.c_str(), "w"); @@ -418,20 +418,20 @@ ; } catch ( ... ) { while (fclose(fstab) && errno == EINTR) - ; + ; throw; } } } -std::list +std::list MountHandler::fstypes() const { MutexLocker l1(mutex); - + list fss; fss.push_back("swap"); - + FILE* file = fopen("/proc/filesystems", "r"); if (!file) throw String("unable to open /proc/filesystems: " + String(strerror(errno))); @@ -459,7 +459,7 @@ free(ptr); throw; } - + if (line.empty()) continue; if (line.find_first_of(" \t") == line.npos) @@ -469,23 +469,23 @@ ; } catch ( ... ) { while (fclose(file) && errno == EINTR) - ; + ; throw; } - + return fss; } -static std::list +static std::list _used_dirs(const String& filename) { MutexLocker l1(mutex); FstabLocker l2; - + char buff[1024]; struct mntent mntbuff; list ret; - + FILE* fstab = setmntent(filename.c_str(), "r"); if (!fstab) throw String("unable to open ") + filename + ": " + String(strerror(errno)); @@ -503,28 +503,28 @@ endmntent(fstab); return ret; } -std::list +std::list MountHandler::used_dirs() const { MutexLocker l1(mutex); FstabLocker l2; - + list ret = _used_dirs(fstab_path.c_str()); - + list tmp = _used_dirs(mtab_path.c_str()); for (list::const_iterator iter = tmp.begin(); iter != tmp.end(); iter++) if (find(ret.begin(), ret.end(), *iter) == ret.end()) ret.push_back(*iter); - + tmp = _used_dirs(mounts_path.c_str()); for (list::const_iterator iter = tmp.begin(); iter != tmp.end(); iter++) if (find(ret.begin(), ret.end(), *iter) == ret.end()) ret.push_back(*iter); - + return ret; } @@ -535,7 +535,7 @@ FstabLocker::FstabLocker() { MutexLocker l(mutex); - + if (locker_counter == 0) { locker_fd = open(fstab_path.c_str(), O_RDWR); if (locker_fd == -1) @@ -549,14 +549,14 @@ throw String("unable to flock fstab: ") + String(strerror(errno)); } } - + locker_counter++; } FstabLocker::~FstabLocker() { MutexLocker l(mutex); - + if (locker_counter == 1) { int ret; while ((ret = flock(locker_fd, LOCK_UN)) && errno == EINTR) @@ -566,7 +566,7 @@ while (close(locker_fd) == -1 && errno == EINTR) ; } - + locker_counter--; } @@ -579,31 +579,31 @@ { char buff[1024]; list paths; - + paths.push_back(path); - + int ret; while ((ret = readlink(paths.back().c_str(), buff, sizeof(buff))) > 0) paths.push_back(String(buff, ret)); - + return paths; } -String +String find_path(const String& devname) { if (devname.find("LABEL=") == 0) { String out, err; int status; - if (utils::execute(findfs_path, + if (utils::execute(findfs_path, vector(1, devname), - out, - err, + out, + err, status, false)) throw command_not_found_error_msg(findfs_path); if (status != 0) - throw String("unable to find path for ") + devname + + throw String("unable to find path for ") + devname + " " + out + " " + err + " " + utils::to_string(status); String path = utils::split(out, "\n")[0]; return utils::strip(path); @@ -617,21 +617,21 @@ create_dir(const String& path) { MutexLocker l1(mutex); - + if (path.empty()) throw String("dir path is empty"); if (path[0] != '/') throw String("dir must be an absolute path"); - + String out, err, bin; int status; vector args; args.push_back("-p"); args.push_back(utils::strip(path)); - if (utils::execute("/bin/mkdir", + if (utils::execute("/bin/mkdir", args, - out, - err, + out, + err, status, false)) throw command_not_found_error_msg("mkdir"); --- conga/ricci/modules/storage/MountHandler.h 2006/08/10 22:53:09 1.2 +++ conga/ricci/modules/storage/MountHandler.h 2007/09/11 02:45:28 1.3 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -37,7 +37,7 @@ public: FstabLocker(); virtual ~FstabLocker(); - + }; @@ -45,19 +45,19 @@ { public: virtual ~Mountpoint(); - + const String devname; const String mountpoint; const String fstype; const std::pair major_minor; - + private: - Mountpoint(const String& devname, - const String& mountpoint, - const String& fstype, - const std::pair& major_minor); - + friend class MountHandler; }; @@ -66,37 +66,37 @@ public: MountHandler(); virtual ~MountHandler(); - + std::pair maj_min(const String& devname) const; - + std::list mounts() const; - std::list mounts(const std::pair mounts(const std::pair& maj_min) const; - + std::list fstabs() const; - std::list fstabs(const std::pair fstabs(const std::pair& maj_min) const; - + bool mount(const String& devname, const String& mountpoint, const String& fstype) const; bool umount(const String& devname, const String& mountpoint) const; - + bool fstab_add(const String& devname, const String& mountpoint, const String& fstype) const; void fstab_remove(const String& devname, const String& mountpoint) const; - + std::list fstypes() const; // /proc/filesystems - + std::list used_dirs() const; // list of mounpoints from fstab, mtab & mounts - + private: - + std::list get_entries(const String& filename) const; - + }; --- conga/ricci/modules/storage/PTSource.cpp 2006/08/10 22:53:09 1.2 +++ conga/ricci/modules/storage/PTSource.cpp 2007/09/11 02:45:28 1.3 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -31,14 +31,14 @@ PTSource::PTSource(const String& path) : MapperSource(MAPPER_PT_TYPE, - PT_PREFIX + path, - SOURCE_PT_TYPE, + PT_PREFIX + path, + SOURCE_PT_TYPE, path) { list hds = Parted::possible_paths(); if (find(hds.begin(), hds.end(), path) == hds.end()) throw String(path + "not a partition table"); - + std::pair > p = Parted::partitions(path); _props.set(Variable("disklabel", p.first)); } --- conga/ricci/modules/storage/PTSource.h 2006/08/10 22:53:09 1.2 +++ conga/ricci/modules/storage/PTSource.h 2007/09/11 02:45:28 1.3 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -33,9 +33,9 @@ public: PTSource(const String& path); virtual ~PTSource(); - - - + + + }; --- conga/ricci/modules/storage/PV.cpp 2007/03/05 20:45:17 1.6 +++ conga/ricci/modules/storage/PV.cpp 2007/09/11 02:45:28 1.7 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -38,14 +38,14 @@ path) { LVM::probe_pv(path, _props); - + if (unused()) { list vgnames; - + String vgname(_props.get("vgname").get_string()); vgnames.push_back(vgname); - - list > vg_pairs = + + list > vg_pairs = MapperFactory::get_mapper_ids(MAPPER_VG_TYPE); for (list >::const_iterator iter = vg_pairs.begin(); iter != vg_pairs.end(); @@ -74,31 +74,31 @@ return false; } -bool +bool PV::removable() const { return unused(); } -void +void PV::remove() { if (!removable()) throw String("PV::remove() called, while pv not removable"); - - counting_auto_ptr vg = + + counting_auto_ptr vg = MapperFactory::get_mapper(_mapper_type, _mapper_id); - + String vgname = _props.get("vgname").get_string(); - - + + // if VG is marked as clustered, but cluster locking is not available, throw if (!LVM::clustered_enabled() && LVM::vg_clustered(vgname)) throw LVMClusterLockingError(); - - + + if (vg->sources.size() == 1) { if (vgname.size()) LVM::vgremove(vgname); @@ -110,27 +110,27 @@ } } -void +void PV::apply_props_before_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props) { String vgname_old(_props.get("vgname").get_string()); String vgname_new(new_props.get("vgname").get_string()); - - + + // if VG is marked as clustered, but cluster locking is not available, throw if (!LVM::clustered_enabled() && - (LVM::vg_clustered(vgname_old) || + (LVM::vg_clustered(vgname_old) || LVM::vg_clustered(vgname_new))) throw LVMClusterLockingError(); - - - counting_auto_ptr vg_old = + + + counting_auto_ptr vg_old = MapperFactory::get_mapper(_mapper_type, _mapper_id); - + if (vgname_old != vgname_new) { if (vgname_old.size()) { if (vg_old->sources.size() == 1) @@ -145,19 +145,19 @@ -void +void create_content_pv(const String& path, const counting_auto_ptr& templ) { String vgname(templ->_props.get("vgname").get_string()); - - + + // if VG is marked as clustered, but cluster locking is not available, throw if (!LVM::clustered_enabled() && LVM::vg_clustered(vgname)) throw LVMClusterLockingError(); - - + + LVM::pvcreate(path); try { if (vgname.size()) @@ -173,7 +173,7 @@ MapperSourceTemplate(MAPPER_VG_TYPE) { list vgnames; - list > vg_pairs = + list > vg_pairs = MapperFactory::get_mapper_ids(MAPPER_VG_TYPE); for (list >::const_iterator iter = vg_pairs.begin(); iter != vg_pairs.end(); @@ -181,7 +181,7 @@ String vgname(iter->second.substr(VG_PREFIX.size())); vgnames.push_back(vgname); } - + // there will always be at least unused PVs holder _props.set(Variable("vgname", vgnames.front(), vgnames)); } --- conga/ricci/modules/storage/PV.h 2006/08/10 22:53:09 1.3 +++ conga/ricci/modules/storage/PV.h 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -37,21 +37,21 @@ public: PV(const String& path); virtual ~PV(); - - - + + + virtual bool removable() const; virtual void remove(); - + virtual void apply_props_before_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props); - + private: - + bool unused() const; - + }; @@ -60,10 +60,10 @@ public: PVTemplate(); virtual ~PVTemplate(); - + private: - - + + }; --- conga/ricci/modules/storage/Partition.cpp 2006/08/10 22:53:09 1.3 +++ conga/ricci/modules/storage/Partition.cpp 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -38,9 +38,9 @@ Partition::Partition(const String& path) : - BD(MAPPER_PT_TYPE, - PT_PREFIX + Parted::extract_pt_path(path), - BD_PART_TYPE, + BD(MAPPER_PT_TYPE, + PT_PREFIX + Parted::extract_pt_path(path), + BD_PART_TYPE, path, false), _pt_path(Parted::extract_pt_path(path)) @@ -72,10 +72,10 @@ throw String(_path + " not a partition"); } -Partition::Partition(const String& path, +Partition::Partition(const String& path, const PartedPartition& parted_part) : - BD(MAPPER_PT_TYPE, - PT_PREFIX + Parted::extract_pt_path(path), + BD(MAPPER_PT_TYPE, + PT_PREFIX + Parted::extract_pt_path(path), BD_PART_TYPE, path, false), @@ -84,17 +84,17 @@ initialize(parted_part); } -void +void Partition::initialize(const PartedPartition& part) { partition = counting_auto_ptr(new PartedPartition(part)); - + _props.set(Variable("size", part.size())); _props.set(Variable("partition_num", (long long) part.partnum())); _props.set(Variable("partition_type", part.type())); _props.set(Variable("bootable", part.bootable())); _props.set(Variable("partition_begin", part.begin())); - + if (content->removable()) { removable(true); if (content->type == CONTENT_NONE_TYPE) { @@ -104,17 +104,17 @@ iter++) { content->add_replacement(*iter); } - + // add PV content->add_replacement(counting_auto_ptr(new PVTemplate())); } else content->add_replacement(counting_auto_ptr(new ContentNoneTemplate())); - } - + } + if (partition->extended()) { // replace content with extended content content = counting_auto_ptr(new ContentExtendedPartition(_path)); - + // TODO: fix removable (extended s/b removable if all it's parts are removable) bool rem = true; for (list::const_iterator iter = partition->kids().begin(); @@ -124,7 +124,7 @@ rem = false; removable(rem); } - + if (partition->logical()) { // TODO: logical removal changes paths, fix it out // for now, only last logical can be removed @@ -146,50 +146,50 @@ if (max_logical != part.partnum()) removable(false); } - + // if label not supported, parts not removable list supp_labels = Parted::supported_labels(); - bool label_supported = (find(supp_labels.begin(), - supp_labels.end(), + bool label_supported = (find(supp_labels.begin(), + supp_labels.end(), part.label()) != supp_labels.end()); if ( ! label_supported) removable(false); - + } Partition::~Partition() {} -void -Partition::shrink(unsigned long long new_size, +void +Partition::shrink(unsigned long long new_size, const Props& new_props) { throw String("Partition::shrink() not implemented"); } -void -Partition::expand(unsigned long long new_size, +void +Partition::expand(unsigned long long new_size, const Props& new_props) { throw String("Partition::expand() not implemented"); } -String +String Partition::apply_props_before_resize(const Props& new_props) { return path(); } -String +String Partition::apply_props_after_resize(const Props& new_props) { return path(); } -void +void Partition::remove() { if (!partition.get()) throw String("Partition::remove() null pointer"); - + content->remove(); Parted::remove_partition(_pt_path, *(partition.get())); @@ -197,28 +197,28 @@ -counting_auto_ptr +counting_auto_ptr create_partition(const BDTemplate& bd_temp) { // everything is already validated :) - + String pt_path = bd_temp.mapper_id.substr(PT_PREFIX.size()); - + String part_type = bd_temp.props.get("partition_type").get_string(); - + long long seg_begin = bd_temp.props.get("partition_begin").get_int(); long long size = bd_temp.props.get("size").get_int(); - + String part_path = Parted::create_partition(pt_path, part_type, seg_begin, size); - + utils::clear_cache(); - + counting_auto_ptr bd = BDFactory::get_bd(part_path); ContentFactory().create_content(bd, bd_temp.content_parsed); - + return BDFactory::get_bd(part_path); } @@ -233,9 +233,9 @@ { if (!part.unused_space()) throw String("not unused space"); - + props.set(Variable("partition_begin", part.begin())); - + String type; if (part.primary()) type = "primary"; @@ -246,22 +246,22 @@ else throw String("uncreatable"); props.set(Variable("partition_type", type)); - + long long min_part_size = Parted::min_part_size(part.label()); long long part_size = (part.size() / min_part_size) * min_part_size; - Variable size("size", - part_size, + Variable size("size", + part_size, min_part_size, - part_size, + part_size, min_part_size); props.set(size); - + if (part.extended()) { - - + + // TODO: extended partition's content - - + + } else { if (content->type == CONTENT_NONE_TYPE) { list > fss = FSController().get_available_fss(); @@ -270,7 +270,7 @@ iter++) { content->add_replacement(*iter); } - + // add PV content->add_replacement(counting_auto_ptr(new PVTemplate())); } --- conga/ricci/modules/storage/Partition.h 2006/08/10 22:53:09 1.3 +++ conga/ricci/modules/storage/Partition.h 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -37,25 +37,25 @@ Partition(const String& path); Partition(const String& path, const PartedPartition& parted_part); virtual ~Partition(); - + virtual void remove(); - + protected: - virtual void shrink(unsigned long long new_size, + virtual void shrink(unsigned long long new_size, const Props& new_props); - virtual void expand(unsigned long long new_size, + virtual void expand(unsigned long long new_size, const Props& new_props); - + virtual String apply_props_before_resize(const Props& new_props); // return path virtual String apply_props_after_resize(const Props& new_props); // return path - + private: void initialize(const PartedPartition& part); - + String _pt_path; - + counting_auto_ptr partition; - + }; // class Partition @@ -67,8 +67,8 @@ const String& mapper_state_ind, const PartedPartition& part); virtual ~PartitionTemplate(); - - + + }; // class PartitionTemplate --- conga/ricci/modules/storage/PartitionTable.cpp 2006/10/16 15:32:25 1.5 +++ conga/ricci/modules/storage/PartitionTable.cpp 2007/09/11 02:45:28 1.6 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -38,7 +38,7 @@ list get_PT_ids() { list hds = Parted::possible_paths(); - + // check if a partition table is on the path list ids; for (list::const_iterator iter = hds.begin(); @@ -52,20 +52,20 @@ return ids; } -counting_auto_ptr +counting_auto_ptr create_PT(const MapperTemplate& temp) { // everything is already validated, but number of sources if (temp.sources.size() != 1) throw String("create_PT requires exactly one source"); - + utils::clear_cache(); - + String path = temp.sources.front()->path(); Parted::create_label(path, temp.props.get("label").get_string()); - + utils::clear_cache(); - + return counting_auto_ptr(new PartitionTable(PT_PREFIX + path)); } @@ -73,46 +73,46 @@ // ##### PartitionTable ##### -static void +static void generate_targets(const String& pt_path, const list& parts, list >& targets); -static void +static void generate_new_targets(const String& mapper_id, const String& mapper_state_ind, const list& parts, list >& new_targets); - + PartitionTable::PartitionTable(const String& id) : Mapper(MAPPER_PT_TYPE, id) { _pt_path = _mapper_id; _pt_path.replace(0, PT_PREFIX.size(), ""); - + list hds = Parted::possible_paths(); if (find(hds.begin(), hds.end(), _pt_path) == hds.end()) throw String(_pt_path + "not a partition table"); - + pair > p = Parted::partitions(_pt_path); const list parts = p.second; _label = p.first; _props.set(Variable("disklabel", _label)); - + // label supported list supp_labels = Parted::supported_labels(); - bool label_supported = (find(supp_labels.begin(), - supp_labels.end(), + bool label_supported = (find(supp_labels.begin(), + supp_labels.end(), _label) != supp_labels.end()); - + // sources counting_auto_ptr source = BDFactory::get_bd(_pt_path); _props.set(Variable("size", source->_props.get("size").get_int())); sources.push_back(source); - + // targets generate_targets(_pt_path, parts, targets); - + bool rem = true; for (list >::const_iterator iter = targets.begin(); iter != targets.end(); @@ -120,12 +120,12 @@ if (!(*iter)->removable()) rem = false; removable(rem); - + // new targets if (label_supported) generate_new_targets(id, state_ind(), - parts, + parts, new_targets); } @@ -133,19 +133,19 @@ {} -void +void PartitionTable::apply(const MapperParsed&) { // nothing to do, for now } -void +void PartitionTable::__add_sources(const list >& bds) { throw String("PartitionTable can have only one source"); } -void +void PartitionTable::__remove() { Parted::remove_label(_pt_path); @@ -153,7 +153,7 @@ -static void +static void generate_targets(const String& pt_path, const list& parts, list >& targets) @@ -170,7 +170,7 @@ } } -static void +static void generate_new_targets(const String& mapper_id, const String& mapper_state_ind, const list& parts, @@ -182,7 +182,7 @@ if (iter->unused_space()) { try { if (iter->primary()) { - PartedPartition p(0, + PartedPartition p(0, iter->begin(), iter->begin() + iter->size(), iter->bootable(), @@ -194,7 +194,7 @@ new_targets.push_back(ptt); } if (iter->extended()) { - PartedPartition p(0, + PartedPartition p(0, iter->begin(), iter->begin() + iter->size(), iter->bootable(), @@ -206,7 +206,7 @@ new_targets.push_back(ptt); } if (iter->logical()) { - PartedPartition p(0, + PartedPartition p(0, iter->begin(), iter->begin() + iter->size(), iter->bootable(), @@ -237,10 +237,10 @@ { Variable labels("label", String("gpt"), Parted::supported_labels()); props.set(labels); - + // new sources - counting_auto_ptr system = - MapperFactory::get_mapper(MAPPER_SYS_TYPE, + counting_auto_ptr system = + MapperFactory::get_mapper(MAPPER_SYS_TYPE, SYS_PREFIX); for (list >::iterator iter = system->targets.begin(); iter != system->targets.end(); @@ -249,7 +249,7 @@ if (bd->content->type == CONTENT_NONE_TYPE) new_sources.push_back(bd); } - + if (new_sources.empty()) throw String("no available new sources"); props.set(Variable("min_sources", (long long) 1)); --- conga/ricci/modules/storage/PartitionTable.h 2006/08/10 22:53:09 1.3 +++ conga/ricci/modules/storage/PartitionTable.h 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -36,19 +36,19 @@ public: PartitionTable(const String& id); virtual ~PartitionTable(); - + virtual void apply(const MapperParsed&); - + protected: - + virtual void __add_sources(const std::list >& bds); virtual void __remove(); - + private: String _pt_path; String _label; - - + + }; // PartitionTable @@ -58,10 +58,10 @@ public: PTTemplate(); virtual ~PTTemplate(); - + private: - - + + }; --- conga/ricci/modules/storage/Props.cpp 2006/09/26 03:02:57 1.4 +++ conga/ricci/modules/storage/Props.cpp 2007/09/11 02:45:28 1.5 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -32,11 +32,11 @@ Props::Props() {} -Props::Props(const XMLObject& xml) +Props::Props(const XMLObject& xml) { if (xml.tag() != PROPERTIES_TAG) throw String("not properties"); - + for (list::const_iterator iter = xml.children().begin(); iter != xml.children().end(); iter++) { @@ -51,13 +51,13 @@ {} -bool +bool Props::has(const String& name) const { return _vars.find(name) != _vars.end(); } -const Variable +const Variable Props::get(const String& name) const { map::const_iterator iter = _vars.find(name); @@ -78,7 +78,7 @@ if (!c.empty()) if (get(c).type() != Boolean) throw String("non-boolean variable used as bool condition for variable ") + var.name(); - + // insert new variable _set(var); } @@ -92,7 +92,7 @@ i.first->second = var; } -bool +bool Props::is_active(const Variable& var) const { String c(var.get_conditional_bool_if()); @@ -112,7 +112,7 @@ validate(*this); } -void +void Props::validate(const Props& props) const { for (map::const_iterator iter = _vars.begin(); @@ -133,7 +133,7 @@ } -XMLObject +XMLObject Props::xml() const { XMLObject props(PROPERTIES_TAG); --- conga/ricci/modules/storage/Props.h 2006/09/26 03:02:57 1.4 +++ conga/ricci/modules/storage/Props.h 2007/09/11 02:45:28 1.5 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -39,26 +39,26 @@ Props(); Props(const XMLObject&); virtual ~Props(); - + void set(const Variable& var); bool has(const String& name) const; const Variable get(const String& name) const; - + bool is_active(const Variable& var) const; - + void validate() const; void validate(const Props& props) const; // validate props against *this - - + + XMLObject xml() const; - - + + private: - + std::map _vars; - + void _set(const Variable& var); - + }; --- conga/ricci/modules/storage/StorageModule.cpp 2007/06/27 08:14:23 1.7 +++ conga/ricci/modules/storage/StorageModule.cpp 2007/09/11 02:45:28 1.8 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -68,44 +68,44 @@ build_fcn_map() { FcnMap api_1_0; - + api_1_0["report"] = report; - + api_1_0["get_mapper_ids"] = get_mapper_ids; api_1_0["get_mappers"] = get_mappers; - + api_1_0["get_mapper_templates"] = get_mapper_templates; api_1_0["create_mapper"] = create_mapper; api_1_0["modify_mapper"] = modify_mapper; api_1_0["remove_mapper"] = remove_mapper; api_1_0["add_mapper_sources"] = add_sources; api_1_0["remove_mapper_source"] = remove_source; - + api_1_0["create_bd"] = create_bd; api_1_0["get_bd"] = get_bd; api_1_0["modify_bd"] = modify_bd; api_1_0["remove_bd"] = remove_bd; api_1_0["get_fs_group_members"] = get_fs_group_members; - + api_1_0["enable_clustered_lvm"] = enable_clustered_lvm; api_1_0["disable_clustered_lvm"] = disable_clustered_lvm; - - + + ApiFcnMap api_fcn_map; api_fcn_map["1.0"] = api_1_0; - + return api_fcn_map; } -VarMap +VarMap report(const VarMap& args) { Variable ids("mapper_ids", _mapper_ids("")); Variable mappers("mappers", _mappers("", "")); Variable temps("mapper_templates", _mapper_templates("")); - + VarMap ret; ret.insert(pair(ids.name(), ids)); ret.insert(pair(mappers.name(), mappers)); @@ -113,7 +113,7 @@ return ret; } -VarMap +VarMap get_mapper_ids(const VarMap& args) { String mapper_type; @@ -124,14 +124,14 @@ } catch ( String e ) { throw APIerror(e); } - + Variable var("mapper_ids", _mapper_ids(mapper_type)); VarMap ret; ret.insert(pair(var.name(), var)); return ret; } -VarMap +VarMap get_mappers(const VarMap& args) { String mapper_type, mapper_id; @@ -139,21 +139,21 @@ VarMap::const_iterator iter = args.find("mapper_type"); if (iter != args.end()) mapper_type = iter->second.get_string(); - + iter = args.find("mapper_id"); if (iter != args.end()) mapper_id = iter->second.get_string(); } catch ( String e ) { throw APIerror(e); } - + Variable var("mappers", _mappers(mapper_type, mapper_id)); VarMap ret; ret.insert(pair(var.name(), var)); return ret; } -VarMap +VarMap get_mapper_templates(const VarMap& args) { String mapper_type; @@ -164,14 +164,14 @@ } catch ( String e ) { throw APIerror(e); } - + Variable var("mapper_templates", _mapper_templates(mapper_type)); VarMap ret; ret.insert(pair(var.name(), var)); return ret; } -VarMap +VarMap create_mapper(const VarMap& args) { XMLObject mapper_xml; @@ -183,17 +183,17 @@ } catch ( String e ) { throw APIerror(e); } - + MapperTemplate mapper_template(mapper_xml); counting_auto_ptr mapper = MapperFactory::create_mapper(mapper_template); - + Variable var("mapper", mapper->xml()); VarMap ret; ret.insert(pair(var.name(), var)); return ret; } -VarMap +VarMap remove_mapper(const VarMap& args) { XMLObject mapper_xml; @@ -205,15 +205,15 @@ } catch ( String e ) { throw APIerror(e); } - + MapperParsed mapper(mapper_xml); MapperFactory::remove_mapper(mapper); - + VarMap ret; return ret; } -VarMap +VarMap modify_mapper(const VarMap& args) { XMLObject mapper_xml; @@ -225,17 +225,17 @@ } catch ( String e ) { throw APIerror(e); } - + MapperParsed mp(mapper_xml); counting_auto_ptr mapper = MapperFactory::modify_mapper(mp); - + Variable var("mapper", mapper->xml()); VarMap ret; ret.insert(pair(var.name(), var)); return ret; } -VarMap +VarMap add_sources(const VarMap& args) { String mapper_type, mapper_id, mapper_state_ind; @@ -245,17 +245,17 @@ if (iter == args.end()) throw APIerror("missing mapper_type variable"); mapper_type = iter->second.get_string(); - + iter = args.find("mapper_id"); if (iter == args.end()) throw APIerror("missing mapper_id variable"); mapper_id = iter->second.get_string(); - + iter = args.find("mapper_state_ind"); if (iter == args.end()) throw APIerror("missing mapper_state_ind variable"); mapper_state_ind = iter->second.get_string(); - + iter = args.find("bds"); if (iter == args.end()) throw APIerror("missing bds variable"); @@ -263,7 +263,7 @@ } catch ( String e ) { throw APIerror(e); } - + list parsed_bds; for (list::const_iterator iter = bds_list.begin(); iter != bds_list.end(); @@ -273,14 +273,14 @@ mapper_id, mapper_state_ind, parsed_bds); - + Variable var("mapper", mapper->xml()); VarMap ret; ret.insert(pair(var.name(), var)); return ret; } -VarMap +VarMap remove_source(const VarMap& args) { String mapper_type, mapper_id, mapper_state_ind; @@ -290,17 +290,17 @@ if (iter == args.end()) throw APIerror("missing mapper_type variable"); mapper_type = iter->second.get_string(); - + iter = args.find("mapper_id"); if (iter == args.end()) throw APIerror("missing mapper_id variable"); mapper_id = iter->second.get_string(); - + iter = args.find("mapper_state_ind"); if (iter == args.end()) throw APIerror("missing mapper_state_ind variable"); mapper_state_ind = iter->second.get_string(); - + iter = args.find("bd"); if (iter == args.end()) throw APIerror("missing bd variable"); @@ -308,16 +308,16 @@ } catch ( String e ) { throw APIerror(e); } - + throw String("remove_mapper_source() function not implemented"); - + /* BDParsed parsed_bd(bd); counting_auto_ptr mapper = MapperFactory::remove_source(mapper_type, mapper_id, mapper_state_ind, parsed_bd); - + Variable var("mapper", mapper->xml()); VarMap ret; ret.insert(pair(var.name(), var)); @@ -326,7 +326,7 @@ } -VarMap +VarMap create_bd(const VarMap& args) { XMLObject bd_xml; @@ -338,15 +338,15 @@ } catch ( String e ) { throw APIerror(e); } - + // bd BDTemplate bd_template(bd_xml); counting_auto_ptr bd = BDFactory::create_bd(bd_template); - + // mapper counting_auto_ptr mapper = MapperFactory::get_mapper(bd->mapper_type(), bd->mapper_id()); - + Variable var_bd("bd", bd->xml()); Variable var_map("mapper", mapper->xml()); VarMap ret; @@ -355,7 +355,7 @@ return ret; } -VarMap +VarMap get_bd(const VarMap& args) { String path; @@ -367,16 +367,16 @@ } catch ( String e ) { throw APIerror(e); } - + counting_auto_ptr bd = BDFactory::get_bd(path); - + Variable var("bd", bd->xml()); VarMap ret; ret.insert(pair(var.name(), var)); return ret; } -VarMap +VarMap modify_bd(const VarMap& args) { XMLObject bd_xml; @@ -388,17 +388,17 @@ } catch ( String e ) { throw APIerror(e); } - + BDParsed bd_parsed(bd_xml); counting_auto_ptr bd = BDFactory::modify_bd(bd_parsed); - + Variable var("bd", bd->xml()); VarMap ret; ret.insert(pair(var.name(), var)); return ret; } -VarMap +VarMap remove_bd(const VarMap& args) { XMLObject bd_xml; @@ -410,17 +410,17 @@ } catch ( String e ) { throw APIerror(e); } - + BDParsed bd_parsed(bd_xml); counting_auto_ptr mapper = BDFactory::remove_bd(bd_parsed); - + Variable var("mapper", mapper->xml()); VarMap ret; ret.insert(pair(var.name(), var)); return ret; } -VarMap +VarMap get_fs_group_members(const VarMap& args) { String fsname; @@ -452,12 +452,12 @@ } -list +list _mapper_ids(const String& mapper_type) { - + list ids_list; - + list > id_pairs = MapperFactory::get_mapper_ids(mapper_type); for (list >::iterator iter = id_pairs.begin(); iter != id_pairs.end(); @@ -467,56 +467,56 @@ id_xml.set_attr("mapper_id", iter->second); ids_list.push_back(id_xml); } - + return ids_list; } -list +list _mappers(const String& mapper_type, const String& mapper_id) { - + list mapper_list; - - list > mappers = + + list > mappers = MapperFactory::get_mappers(mapper_type, mapper_id); for (list >::iterator iter = mappers.begin(); iter != mappers.end(); iter++) mapper_list.push_back((*iter)->xml()); - + return mapper_list; } -list +list _mapper_templates(const String& mapper_type) { - + list temp_list; - - list > mapper_templates = + + list > mapper_templates = MapperFactory::get_mapper_templates(mapper_type); for (list >::iterator iter = mapper_templates.begin(); iter != mapper_templates.end(); iter++) temp_list.push_back((*iter)->xml()); - + return temp_list; } -VarMap +VarMap enable_clustered_lvm(const VarMap& args) { LVM::enable_clustered(); - + VarMap ret; return ret; } -VarMap +VarMap disable_clustered_lvm(const VarMap& args) { LVM::disable_clustered(); - + VarMap ret; return ret; } --- conga/ricci/modules/storage/StorageModule.h 2006/04/07 16:42:40 1.1 +++ conga/ricci/modules/storage/StorageModule.h 2007/09/11 02:45:28 1.2 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -32,9 +32,9 @@ public: StorageModule(); virtual ~StorageModule(); - + private: - + }; --- conga/ricci/modules/storage/SwapFS.cpp 2007/08/24 22:05:14 1.9 +++ conga/ricci/modules/storage/SwapFS.cpp 2007/09/11 02:45:28 1.10 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -40,7 +40,7 @@ String magic(FileMagic::get_description(path)); if (magic.find("swap") == magic.npos) throw String(path + " not swap"); - + // swapon MountHandler mh; FstabLocker l; @@ -59,44 +59,44 @@ {} -bool +bool SwapFS::expandable(long long& max_size) const { return false; } -bool +bool SwapFS::shrinkable(long long& min_size) const { return false; } -void +void SwapFS::shrink(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props) {} -void +void SwapFS::expand(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props) {} -void +void SwapFS::apply_props_before_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props) { bool fstab_old = _props.get("fstab").get_bool(); bool fstab_new = new_props.get("fstab").get_bool(); bool swapon_old = _props.get("swapon").get_bool(); bool swapon_new = new_props.get("swapon").get_bool(); - + MountHandler mh; FstabLocker lock; - + if (fstab_old && !fstab_new) { list l = mh.fstabs(mh.maj_min(path)); for (list::const_iterator iter = l.begin(); @@ -106,7 +106,7 @@ mh.fstab_remove(iter->devname, iter->mountpoint); } else if (!fstab_old && fstab_new) mh.fstab_add(path, "swap", "swap"); - + if (swapon_old && !swapon_new) { list l = mh.mounts(mh.maj_min(path)); for (list::const_iterator iter = l.begin(); @@ -119,14 +119,14 @@ mh.mount(path, "swap", "swap"); } -void +void SwapFS::apply_props_after_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props) {} -bool +bool SwapFS::removable() const { return true; @@ -134,28 +134,28 @@ -void +void create_swap_fs(const String& path, const counting_auto_ptr& templ) { String label = templ->_props.get("label").get_string(); bool swapon = templ->_props.get("swapon").get_bool(); bool fstab = templ->_props.get("fstab").get_bool(); - + vector args; if (label.size()) { args.push_back("-L"); args.push_back(label); } args.push_back(path); - + String out, err; int status; if (utils::execute("/sbin/mkswap", args, out, err, status)) throw command_not_found_error_msg("mkswap"); if (status != 0) throw String("mkswap failed: ") + err; - + if (swapon) { args.clear(); args.push_back(path); @@ -164,10 +164,10 @@ if (status != 0) throw String("swapon failed: ") + err; } - + if (fstab) { /* - MountHandler().fstab_add(label.empty() ? path : String("LABEL=") + label, + MountHandler().fstab_add(label.empty() ? path : String("LABEL=") + label, "swap", "swap"); */ @@ -180,16 +180,16 @@ ContentFSTemplate(SwapFS::PRETTY_NAME) { // label - _props.set(Variable("label", - "", - 0, - 16, - ILLEGAL_LABEL_CHARS, + _props.set(Variable("label", + "", + 0, + 16, + ILLEGAL_LABEL_CHARS, list())); - + // swapon _props.set(Variable("swapon", true, true)); - + // fstab _props.set(Variable("fstab", true, true)); } --- conga/ricci/modules/storage/SwapFS.h 2006/09/26 03:02:57 1.4 +++ conga/ricci/modules/storage/SwapFS.h 2007/09/11 02:45:28 1.5 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -38,29 +38,29 @@ public: SwapFS(const String& path); virtual ~SwapFS(); - + const static String PRETTY_NAME; - + virtual bool expandable(long long& max_size) const; virtual bool shrinkable(long long& min_size) const; virtual void shrink(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props); virtual void expand(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props); - + virtual void apply_props_before_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props); virtual void apply_props_after_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props); - + virtual bool removable() const; - + }; --- conga/ricci/modules/storage/System.cpp 2007/08/24 22:05:14 1.5 +++ conga/ricci/modules/storage/System.cpp 2007/09/11 02:45:28 1.6 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -48,18 +48,18 @@ { if (_mapper_id != SYS_PREFIX) throw String("invalid mapper_id: " + _mapper_id); - + // parse blockdev vector args; args.push_back("--report"); - + String out, err; int status; if (utils::execute("/sbin/blockdev", args, out, err, status)) throw command_not_found_error_msg("blockdev"); if (status) throw String("blockdev failed: ") + err; - + vector lines = utils::split(out, "\n"); for (vector::iterator iter = lines.begin(); iter != lines.end(); @@ -77,19 +77,19 @@ {} -void +void System::apply(const MapperParsed&) { // nothing to do, for now } -void +void System::__add_sources(const list >& bds) { throw String("System can have no sources"); } -void +void System::__remove() { throw String("System mapper is not removable"); --- conga/ricci/modules/storage/System.h 2006/08/10 22:53:09 1.3 +++ conga/ricci/modules/storage/System.h 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -37,14 +37,14 @@ public: System(const String& id); virtual ~System(); - + virtual void apply(const MapperParsed&); - + protected: - + virtual void __add_sources(const std::list >& bds); virtual void __remove(); - + }; --- conga/ricci/modules/storage/UMountError.h 2006/08/10 22:53:09 1.3 +++ conga/ricci/modules/storage/UMountError.h 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -34,7 +34,7 @@ : Except(3, String("Unmount of ") + mountpoint + " failed") {} virtual ~UMountError() {} - + }; --- conga/ricci/modules/storage/UnsupportedFS.cpp 2006/10/05 16:11:38 1.2 +++ conga/ricci/modules/storage/UnsupportedFS.cpp 2007/09/11 02:45:28 1.3 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -103,12 +103,12 @@ } else if (magic.find("udf") != magic.npos) { _name = "udf"; _module = "udf"; - - - + + + } else throw String("not even an unsupported FS"); - + // mountpoints mount_props_probe(path, _module, _props); } @@ -117,48 +117,48 @@ {} -bool +bool UnsupportedFS::expandable(long long& max_size) const { return false; } -void +void UnsupportedFS::expand(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props) {} -bool +bool UnsupportedFS::shrinkable(long long& min_size) const { return false; } -void +void UnsupportedFS::shrink(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props) {} -void +void UnsupportedFS::apply_props_before_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props) {} -void +void UnsupportedFS::apply_props_after_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props) { // mountpoints mount_props_apply(path, _module, _props, new_props); } -bool +bool UnsupportedFS::removable() const { return true; --- conga/ricci/modules/storage/UnsupportedFS.h 2006/09/26 03:17:41 1.1 +++ conga/ricci/modules/storage/UnsupportedFS.h 2007/09/11 02:45:28 1.2 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -34,30 +34,30 @@ public: UnsupportedFS(const String& path); virtual ~UnsupportedFS(); - - + + virtual bool expandable(long long& max_size) const; virtual bool shrinkable(long long& min_size) const; virtual void shrink(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props); virtual void expand(const String& path, - unsigned long long new_size, + unsigned long long new_size, const Props& new_props); - + virtual void apply_props_before_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props); virtual void apply_props_after_resize(const String& path, - unsigned long long old_size, - unsigned long long new_size, + unsigned long long old_size, + unsigned long long new_size, const Props& new_props); - + virtual bool removable() const; - + private: - + }; --- conga/ricci/modules/storage/VG.cpp 2007/06/25 16:11:30 1.13 +++ conga/ricci/modules/storage/VG.cpp 2007/09/11 02:45:28 1.14 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -39,13 +39,13 @@ -list +list get_VG_ids() { LVM::check_locking(); - + list vgids; - + vector args; args.push_back("vgs"); args.push_back("--noheadings"); @@ -86,9 +86,9 @@ _vgname(id.substr(VG_PREFIX.size())) { LVM::probe_vg(_vgname, _props, sources, targets); - + if (id == VG_PREFIX) { - list > mappers = + list > mappers = MapperFactory::get_mappers(MAPPER_PT_TYPE); for (list >::iterator iter_map = mappers.begin(); iter_map != mappers.end(); @@ -102,14 +102,14 @@ } } } else { - long long size = + long long size = _props.get("extents_total").get_int() * _props.get("extent_size").get_int(); _props.set(Variable("size", size)); - - long long free_size = + + long long free_size = _props.get("extents_free").get_int() * _props.get("extent_size").get_int(); _props.set(Variable("size_free", free_size)); - + bool rem = true; for (list >::const_iterator iter = targets.begin(); iter != targets.end(); @@ -117,7 +117,7 @@ if (!(*iter)->removable()) rem = false; removable(rem); - + // new sources VG unused(VG_PREFIX); for (list >::iterator iter = unused.sources.begin(); @@ -128,22 +128,22 @@ iter != unused.new_sources.end(); iter++) new_sources.push_back(*iter); - - + + // ### new targets ### - + if (free_size == 0) return; - + // new LV counting_auto_ptr new_lv(new LVTemplate(_mapper_id, state_ind())); - - new_lv->props.set(Variable("size", - free_size, - _props.get("extent_size").get_int(), - free_size, + + new_lv->props.set(Variable("size", + free_size, + _props.get("extent_size").get_int(), + free_size, _props.get("extent_size").get_int())); - + list lvnames; for (list >::const_iterator iter = targets.begin(); iter != targets.end(); @@ -153,30 +153,30 @@ } lvnames.push_back("_mlog"); lvnames.push_back("_mimage"); - new_lv->props.set(Variable("lvname", - String("new_lv"), + new_lv->props.set(Variable("lvname", + String("new_lv"), 1, 36, - NAMES_ILLEGAL_CHARS, + NAMES_ILLEGAL_CHARS, lvnames)); - + new_lv->props.set(Variable("vgname", _vgname)); new_lv->props.set(Variable("snapshot", false)); new_lv->props.set(Variable("clustered", _props.get("clustered").get_bool())); new_targets.push_back(new_lv); - + // snapshots counting_auto_ptr new_snap(new LVTemplate(_mapper_id, state_ind())); new_snap->props = new_lv->props; - new_snap->props.set(Variable("lvname", - String("new_snapshot"), + new_snap->props.set(Variable("lvname", + String("new_snapshot"), 1, 36, - NAMES_ILLEGAL_CHARS, + NAMES_ILLEGAL_CHARS, lvnames)); - + new_snap->content->_avail_replacements.clear(); - + new_snap->props.set(Variable("snapshot", true)); list snap_origs; for (list >::const_iterator iter = targets.begin(); @@ -185,7 +185,7 @@ if (!(*iter)->_props.get("snapshot").get_bool()) snap_origs.push_back((*iter)->_props.get("lvname").get_string()); if (snap_origs.size()) { - new_snap->props.set(Variable("snapshot_origin", + new_snap->props.set(Variable("snapshot_origin", snap_origs.front(), snap_origs)); new_targets.push_back(new_snap); @@ -197,11 +197,11 @@ {} -void +void VG::apply(const MapperParsed& mp) { String vgname(mp.props.get("vgname").get_string()); - + // clustered bool clustered_old = _props.get("clustered").get_bool(); bool clustered_new = mp.props.get("clustered").get_bool(); @@ -209,22 +209,22 @@ LVM::vgchange(vgname, clustered_new); } -void +void VG::__add_sources(const list >& bds) { // if VG is marked as clustered, but cluster locking is not available, throw if (_props.get("clustered").get_bool() && !LVM::clustered_enabled()) throw LVMClusterLockingError(); - + String vgname; try { vgname = _props.get("vgname").get_string(); } catch ( ... ) {} - + try { utils::clear_cache(); - + list pv_paths; for (list >::const_iterator iter = bds.begin(); iter != bds.end(); @@ -235,11 +235,11 @@ if (bd->content->type == CONTENT_NONE_TYPE) LVM::pvcreate(bd->path()); } - + // extend VG, if not unused PVs holder if (vgname.size()) LVM::vgextend(vgname, pv_paths); - + } catch ( ... ) { for (list >::const_iterator iter = bds.begin(); iter != bds.end(); @@ -254,14 +254,14 @@ } } -void +void VG::__remove() { // if VG is marked as clustered, but cluster locking is not available, throw if (_props.get("clustered").get_bool() && !LVM::clustered_enabled()) throw LVMClusterLockingError(); - + String vgname = _props.get("vgname").get_string(); LVM::vgremove(vgname); for (list >::const_iterator iter = sources.begin(); @@ -273,24 +273,24 @@ -counting_auto_ptr +counting_auto_ptr create_VG(const MapperTemplate& temp) { // everything is already validated, but number of sources if (temp.sources.size() == 0) throw String("create_VG requires at least one source"); - + String vgname = temp.props.get("vgname").get_string(); long long extent_size = temp.props.get("extent_size").get_int(); bool clustered = temp.props.get("clustered").get_bool(); - + if (clustered && !LVM::clustered_enabled()) throw LVMClusterLockingError(); - + try { utils::clear_cache(); - + list pv_paths; for (list >::const_iterator iter = temp.sources.begin(); iter != temp.sources.end(); @@ -301,7 +301,7 @@ if (bd->content->type == CONTENT_NONE_TYPE) LVM::pvcreate(bd->path()); } - + // create VG LVM::vgcreate(vgname, extent_size, clustered, pv_paths); } catch ( ... ) { @@ -316,7 +316,7 @@ } throw; } - + return counting_auto_ptr(new VG(VG_PREFIX + vgname)); } @@ -337,21 +337,21 @@ if (!vgname.empty()) vgnames.push_back(vgname); } - Variable vgname("vgname", - String("new_vg"), + Variable vgname("vgname", + String("new_vg"), 1, 36, - NAMES_ILLEGAL_CHARS, + NAMES_ILLEGAL_CHARS, vgnames); props.set(vgname); - + // extent_size list ext_sizes; for (long long i = 8 * 1024 /* 8KB */; i <= 16LL * 1024 * 1024 * 1024 /* 16 GB */; i = 2L * i) ext_sizes.push_back(i); - props.set(Variable("extent_size", + props.set(Variable("extent_size", 4 * 1024 * 1024 /* 4 MB */, ext_sizes)); @@ -373,7 +373,7 @@ iter != unused.new_sources.end(); iter++) new_sources.push_back(*iter); - + if (new_sources.empty()) throw String("no available new sources"); props.set(Variable("min_sources", (long long) 1)); --- conga/ricci/modules/storage/VG.h 2006/08/10 22:53:09 1.3 +++ conga/ricci/modules/storage/VG.h 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -38,19 +38,19 @@ public: VG(const String& id); virtual ~VG(); - + virtual void apply(const MapperParsed&); - + protected: - + virtual void __add_sources(const std::list >& bds); virtual void __remove(); - + private: - + String _vgname; - - + + }; // VG @@ -59,10 +59,10 @@ public: VGTemplate(); virtual ~VGTemplate(); - + private: - - + + }; --- conga/ricci/modules/storage/ValidationError.h 2006/04/07 16:42:40 1.2 +++ conga/ricci/modules/storage/ValidationError.h 2007/09/11 02:45:28 1.3 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -30,11 +30,11 @@ class ValidationError : public Except { public: - ValidationError() + ValidationError() : Except(2, "Validation error") {} virtual ~ValidationError() {} - + }; --- conga/ricci/modules/storage/defines.h 2007/03/20 15:35:59 1.7 +++ conga/ricci/modules/storage/defines.h 2007/09/11 02:45:28 1.8 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* --- conga/ricci/modules/storage/gfs_ondisk.h 2006/09/26 03:17:41 1.1 +++ conga/ricci/modules/storage/gfs_ondisk.h 2007/09/11 02:45:28 1.2 @@ -39,7 +39,7 @@ * metadata. Each RG has its own set of block allocation statistics (within * the RG header), a number of blocks containing the block allocation bitmap, * and a large number of allocatable blocks for file data and metadata. - * Multiple RGs allow multiple nodes to simultaneously allocate blocks from the + * Multiple RGs allow multiple nodes to simultaneously allocate blocks from the * filesystem (using different RGs), enhancing parallel access. RG size and * number of RGs are determined by gfs_mkfs when creating the filesystem. * An administrator can specify RG size (see man gfs_mkfs). @@ -81,7 +81,7 @@ * All structures must be a multiple of 8 bytes long. * * GRIPES: - * We should have forgetten about supporting 512B FS block sizes + * We should have forgetten about supporting 512B FS block sizes * and made the di_reserved field in the struct gfs_dinode structure * much bigger. * @@ -261,7 +261,7 @@ }; /* - * journal index structure + * journal index structure * * One for each journal used by the filesystem. * These descriptors are packed contiguously within the jindex inode (file). @@ -276,7 +276,7 @@ }; /* - * resource index structure + * resource index structure * * One of these for each resource group in the filesystem. * These descriptors are packed contiguously within the rindex inode (file). @@ -306,7 +306,7 @@ * and first part of block alloc bitmap. * Bitmap block(s), continuing block alloc bitmap started in header block. * Data/meta blocks, allocatable blocks containing file data and metadata. - * + * * In older versions, now-unused (but previously allocated) dinodes were * saved for re-use in an on-disk linked list (chain). This is no longer * done, but support still exists for reclaiming dinodes from this list, --- conga/ricci/modules/storage/main.cpp 2006/08/15 04:15:54 1.4 +++ conga/ricci/modules/storage/main.cpp 2007/09/11 02:45:28 1.5 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* --- conga/ricci/modules/storage/mdadm_wrapper.cpp 2006/10/06 03:10:13 1.5 +++ conga/ricci/modules/storage/mdadm_wrapper.cpp 2007/09/11 02:45:28 1.6 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -51,7 +51,7 @@ -std::list +std::list mdadm::valid_raid_levels() { list levels; @@ -70,11 +70,11 @@ return probe_raids(); } -mdraid +mdraid mdadm::probe_path(const String& path) { list raids = mdadm::raids(); - + for (list::const_iterator iter = raids.begin(); iter != raids.end(); iter++) { @@ -88,12 +88,12 @@ if (iter->path == path) return *iter; } - + throw String("not mdraid path"); } -void +void mdadm::remove_source(const String& raid_path, const String& path) { @@ -108,11 +108,11 @@ if (status) throw String("mdadm failed"); utils::clear_cache(); - + zero_superblock(path); } -void +void mdadm::zero_superblock(const String& path) { String out, err; @@ -127,7 +127,7 @@ utils::clear_cache(); } -void +void mdadm::add_source(const String& raid_path, const String& path) { @@ -143,8 +143,8 @@ throw String("mdadm failed"); utils::clear_cache(); } - -void + +void mdadm::fail_source(const String& raid_path, const String& path) { @@ -161,7 +161,7 @@ utils::clear_cache(); } -void +void mdadm::start_raid(const mdraid& raid) { vector args; @@ -180,7 +180,7 @@ utils::clear_cache(); } -void +void mdadm::stop_raid(const mdraid& raid) { vector args; @@ -195,13 +195,13 @@ utils::clear_cache(); } -String +String mdadm::create_raid(const String& level, const list& dev_paths) { String md_path_templ = "/dev/md"; String new_md_path = md_path_templ; - + list raids = mdadm::raids(); for (long long i=1; i<30; i++) { String tmp_path = md_path_templ + utils::to_string(i); @@ -218,16 +218,16 @@ } if (new_md_path == md_path_templ) throw String("no more raid devices allowed"); - + list::size_type raid_devices = 3; if (level == "raid1") raid_devices = 2; else if (level == "raid5") raid_devices = 3; - else + else throw String("unsupported raid level"); raid_devices = (raid_devices < dev_paths.size()) ? dev_paths.size() : raid_devices; - + vector args; args.push_back("--create"); args.push_back(new_md_path); @@ -243,7 +243,7 @@ i < raid_devices - dev_paths.size(); i++) args.push_back("missing"); - + String out, err; int status; if (utils::execute(MDADM_BIN_PATH, args, out, err, status)) @@ -251,7 +251,7 @@ if (status) throw String("mdadm failed"); utils::clear_cache(); - + return new_md_path; } @@ -274,14 +274,14 @@ throw command_not_found_error_msg(MDADM_BIN_PATH); if (status) throw String("mdadm failed"); - + // remove '\n' String::size_type i = 0; while ((i = out.find('\n', i)) != out.npos) out.replace(i, 1, " "); - + list raids; - + vector words = utils::split(utils::strip(out)); for (vector::iterator iter = words.begin(); iter != words.end(); @@ -295,7 +295,7 @@ if (raids.empty()) continue; mdraid& raid = raids.back(); - + if ((*iter)[0] == '/') raid.path = *iter; else if (iter->find("level=") == 0) @@ -310,38 +310,38 @@ raid.devices = probe_sources(devs); } } - + for (list::iterator iter = raids.begin(); iter != raids.end(); iter++) { String path = iter->path; iter->name = path.replace(0, String("/dev/").size(), ""); } - + return raids; } -list +list probe_sources(vector paths) { list devs; - + String date("0000"); list probed_sources; - + for (vector::const_iterator iter = paths.begin(); iter != paths.end(); iter++) { - pair > tmp = + pair > tmp = probe_source(*iter); if (tmp.first > date) { date = tmp.first; probed_sources = tmp.second; } } - + for (vector::const_iterator path_iter = paths.begin(); path_iter != paths.end(); path_iter++) { @@ -356,7 +356,7 @@ if (!path_found) devs.push_back(mdraid_source(*path_iter, MDRAID_S_FAILED)); } - + return devs; } @@ -372,11 +372,11 @@ throw command_not_found_error_msg(MDADM_BIN_PATH); if (status) throw String("mdadm failed"); - - + + String update_time; list devs; - + bool devs_section = false; vector lines = utils::split(utils::strip(out), "\n"); for (vector::iterator iter = lines.begin(); @@ -386,7 +386,7 @@ vector words = utils::split(utils::strip(line)); if (words.empty()) continue; - + if (devs_section) { if (line.find("active") != line.npos) devs.push_back(mdraid_source(words.back(), MDRAID_S_ACTIVE)); @@ -397,7 +397,7 @@ devs_section = true; continue; } - + if (words.size() < 8) continue; if (words[0] == "Update" && words[1] == "Time") { @@ -405,7 +405,7 @@ String day = words[5]; String time = words[6]; String year = words[7]; - + if (month == "Jan") month = "01"; else if (month == "Feb") month = "02"; else if (month == "Mar") month = "03"; @@ -418,10 +418,10 @@ else if (month == "Oct") month = "10"; else if (month == "Nov") month = "11"; else month = "12"; - + if (day.size() == 1) day = "0" + day; - + vector time_words = utils::split(time, ":"); if (time_words.size() != 3) throw String("invalid mdadm output"); @@ -429,12 +429,12 @@ if (time_words[1].size() == 1) time_words[1] = "0" + time_words[1]; if (time_words[2].size() == 1) time_words[2] = "0" + time_words[2]; time = time_words[0] + time_words[1] + time_words[2]; - + update_time = year + " " + month + " " + day + " " + time; - } + } } - - + + return pair >(update_time, devs); } --- conga/ricci/modules/storage/mdadm_wrapper.h 2006/08/10 22:53:09 1.3 +++ conga/ricci/modules/storage/mdadm_wrapper.h 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -29,8 +29,8 @@ #include -enum mdraid_source_type { MDRAID_S_ACTIVE, - MDRAID_S_SPARE, +enum mdraid_source_type { MDRAID_S_ACTIVE, + MDRAID_S_SPARE, MDRAID_S_FAILED}; @@ -39,10 +39,10 @@ public: mdraid_source(const String& path, mdraid_source_type type); - + String path; mdraid_source_type type; - + }; @@ -51,16 +51,16 @@ { public: mdraid(); - + String path; String name; - + String level; String uuid; long long num_devices; - + std::list devices; - + }; @@ -68,12 +68,12 @@ class mdadm { public: - + static std::list valid_raid_levels(); - + static std::list raids(); static mdraid probe_path(const String& path); - + static void add_source(const String& raid_path, const String& path); static void fail_source(const String& raid_path, @@ -81,15 +81,15 @@ static void remove_source(const String& raid_path, const String& path); static void zero_superblock(const String& path); - - + + static void start_raid(const mdraid& raid); static void stop_raid(const mdraid& raid); - + static String create_raid(const String& level, const std::list& dev_paths); - - + + }; // class mdadm --- conga/ricci/modules/storage/parted_wrapper.cpp 2007/06/25 16:11:30 1.11 +++ conga/ricci/modules/storage/parted_wrapper.cpp 2007/09/11 02:45:28 1.12 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -45,7 +45,7 @@ plain_partitions(const String& path, String& label, long long& disk_size); -static void +static void __create_label(const String& path, const String& label); static long long parted_size_to_bytes(const String& size_str); @@ -53,11 +53,11 @@ -PartedPartition::PartedPartition(int partnum, - long long beg, - long long end, - bool bootable, - PPType type, +PartedPartition::PartedPartition(int partnum, + long long beg, + long long end, + bool bootable, + PPType type, const String& label) : _partnum(partnum), _beg(beg), @@ -67,9 +67,9 @@ _label(label) {} -PartedPartition::PartedPartition(long long beg, - long long end, - PPType available_types, +PartedPartition::PartedPartition(long long beg, + long long end, + PPType available_types, const String& label) : _beg(beg), _end(end), @@ -82,19 +82,19 @@ {} -long long +long long PartedPartition::size() const { return _end - _beg; } -long long +long long PartedPartition::begin() const { return _beg; } -int +int PartedPartition::partnum() const { if (unused_space()) @@ -102,13 +102,13 @@ return _partnum; } -bool +bool PartedPartition::bootable() const { return _bootable; } -String +String PartedPartition::type() const { switch (_type) { @@ -124,37 +124,37 @@ throw String("invalid partition type"); } -String +String PartedPartition::label() const { return _label; } -bool +bool PartedPartition::unused_space() const { return _type & PPTunused; } -bool +bool PartedPartition::primary() const { return _type & PPTprimary; } -bool +bool PartedPartition::extended() const { return _type & PPTextended; } -bool +bool PartedPartition::logical() const { return _type & PPTlogical; } -void +void PartedPartition::add_kid(const PartedPartition& part) { if (extended() && part.logical()) { @@ -164,38 +164,38 @@ throw String("PartedPartition.add_kid() error"); } -const list& +const list& PartedPartition::kids() const { return _kids; } -list& +list& PartedPartition::kids() { return _kids; } -bool +bool PartedPartition::operator<(const PartedPartition& p2) const { return _beg < p2._beg; } -void +void PartedPartition::print(const String& indent) const { cout << indent << "num" << (unused_space()) ? 100000LL : partnum(); cout << " beg" << begin(); cout << " size" << size(); cout << " boot" << bootable(); - + String t = "selection"; try { t = type(); } catch ( ... ) {} cout << " " << t; - + cout << " used" << !unused_space() << endl; for (list::const_iterator iter = _kids.begin(); iter != _kids.end(); @@ -210,21 +210,21 @@ // ##### Parted ##### -String +String Parted::extract_pt_path(const String& path) { if (path.find("/dev/cciss/") != path.npos) { unsigned int p_pos = path.find("p"); return path.substr(0, p_pos); } - + unsigned int i = path.size() - 1; for (; isdigit(path[i]); i--) ; return path.substr(0, i+1); } -String +String Parted::generate_part_path(const String& pt_path, const PartedPartition& part) { if (part.unused_space()) @@ -263,7 +263,7 @@ list parts; label = ""; disk_size = 0; - + String parted_output = utils::strip(__probe_pt_execute(path)); vector lines = utils::split(parted_output, "\n"); for (vector::const_iterator iter = lines.begin(); @@ -272,23 +272,23 @@ vector words = utils::split(utils::strip(*iter)); if (words.size() < 3) continue; - + // label if ((words[0] == "Disk" && words[1] == "label" && words[2] == "type:") || (words[0] == "Partition" && words[1] == "Table:")) { label = words.back(); continue; } - + // disk size if (words[0] == "Disk" && words[1] == (path + ":")) { disk_size = parted_size_to_bytes(words[2]); continue; } if (words.size() > 4) { - if (words[0] == "Disk" && - words[1] == "geometry" && - words[2] == "for" && + if (words[0] == "Disk" && + words[1] == "geometry" && + words[2] == "for" && words[3] == (path + ":")) { String s = words[4]; String::size_type idx = s.find("-"); @@ -300,7 +300,7 @@ continue; } } - + // partition if (!isdigit(words[0][0])) continue; @@ -321,19 +321,19 @@ else if (*word_iter == "logical") type = PPTlogical; } - parts.push_back(PartedPartition(partnum, - beg, - end, - bootable, - type, + parts.push_back(PartedPartition(partnum, + beg, + end, + bootable, + type, label)); } - + if (label.empty() || label == "loop") throw String("not a partition table"); if (disk_size == 0) throw String("disk_size == 0???"); - + return parts; } @@ -348,9 +348,9 @@ String label; long long disk_size; list parts = plain_partitions(path, label, disk_size); - + int primary_count = 0; - + // put logical into extended PartedPartition extended(0, 0, PPTunused, label); for (list::const_iterator iter = parts.begin(); @@ -373,7 +373,7 @@ if (!extended.unused_space()) sorted.push_back(extended); sorted.sort(); - + /* cout << "\n\npt_path " << path << endl; for (list::const_iterator iter = sorted.begin(); @@ -381,7 +381,7 @@ iter++) iter->print("\t"); */ - + // fill gaps bool more_primaries = false; if (label == "gpt" || @@ -398,11 +398,11 @@ } fill_gaps(types, label, - min_part_size(label), - sorted, - 0, + min_part_size(label), + sorted, + 0, disk_size); - + /* cout << "\n\npt_path " << path << endl; for (list::const_iterator iter = sorted.begin(); @@ -410,12 +410,12 @@ iter++) iter->print("\t"); */ - + return pair >(label, sorted); } void -fill_gaps(int types, +fill_gaps(int types, const String& label, long long min_part_size, list& parts, @@ -426,31 +426,31 @@ list::iterator iter = parts.begin(); while (current < end) { if (iter == parts.end()) { - PartedPartition n(current, - end, - PPType(types), + PartedPartition n(current, + end, + PPType(types), label); if (n.size() >= min_part_size) parts.insert(iter, n); current = n.begin() + n.size(); continue; } - + if (iter->extended()) fill_gaps(PPTlogical, label, min_part_size, - iter->kids(), - iter->begin(), + iter->kids(), + iter->begin(), iter->begin() + iter->size()); - + if (iter->begin() <= current) { current = iter->begin() + iter->size(); iter++; } else { - PartedPartition n(current, - iter->begin(), - PPType(types), + PartedPartition n(current, + iter->begin(), + PPType(types), label); if (n.size() > min_part_size) parts.insert(iter, n); @@ -470,11 +470,11 @@ -std::list +std::list Parted::possible_paths() { list hds; - + // parse blockdev vector args; args.push_back("--report"); @@ -492,16 +492,16 @@ if (words.size() != 7 || words[0] == "RO") continue; String path = words[6]; - + if (path == Parted::extract_pt_path(path)) hds.push_back(path); } - + return hds; } -std::list +std::list Parted::supported_labels() { list labels; @@ -512,21 +512,21 @@ labels.push_back("msdos"); // labels.push_back("pc98"); // labels.push_back("sun"); - + return labels; } -void +void __create_label(const String& path, const String& label) { if (Parted::extract_pt_path(path) != path) throw String("partition table on partition??? Not for now :("); - + list labels = Parted::supported_labels(); if (find(labels.begin(), labels.end(), label) == labels.end()) throw String("unsuported label type"); - + // create label vector args; args.push_back("-s"); @@ -541,7 +541,7 @@ throw String("parted failed"); } -void +void Parted::create_label(const String& path, const String& label) { // don't overwrite existing label @@ -552,16 +552,16 @@ } catch ( ... ) {} if (in_use) throw String(path + " already has a partition table"); - + // create label __create_label(path, label); } -void +void Parted::remove_label(const String& path) -{ +{ __create_label(path, "msdos"); - + vector args; String out, err; int status; @@ -578,7 +578,7 @@ } -long long +long long Parted::min_part_size(const String& label) { return 2 * 1024 * 1024; // 2 MB // FIXME @@ -586,7 +586,7 @@ -String +String Parted::create_partition(const String& pt_path, const String& part_type, long long seg_begin, @@ -595,11 +595,11 @@ String aaa; long long bbb; list parts = plain_partitions(pt_path, aaa, bbb); - + // parted defines 1KB as 1000 bytes seg_begin = seg_begin / 1000 / 1000; long long seg_end = seg_begin + size / 1000 / 1000; - + vector args; args.push_back("-s"); args.push_back(pt_path); @@ -613,9 +613,9 @@ throw command_not_found_error_msg(PARTED_BIN_PATH); if (status) throw String("parted failed"); - + utils::clear_cache(); - + // find new partnum list new_parts = plain_partitions(pt_path, aaa, bbb); for (list::const_iterator iter_n = new_parts.begin(); @@ -623,7 +623,7 @@ iter_n++) { if (iter_n->unused_space()) continue; - + bool new_part = true; for (list::const_iterator iter_o = parts.begin(); iter_o != parts.end(); @@ -633,11 +633,11 @@ if (iter_n->partnum() == iter_o->partnum()) new_part = false; } - + if (new_part) return generate_part_path(pt_path, *iter_n); } - + throw String("partition creation failed"); } @@ -656,7 +656,7 @@ throw command_not_found_error_msg(PARTED_BIN_PATH); if (status) throw String("parted failed"); - + utils::clear_cache(); } @@ -682,6 +682,6 @@ else if (s[s.size()-2] == 't') multiplier = (long long) 1000 * 1000 * 1000 * 1000; } - + return (long long) utils::to_float(s) * multiplier; } --- conga/ricci/modules/storage/parted_wrapper.h 2006/08/10 22:53:09 1.3 +++ conga/ricci/modules/storage/parted_wrapper.h 2007/09/11 02:45:28 1.4 @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -30,52 +30,52 @@ enum PPType {PPTprimary = 1, PPTextended = 2, - PPTlogical = 4, + PPTlogical = 4, PPTunused = 8}; class PartedPartition { public: - PartedPartition(int partnum, - long long beg, - long long end, - bool bootable, + PartedPartition(int partnum, + long long beg, + long long end, + bool bootable, PPType type, const String& label); // unused - PartedPartition(long long beg, - long long end, + PartedPartition(long long beg, + long long end, PPType available_types, const String& label); virtual ~PartedPartition(); - + long long begin() const; long long size() const; int partnum() const; bool bootable() const; - + String type() const; String label() const; - + bool unused_space() const; - + // if unused(), possible part types bool primary() const; bool extended() const; bool logical() const; - + void add_kid(const PartedPartition& part); std::list& kids(); const std::list& kids() const; - - + + bool operator<(const PartedPartition&) const; - - + + void print(const String& indent) const; - - + + private: int _partnum; long long _beg; @@ -83,9 +83,9 @@ bool _bootable; PPType _type; String _label; - + std::list _kids; - + }; // class PartedPartition @@ -93,34 +93,34 @@ class Parted { public: - + static String extract_pt_path(const String& path); - static String generate_part_path(const String& pt_path, + static String generate_part_path(const String& pt_path, const PartedPartition& part); - + static std::list possible_paths(); - + static std::list supported_labels(); - + static long long min_part_size(const String& label); - - - static std::pair > + + + static std::pair > partitions(const String& pt_path); - + static void create_label(const String& path, const String& label); static void remove_label(const String& path); - + // return path of new partition - static String create_partition(const String& pt_path, - const String& part_type, - long long seg_begin, + static String create_partition(const String& pt_path, + const String& part_type, + long long seg_begin, long long size); - + static void remove_partition(const String& pt_path, const PartedPartition& partition); - - + + }; // class Parted --- conga/ricci/ricci/main.cpp 2007/08/30 17:07:14 1.5 +++ conga/ricci/ricci/main.cpp 2007/09/11 02:45:28 1.6 @@ -54,7 +54,7 @@ case 'c': advertise_cluster = true; break; - + case 'd': debug = true; break; @@ -67,7 +67,7 @@ if (optarg != NULL) { uint32_t port; char *e = NULL; - + port = strtoul(optarg, &e, 10); if (*e != '\0' || !port || (port & 0xffff) != port) { fprintf(stderr, "Invalid port: %s\n", optarg); --- conga/ricci/test/PropsObject.py 2006/03/13 20:48:27 1.1 +++ conga/ricci/test/PropsObject.py 2007/09/11 02:45:29 1.2 @@ -7,11 +7,11 @@ class PropsObject: - + def __init__(self): self.__vars = {} return - + def add_prop(self, variable): self.__vars[variable.get_name()] = variable def get_prop(self, name): @@ -20,17 +20,17 @@ else: return None pass - + def get_props(self): return self.__vars - + def export_xml(self, doc, parent_node): props = doc.createElement(str(PROPS_TAG)) parent_node.appendChild(props) for var in self.__vars: props.appendChild(self.__vars[var].export_xml(doc)) return props - + def import_xml(self, parent_node): props = None for node in parent_node.childNodes: @@ -46,4 +46,4 @@ except: continue return self - + --- conga/ricci/test/Variable.py 2006/06/28 20:20:20 1.3 +++ conga/ricci/test/Variable.py 2007/09/11 02:45:29 1.4 @@ -10,7 +10,7 @@ raise 'not a variable' if node.nodeName != str(VARIABLE_TAG): raise 'not a variable' - + attrs_dir = {} attrs = node.attributes for attrName in attrs.keys(): @@ -21,12 +21,12 @@ raise 'incomplete variable' if (attrs_dir['type'] != VARIABLE_TYPE_LIST_INT and attrs_dir['type'] != VARIABLE_TYPE_LIST_STR and attrs_dir['type'] != VARIABLE_TYPE_LIST_XML and attrs_dir['type'] != VARIABLE_TYPE_XML) and ('value' not in attrs_dir): raise 'incomplete variable' - + mods = {} for mod in attrs_dir: if mod not in ['name', 'value', 'type']: mods[mod] = attrs_dir[mod] - + value = '' if attrs_dir['type'] == VARIABLE_TYPE_LIST_STR: value = [] @@ -74,37 +74,37 @@ value = (attrs_dir['value'] == 'true') else: raise 'invalid variable' - + return Variable(attrs_dir['name'], value, mods) class Variable: - + def __init__(self, name, value, mods={}): self.__name = str(name) self.__mods = mods self.set_value(value) return - + def get_name(self): return self.__name - + def get_value(self): return self.__value def set_value(self, value): if self.__is_bool(value): self.__type = VARIABLE_TYPE_BOOL self.__value = value - + elif self.__is_int(value): self.__type = VARIABLE_TYPE_INT self.__value = int(value) - + elif self.__is_float(value): self.__type = VARIABLE_TYPE_FLOAT self.__value = float(value) - + elif self.__is_list(value): raise "lists not implemented" if self.__is_int(value[0]): @@ -118,11 +118,11 @@ elif self.__is_xml(value): self.__type = VARIABLE_TYPE_XML self.__value = value - + else: self.__value = str(value) self.__type = VARIABLE_TYPE_STRING - + def type(self): if 'valid_values' in self.__mods: if self.__type == VARIABLE_TYPE_INT: @@ -130,13 +130,13 @@ elif self.__type == VARIABLE_TYPE_STRING: return VARIABLE_TYPE_STRING_SEL return self.__type - + def get_modifiers(self): return self.__mods def set_modifier(self, mod_name, mod_value): self.__mods[mod_name] = mod_value return - + def export_xml(self, doc): elem = doc.createElement(VARIABLE_TAG) elem.setAttribute('name', self.__name) @@ -182,10 +182,10 @@ return VARIABLE_TYPE_XML else: return VARIABLE_TYPE_STRING - - - - + + + + def __is_xml(self, value): try: value.toxml() @@ -224,10 +224,10 @@ except: pass return False - - + + class VariableList(Variable): - + def __init__(self, name, value, mods, list_type): if list_type != VARIABLE_TYPE_LIST_STR and list_type != VARIABLE_TYPE_LIST_XML: raise 'invalid list type' @@ -238,29 +238,29 @@ self.__type = list_type self.__value = value pass - + def get_name(self): return self.__name - + def get_value(self): return self.__value def set_value(self, value): raise 'VariableList.set_value() not implemented' - + def type(self): return self.__type - + def get_modifiers(self): return self.__mods def set_modifier(self, mod_name, mod_value): self.__mods[mod_name] = mod_value return - + def export_xml(self, doc): elem = doc.createElement(VARIABLE_TAG) elem.setAttribute('name', self.__name) elem.setAttribute('type', self.type()) - + for x in self.get_value(): if self.type() == VARIABLE_TYPE_LIST_XML: elem.appendChild(x) @@ -271,6 +271,6 @@ for mod in self.__mods: elem.setAttribute(str(mod), str(self.__mods[mod])) return elem - - - + + + --- conga/ricci/test/add_sources_renderer.py 2006/06/28 20:20:20 1.3 +++ conga/ricci/test/add_sources_renderer.py 2007/09/11 02:45:29 1.4 @@ -30,50 +30,50 @@ return 'missing mapper_state_ind parameter' if 'new_sources_xml' not in params: return 'missing targets_xml parameter' - + xml_buff = params['new_sources_xml'].replace(PARENTH_SIG, '"') new_sources_node = minidom.parseString(xml_buff).firstChild - + hostname = params['hostname'] mapper_type = params['mapper_type'] mapper_id = params['mapper_id'] mapper_state_ind = params['mapper_state_ind'] - + buff = '

                                                      "Add Sources to Mapper" Dialog
                                                      ' buff += 'Mapper Type: "' + mapper_type + '"
                                                      ' buff += 'Mapper ID: "' + mapper_id + '"

                                                      ' - + buff += new_sources_node.toxml() - - + + ### sources ### - + buff += '
                                                      ' buff += '' buff += '' buff += '' buff += '' buff += '' - + buff += 'Select BDs to add to mapper:

                                                      ' - + for node in new_sources_node.childNodes: if node.nodeType == xml.dom.Node.ELEMENT_NODE: if node.nodeName == BD_TYPE: name = SOURCE_XML_NODE_SIG name += node.toxml().replace('"', PARENTH_SIG) props = PropsObject().import_xml(node) - + buff += ' ' - + buff += node.getAttribute("path") buff += ', provided by mapper "' + node.getAttribute('mapper_id') + '" ' buff += '\n\tProperties:\n' - + buff += render_props(props, '\t\t') - + buff += '\n' - + buff += '' buff += '


                                                      ' return buff @@ -91,17 +91,17 @@ return 'missing mapper_id parameter' if 'mapper_state_ind' not in params: return 'missing mapper_state_ind parameter' - - + + hostname = params['hostname'] mapper_type = params['mapper_type'] mapper_id = params['mapper_id'] mapper_state_ind = params['mapper_state_ind'] - + buff = '

                                                      Adding New Sources to
                                                      ' buff += 'Mapper Type: "' + mapper_type + '"
                                                      ' buff += 'Mapper ID: "' + mapper_id + '"

                                                      ' - + sources = [] for name in params: if name.startswith(SOURCE_XML_NODE_SIG): @@ -110,11 +110,11 @@ bd_node = minidom.parseString(xml_buff).firstChild sources.append(bd_node) # - - - + + + ### prepare request ### - + doc = minidom.Document() req = doc.createElement("request") req.setAttribute("sequence", str(1254)) @@ -127,9 +127,9 @@ func.appendChild(Variable('mapper_state_ind', mapper_state_ind).export_xml(doc)) func.appendChild(VariableList("bds", sources, {}, VARIABLE_TYPE_LIST_XML).export_xml(doc)) req.appendChild(func) - + ### submit request ### - + com = Communicator(params['hostname']) ret = None try: @@ -138,10 +138,10 @@ return 'failure communicating to ' + params['hostname'] if ret == None: return 'failure communicating to ' + params['hostname'] - + #print doc.toprettyxml() #print ret.toxml() - + # response resp_node = None for node in ret.childNodes: @@ -150,7 +150,7 @@ resp_node = node if resp_node == None: return 'failure communicating to ' + params['hostname'] - + # function func_node = None for node in resp_node.childNodes: @@ -159,7 +159,7 @@ func_node = node if func_node == None: return 'failure communicating to ' + params['hostname'] - + vars = {} for var_node in func_node.childNodes: try: @@ -178,8 +178,8 @@ else: ### SUCCESS ### buff += '

                                                      SUCCESS

                                                      ' - - + + buff += render_mapper(vars['mapper'].get_value(), hostname) - + return buff --- conga/ricci/test/auth_page.py 2006/03/23 17:12:09 1.2 +++ conga/ricci/test/auth_page.py 2007/09/11 02:45:29 1.3 @@ -11,21 +11,21 @@ def auth_page(params): if 'hostname' not in params: return host_selection(params) - + hostname = params['hostname'] already_entered = False if 'already_entered' in params: already_entered = (params['already_entered'] == 'true') pass - + comm = Communicator(hostname) - + authed = False try: authed = comm.auth_check() except: return 'There is no ricci running on ' + hostname - + if authed: p2 = {} p2['hostname'] = hostname @@ -35,10 +35,10 @@ buff = '

                                                      Authentication to \'' buff += hostname buff += '\' required

                                                      ' - + if already_entered: buff += '

                                                      Invalid password, try again


                                                      ' - + buff += '
                                                      ' buff += '' buff += '' @@ -46,7 +46,7 @@ buff += '

                                                      ' buff += '' buff += '
                                                      ' - + return buff pass @@ -60,17 +60,17 @@ p2['already_entered'] = 'true' #return 'missing password parameter' return auth_page(p2) - + hostname = params['hostname'] password = params['password'] - + comm = Communicator(hostname) - + try: comm.authenticate(password) except: return 'There is no ricci running on ' + hostname - + p2 = {} p2['hostname'] = hostname p2['already_entered'] = 'true' --- conga/ricci/test/bd_remove_renderer.py 2006/04/07 16:42:40 1.2 +++ conga/ricci/test/bd_remove_renderer.py 2007/09/11 02:45:29 1.3 @@ -19,29 +19,29 @@ return 'missing hostname parameter' if 'bd_xml' not in params: return 'missing bd_xml parameter' - + hostname = params['hostname'] indent = '\t' #indent = ' ' - + xml_buff = params['bd_xml'].replace(PARENTH_SIG, '"') bd_node = minidom.parseString(xml_buff).firstChild - - + + path = bd_node.getAttribute('path') state_ind = bd_node.getAttribute('state_ind') mapper_type = bd_node.getAttribute('mapper_type') mapper_id = bd_node.getAttribute('mapper_id') - - + + buff = '

                                                      Removing Block Device

                                                      ' buff += path + '


                                                      ' - + buff += '
                                                      '
                                                      -    
                                                      +
                                                           #buff += bd_node.toxml()
                                                      -    
                                                      -    
                                                      +
                                                      +
                                                           doc = minidom.Document()
                                                           req = doc.createElement("request")
                                                           req.setAttribute("sequence", str(1254))
                                                      @@ -51,7 +51,7 @@
                                                           func.setAttribute('name', 'remove_bd')
                                                           func.appendChild(Variable('bd', bd_node).export_xml(doc))
                                                           req.appendChild(func)
                                                      -    
                                                      +
                                                           com = Communicator(params['hostname'])
                                                           try:
                                                               ret = com.process(doc.toxml())
                                                      @@ -59,10 +59,10 @@
                                                               return '1. failure communicating to ' + params['hostname']
                                                           if ret == None:
                                                               return '2. failure communicating to ' + params['hostname']
                                                      -    
                                                      +
                                                           #print doc.toprettyxml()
                                                           #print ret.toxml()
                                                      -    
                                                      +
                                                           # response
                                                           resp_node = None
                                                           for node in ret.childNodes:
                                                      @@ -71,7 +71,7 @@
                                                                       resp_node = node
                                                           if resp_node == None:
                                                               return '3. failure communicating to ' + params['hostname']
                                                      -    
                                                      +
                                                           # function
                                                           func_node = None
                                                           for node in resp_node.childNodes:
                                                      @@ -80,7 +80,7 @@
                                                                       func_node = node
                                                           if func_node == None:
                                                               return '4. failure communicating to ' + params['hostname']
                                                      -    
                                                      +
                                                           vars = {}
                                                           for var_node in func_node.childNodes:
                                                               try:
                                                      @@ -94,12 +94,12 @@
                                                               msg = params['hostname'] + ' reported error: '
                                                               msg += vars['error_code'].get_value()
                                                               return msg
                                                      -    
                                                      +
                                                           buff += '

                                                      SUCCESS

                                                      ' - + buff += '

                                                      Displaying Mapper

                                                      ' - + params['mapper_id'] = mapper_id params['mapper_type'] = mapper_type - + return buff + mapper_renderer(params) --- conga/ricci/test/bd_renderer.py 2006/04/07 16:42:40 1.2 +++ conga/ricci/test/bd_renderer.py 2007/09/11 02:45:29 1.3 @@ -13,22 +13,22 @@ class bd_renderer: - + def __init__(self): return - - + + def render_source(self, hostname, bd_node, indent='\t'): path = bd_node.getAttribute('path') state_ind = bd_node.getAttribute('state_ind') mapper_type = bd_node.getAttribute('mapper_type') mapper_id = bd_node.getAttribute('mapper_id') - - + + ### properties ### - + props = PropsObject().import_xml(bd_node) - + buff = '
                                                      ' #buff += '' buff += '' @@ -43,21 +43,21 @@ buff += '\n' + indent + indent + '- BD Properties:\n' buff += render_props(props, indent + indent + indent) buff += '
                                                      ' - - + + ### content ### - - + + content_node = None for node in bd_node.childNodes: if node.nodeType == xml.dom.Node.ELEMENT_NODE: if node.nodeName == CONTENT_TYPE: content_node = node content_type = content_node.getAttribute('type') - - + + buff += '
                                                      ' - + if content_type == CONTENT_NONE_TYPE: buff += indent + indent + '- Content: none\n' return buff @@ -78,24 +78,24 @@ buff += indent + indent + indent + '- Properties:\n' props = PropsObject().import_xml(content_node) buff += render_props(props, indent + indent + indent + indent) - + buff += '
                                                      ' - + return buff - - - + + + def render_target(self, hostname, bd_node, indent='\t'): path = bd_node.getAttribute('path') state_ind = bd_node.getAttribute('state_ind') mapper_type = bd_node.getAttribute('mapper_type') mapper_id = bd_node.getAttribute('mapper_id') - - + + ### properties ### - + props = PropsObject().import_xml(bd_node) - + buff = '
                                                      ' buff += indent + path buff += '' @@ -109,21 +109,21 @@ buff += '\n' + indent + indent + '- BD Properties:\n' buff += '
                                                      ' buff += render_props(props, indent + indent + indent) - - + + ### content ### - - + + content_node = None for node in bd_node.childNodes: if node.nodeType == xml.dom.Node.ELEMENT_NODE: if node.nodeName == CONTENT_TYPE: content_node = node content_type = content_node.getAttribute('type') - - + + buff += '
                                                      ' - + if content_type == CONTENT_NONE_TYPE: buff += indent + indent + '- Content: none\n' return buff @@ -142,11 +142,11 @@ buff += indent + indent + indent + '- Properties:\n' props = PropsObject().import_xml(content_node) buff += render_props(props, indent + indent + indent + indent) - + buff += '
                                                      ' - + return buff - + pass @@ -156,63 +156,63 @@ return 'missing hostname parameter' if 'bd_xml' not in params: return 'missing bd_xml parameter' - + hostname = params['hostname'] indent = '\t' #indent = ' ' - + xml_buff = params['bd_xml'].replace(PARENTH_SIG, '"') bd_node = minidom.parseString(xml_buff).firstChild - - + + path = bd_node.getAttribute('path') state_ind = bd_node.getAttribute('state_ind') mapper_type = bd_node.getAttribute('mapper_type') mapper_id = bd_node.getAttribute('mapper_id') - - + + buff = '

                                                      Editing Block Device

                                                      ' buff += path + '


                                                      ' - + buff += '
                                                      '
                                                      -    
                                                      +
                                                           #buff += bd_node.toxml()
                                                      -    
                                                      +
                                                           buff += '
                                                      ' buff += '' buff += '' buff += '' buff += '' buff += '' - - + + ### providing mapper ### - - + + buff += 'Block Device is provided by mapper "' + mapper_id + '" \n\n' - - + + ### properties ### - - + + buff += '\nBlock Device Properties:\n' props = PropsObject().import_xml(bd_node) buff += render_props_editor(props, indent) - - + + ### content ### - - + + buff += render_edit_content(bd_node, indent) - - + + ### apply button ### - - + + buff += '\n\n\n\n' buff += '
                                                      ' buff += '
                                                      ' - + return buff @@ -225,36 +225,36 @@ return 'missing content_xml parameter' if 'current_content_id' not in params: return 'missing current_content_id parameter' - + indent = '\t' #indent = ' ' - + current_content_id = params['current_content_id'] hostname = params['hostname'] - + xml_buff = params['bd_xml'].replace(PARENTH_SIG, '"') bd_node = minidom.parseString(xml_buff).firstChild - + xml_buff = params['content_xml'].replace(PARENTH_SIG, '"') new_content_node = minidom.parseString(xml_buff).firstChild - + path = bd_node.getAttribute('path') state_ind = bd_node.getAttribute('state_ind') mapper_type = bd_node.getAttribute('mapper_type') mapper_id = bd_node.getAttribute('mapper_id') - - + + buff = '

                                                      Applying changes to Block Device

                                                      ' buff += path + '


                                                      ' - + buff += '
                                                      '
                                                      -    
                                                      +
                                                           #buff += bd_node.toxml()
                                                           #buff += new_content_node.toxml()
                                                      -    
                                                      -    
                                                      +
                                                      +
                                                           ### update bd props ##
                                                      -    
                                                      +
                                                           new_values = {}
                                                           for param in params:
                                                               if param.startswith(VARIABLE_SIG):
                                                      @@ -264,23 +264,23 @@
                                                                   if node.nodeName == str(PROPS_TAG):
                                                                       props_node = node
                                                           update_props(props_node, new_values)
                                                      -    
                                                      -    
                                                      +
                                                      +
                                                           ### update content ###
                                                      -    
                                                      -    
                                                      -    
                                                      +
                                                      +
                                                      +
                                                           content_reconstruct(bd_node,
                                                                               new_content_node,
                                                                               params,
                                                                               current_content_id)
                                                      -    
                                                      -    
                                                      -    
                                                      +
                                                      +
                                                      +
                                                           #buff += bd_node.toxml()
                                                      -    
                                                      -    
                                                      -    
                                                      +
                                                      +
                                                      +
                                                           doc = minidom.Document()
                                                           req = doc.createElement("request")
                                                           req.setAttribute("sequence", str(1254))
                                                      @@ -290,7 +290,7 @@
                                                           func.setAttribute('name', 'modify_bd')
                                                           func.appendChild(Variable('bd', bd_node).export_xml(doc))
                                                           req.appendChild(func)
                                                      -    
                                                      +
                                                           com = Communicator(params['hostname'])
                                                           try:
                                                               ret = com.process(doc.toxml())
                                                      @@ -298,10 +298,10 @@
                                                               return '1. failure communicating to ' + params['hostname']
                                                           if ret == None:
                                                               return '2. failure communicating to ' + params['hostname']
                                                      -    
                                                      +
                                                           #print doc.toprettyxml()
                                                           #print ret.toxml()
                                                      -    
                                                      +
                                                           # response
                                                           resp_node = None
                                                           for node in ret.childNodes:
                                                      @@ -310,7 +310,7 @@
                                                                       resp_node = node
                                                           if resp_node == None:
                                                               return '3. failure communicating to ' + params['hostname']
                                                      -    
                                                      +
                                                           # function
                                                           func_node = None
                                                           for node in resp_node.childNodes:
                                                      @@ -319,7 +319,7 @@
                                                                       func_node = node
                                                           if func_node == None:
                                                               return '4. failure communicating to ' + params['hostname']
                                                      -    
                                                      +
                                                           vars = {}
                                                           for var_node in func_node.childNodes:
                                                               try:
                                                      @@ -333,11 +333,11 @@
                                                               msg = params['hostname'] + ' reported error: '
                                                               msg += vars['error_code'].get_value()
                                                               return msg
                                                      -    
                                                      +
                                                           if 'bd' not in vars:
                                                               return 'missing bd var'
                                                           buff += '

                                                      SUCCESS

                                                      ' buff += 'Newly modified target:\n' buff += bd_renderer().render_source(params['hostname'], vars['bd'].get_value()) - + return buff --- conga/ricci/test/communicator.py 2006/04/07 16:42:40 1.3 +++ conga/ricci/test/communicator.py 2007/09/11 02:45:29 1.4 @@ -11,24 +11,24 @@ def __init__(self, hostname, port=11111): self.__hostname = hostname self.__port = port - + self.__privkey_file = "/usr/share/ricci-storage-web/certs/privkey.pem" self.__cert_file = "/usr/share/ricci-storage-web/certs/cacert.pem" - + return - - + + def process(self, xml_out): # socket sock = socket(AF_INET, SOCK_STREAM) sock.connect((self.__hostname, self.__port)) ss = ssl(sock, self.__privkey_file, self.__cert_file) - + # receive ricci header hello = self.__receive(ss) if hello != None: print hello.toxml() - + # send request doc = minidom.Document() ricci = doc.createElement("ricci") @@ -41,17 +41,17 @@ module.setAttribute("name", "storage") batch.appendChild(module) ricci.appendChild(batch) - - - + + + req = minidom.parseString(xml_out) module.appendChild(req.firstChild) - - + + #self.__sendall(doc.toprettyxml(), ss) self.__sendall(doc.toxml(), ss) - - + + # receive response doc = self.__receive(ss) if doc != None: @@ -81,39 +81,39 @@ else: doc = minidom.Document() doc.appendChild(resp_node) - + sock.shutdown(2) sock.close() return doc - - - + + + def auth_check(self): # socket sock = socket(AF_INET, SOCK_STREAM) sock.connect((self.__hostname, self.__port)) ss = ssl(sock, self.__privkey_file, self.__cert_file) - + # receive ricci header hello = self.__receive(ss) if hello != None: print hello.toxml() pass return hello.firstChild.getAttribute('authenticated') == 'true' - - + + def authenticate(self, password): # socket sock = socket(AF_INET, SOCK_STREAM) sock.connect((self.__hostname, self.__port)) ss = ssl(sock, self.__privkey_file, self.__cert_file) - + # receive ricci header hello = self.__receive(ss) if hello != None: print hello.toxml() pass - + # send request doc = minidom.Document() ricci = doc.createElement("ricci") @@ -123,8 +123,8 @@ doc.appendChild(ricci) self.__sendall(doc.toxml(), ss) return - - + + def __sendall(self, str, ssl_sock): print str s = str @@ -132,8 +132,8 @@ pos = ssl_sock.write(s) s = s[pos:] return - - + + def __receive(self, ssl_sock): doc = None xml_in = '' @@ -157,4 +157,4 @@ except: pass return doc - + --- conga/ricci/test/content_renderer.py 2006/03/13 20:48:27 1.1 +++ conga/ricci/test/content_renderer.py 2007/09/11 02:45:29 1.2 @@ -16,7 +16,7 @@ def render_edit_content(bd_node, indent): buff = '' - + content_node = None for node in bd_node.childNodes: if node.nodeType == xml.dom.Node.ELEMENT_NODE: @@ -24,7 +24,7 @@ content_node = node if content_node == None: return 'missing content tag' - + available_contents = [] for node in content_node.childNodes: if node.nodeType == xml.dom.Node.ELEMENT_NODE: @@ -35,7 +35,7 @@ if node.nodeName == 'content_template': available_contents.append(node) # - + c_id = gen_content_id(content_node) buff += '' if len(available_contents) == 0: @@ -49,14 +49,14 @@ buff += content_node.toxml().replace('"', PARENTH_SIG) buff += '"> ' buff += render_content('Current content: ', content_node, c_id, indent) - + for ct in available_contents: ct_id = gen_content_id(ct) buff += '\n' #for key in self.params: # print key + ': ' + self.params[key] # pass #print '
                                                      ' - + buff = '' - + if 'hostname' in self.params: buff += '

                                                      ' buff += '

                                                      \n' @@ -32,13 +32,13 @@ buff += '\n' buff += '\n' buff += '

                                                      \n' - - + + if 'page' not in self.params: page_type = 'host_selection' else: page_type = self.params['page'] - + if page_type == 'host_selection': return host_selection(self.params) elif page_type == 'auth_page': @@ -47,7 +47,7 @@ return authenticate(self.params) elif page_type == 'main_page': return main_page(self.params) - + elif page_type == 'mapper_renderer': return buff + mapper_renderer(self.params) elif page_type == 'apply_mapper_props': @@ -71,16 +71,16 @@ return buff + new_target_renderer(self.params) elif page_type == 'commit_new_target': return buff + commit_new_target(self.params) - + elif page_type == 'add_sources': return buff + add_sources_renderer(self.params) elif page_type == 'add_sources_commit': return buff + add_sources_commit(self.params) - + elif page_type == 'new_mapper_selection': return buff + new_mapper_renderer(self.params) elif page_type == 'commit_new_mapper': return buff + commit_new_mapper(self.params) - + return buff + '

                                                      Page Not Implemented

                                                      ' - + --- conga/ricci/test/host_selection.py 2006/03/13 20:48:27 1.1 +++ conga/ricci/test/host_selection.py 2007/09/11 02:45:29 1.2 @@ -1,7 +1,7 @@ def host_selection(params): - + buff = '
                                                      '
                                                           buff += 'Simple website used to test ricci\'s storage module\n\n'
                                                           buff += 'There are three main objects:\n'
                                                      @@ -12,13 +12,13 @@
                                                           buff += '    - mapper source (Physical Volume, partition table source, ...)\n'
                                                           buff += '    - none\n'
                                                           buff += '\n
                                                      ' - + buff += '
                                                      ' buff += '' buff += '

                                                      Enter hostname of server to manage: ' buff += '

                                                      ' buff += '' buff += '
                                                      ' - + return buff --- conga/ricci/test/main_page.py 2006/04/07 16:42:40 1.2 +++ conga/ricci/test/main_page.py 2007/09/11 02:45:29 1.3 @@ -11,14 +11,14 @@ def main_page(params): if 'hostname' not in params: return 'missing hostname parameter' - - + + buff = '
                                                      \n' buff += '\n' buff += '\n' buff += '


                                                      \n' - - + + doc = minidom.Document() req = doc.createElement("request") req.setAttribute("sequence", str(1254)) @@ -27,7 +27,7 @@ func = doc.createElement("function_call") func.setAttribute('name', 'get_mapper_ids') req.appendChild(func) - + com = Communicator(params['hostname']) try: ret = com.process(doc.toxml()) @@ -35,10 +35,10 @@ return buff + '
                                                      1. failure communicating to ' + params['hostname'] if ret == None: return buff + '
                                                      2. failure communicating to ' + params['hostname'] - + #print doc.toprettyxml() #print ret.toxml() - + # response resp_node = None for node in ret.childNodes: @@ -47,7 +47,7 @@ resp_node = node if resp_node == None: return '3. failure communicating to ' + params['hostname'] - + # function func_node = None for node in resp_node.childNodes: @@ -56,7 +56,7 @@ func_node = node if func_node == None: return '4. failure communicating to ' + params['hostname'] - + vars = {} for var_node in func_node.childNodes: try: @@ -70,7 +70,7 @@ return params['hostname'] + ' reported error' if 'mapper_ids' not in vars: return 'missing mapper_ids variable' - + mapper_ids = {} for node in vars['mapper_ids'].get_value(): if node.nodeType == xml.dom.Node.ELEMENT_NODE: @@ -81,12 +81,12 @@ mapper_ids[type].append(id) else: mapper_ids[type] = [id] - + buff += '

                                                      Mappers

                                                      ' - - + + ### HDs ### - + buff += '

                                                      Hard Drives (Mapper Type - "hard_drives"):' buff += '

                                                      \n' buff += '\n' @@ -95,8 +95,8 @@ buff += '\n' buff += '\n' buff += '


                                                      \n' - - + + for m_type in mapper_ids: m_ids = mapper_ids[m_type] if m_type == 'hard_drives': @@ -144,13 +144,13 @@ buff += '


                                                      ' pass pass - - + + buff += '

                                                      ' buff += '

                                                      \n' buff += '\n' buff += '\n' buff += '\n' buff += '

                                                      \n' - + return buff --- conga/ricci/test/mapper_renderer.py 2006/04/07 16:42:40 1.2 +++ conga/ricci/test/mapper_renderer.py 2007/09/11 02:45:29 1.3 @@ -22,7 +22,7 @@ return 'missing mapper_type parameter' if 'mapper_id' not in params: return 'missing mapper_id parameter' - + doc = minidom.Document() req = doc.createElement("request") req.setAttribute("sequence", str(1254)) @@ -32,7 +32,7 @@ func.setAttribute('name', 'get_mappers') func.appendChild(Variable('mapper_id', params['mapper_id']).export_xml(doc)) req.appendChild(func) - + com = Communicator(params['hostname']) try: ret = com.process(doc.toxml()) @@ -40,10 +40,10 @@ return '1. failure communicating to ' + params['hostname'] if ret == None: return '2. failure communicating to ' + params['hostname'] - + #print doc.toprettyxml() #print ret.toxml() - + # response resp_node = None for node in ret.childNodes: @@ -52,7 +52,7 @@ resp_node = node if resp_node == None: return '3. failure communicating to ' + params['hostname'] - + # function func_node = None for node in resp_node.childNodes: @@ -61,7 +61,7 @@ func_node = node if func_node == None: return '4. failure communicating to ' + params['hostname'] - + vars = {} for var_node in func_node.childNodes: try: @@ -73,11 +73,11 @@ return '5. failure communicating to ' + params['hostname'] if vars['success'].get_value() != True: return params['hostname'] + ' reported error' - + if vars['mappers'] == None: return 'illegal return value from ' + params['hostname'] - - + + mapper = None for node in vars['mappers'].get_value(): if node.nodeType == xml.dom.Node.ELEMENT_NODE: @@ -85,7 +85,7 @@ mapper = node if mapper == None: return 'mapper not found' - + return render_mapper(mapper, params['hostname']) @@ -111,8 +111,8 @@ new_sources_node == None or new_targets_node == None): return 'illegal return value from ' + hostname - - + + id = mapper.getAttribute('mapper_id') type = mapper.getAttribute('mapper_type') pretty_type = type @@ -122,11 +122,11 @@ pretty_type = 'Partition Table' elif type == 'hard_drives': pretty_type = 'System Hard Drives' - + buff = '

                                                      Mapper Type: "' + pretty_type + '"
                                                      ' buff += 'Mapper ID: "' + id + '"

                                                      ' - - + + ### props editor ### props = PropsObject().import_xml(mapper) buff += '\n
                                                      \n' @@ -142,7 +142,7 @@ buff += mapper.toxml().replace('"', PARENTH_SIG) + '">\n' buff += '
                                                      ' buff += '' - + ### display remove mapper button ### if props.get_prop('removable') == True: buff += '
                                                      \n' @@ -155,8 +155,8 @@ buff += '\n' buff += '
                                                      ' pass - - + + ### display sources ### buff += '
                                                      Sources:\n'
                                                           for node in sources_node.childNodes:
                                                      @@ -165,8 +165,8 @@
                                                                       buff += bd_renderer().render_source(hostname, node)
                                                                       buff += '\n'
                                                           buff += '
                                                      \n'
                                                      -    
                                                      -    
                                                      +
                                                      +
                                                           ### new sources ###
                                                           has_new_sources = False
                                                           for node in new_sources_node.childNodes:
                                                      @@ -184,9 +184,9 @@
                                                               buff += '\t'
                                                               buff += ''
                                                               pass
                                                      -    
                                                      -    
                                                      -    
                                                      +
                                                      +
                                                      +
                                                           ### display targets ###
                                                           buff += '
                                                      Targets:\n'
                                                           for node in targets_node.childNodes:
                                                      @@ -195,8 +195,8 @@
                                                                       buff += bd_renderer().render_target(hostname, node)
                                                                       buff += '\n'
                                                           buff +='
                                                      \n'
                                                      -    
                                                      -    
                                                      +
                                                      +
                                                           ### new targets ###
                                                           has_new_targets = False
                                                           for node in new_targets_node.childNodes:
                                                      @@ -213,9 +213,9 @@
                                                               buff += '\t'
                                                               buff += ''
                                                               pass
                                                      -    
                                                      -    
                                                      -    
                                                      +
                                                      +
                                                      +
                                                           return buff
                                                       
                                                       
                                                      @@ -228,26 +228,26 @@
                                                               return 'missing mapper_type parameter'
                                                           if 'mapper_id' not in params:
                                                               return 'missing mapper_id parameter'
                                                      -    
                                                      +
                                                           indent = '\t'
                                                           #indent = '    '
                                                      -    
                                                      +
                                                           hostname    = params['hostname']
                                                           mapper_type = params['mapper_type']
                                                           mapper_id   = params['mapper_id']
                                                      -    
                                                      +
                                                           xml_buff = params['mapper_xml'].replace(PARENTH_SIG, '"')
                                                           mapper_node = minidom.parseString(xml_buff).firstChild
                                                      -    
                                                      -    
                                                      +
                                                      +
                                                           buff = '

                                                      Applying changes to mapper

                                                      ' buff += mapper_id + '


                                                      ' - + buff += '
                                                      '
                                                      -    
                                                      -    
                                                      +
                                                      +
                                                           ### update props ##
                                                      -    
                                                      +
                                                           new_values = {}
                                                           for param in params:
                                                               if param.startswith(VARIABLE_SIG):
                                                      @@ -257,11 +257,11 @@
                                                                   if node.nodeName == str(PROPS_TAG):
                                                                       props_node = node
                                                           update_props(props_node, new_values)
                                                      -    
                                                      -    
                                                      +
                                                      +
                                                           #buff += mapper_node.toxml()
                                                      -    
                                                      -    
                                                      +
                                                      +
                                                           doc = minidom.Document()
                                                           req = doc.createElement("request")
                                                           req.setAttribute("sequence", str(1254))
                                                      @@ -271,7 +271,7 @@
                                                           func.setAttribute('name', 'modify_mapper')
                                                           func.appendChild(Variable('mapper', mapper_node).export_xml(doc))
                                                           req.appendChild(func)
                                                      -    
                                                      +
                                                           com = Communicator(params['hostname'])
                                                           try:
                                                               ret = com.process(doc.toxml())
                                                      @@ -279,10 +279,10 @@
                                                               return '1. failure communicating to ' + params['hostname']
                                                           if ret == None:
                                                               return '2. failure communicating to ' + params['hostname']
                                                      -    
                                                      +
                                                           #print doc.toprettyxml()
                                                           #print ret.toxml()
                                                      -    
                                                      +
                                                           # response
                                                           resp_node = None
                                                           for node in ret.childNodes:
                                                      @@ -291,7 +291,7 @@
                                                                       resp_node = node
                                                           if resp_node == None:
                                                               return '3. failure communicating to ' + params['hostname']
                                                      -    
                                                      +
                                                           # function
                                                           func_node = None
                                                           for node in resp_node.childNodes:
                                                      @@ -300,7 +300,7 @@
                                                                       func_node = node
                                                           if func_node == None:
                                                               return '4. failure communicating to ' + params['hostname']
                                                      -    
                                                      +
                                                           vars = {}
                                                           for var_node in func_node.childNodes:
                                                               try:
                                                      @@ -314,13 +314,13 @@
                                                               msg = params['hostname'] + ' reported error: '
                                                               msg += vars['error_code'].get_value()
                                                               return msg
                                                      -    
                                                      +
                                                           if 'mapper' not in vars:
                                                               return 'missing mapper var'
                                                           buff += '

                                                      SUCCESS

                                                      ' buff += 'Newly modified mapper:\n' buff += render_mapper(vars['mapper'].get_value(), hostname) - + return buff @@ -334,23 +334,23 @@ return 'missing mapper_id parameter' if 'mapper_xml' not in params: return 'missing mapper_xml parameter' - + hostname = params['hostname'] mapper_type = params['mapper_type'] mapper_id = params['mapper_id'] - + xml_buff = params['mapper_xml'].replace(PARENTH_SIG, '"') mapper_node = minidom.parseString(xml_buff).firstChild - - + + buff = '

                                                      Removing Mapper
                                                      ' buff += 'Mapper Type: "' + mapper_type + '"
                                                      ' buff += 'Mapper ID: "' + mapper_id + '"

                                                      ' - - - + + + # request - + doc = minidom.Document() req = doc.createElement("request") req.setAttribute("sequence", str(1254)) @@ -360,7 +360,7 @@ func.setAttribute('name', 'remove_mapper') func.appendChild(Variable('mapper', mapper_node).export_xml(doc)) req.appendChild(func) - + com = Communicator(params['hostname']) try: ret = com.process(doc.toxml()) @@ -368,10 +368,10 @@ return '1. failure communicating to ' + params['hostname'] if ret == None: return '2. failure communicating to ' + params['hostname'] - + #print doc.toprettyxml() #print ret.toxml() - + # response resp_node = None for node in ret.childNodes: @@ -380,7 +380,7 @@ resp_node = node if resp_node == None: return '3. failure communicating to ' + params['hostname'] - + # function func_node = None for node in resp_node.childNodes: @@ -389,7 +389,7 @@ func_node = node if func_node == None: return '4. failure communicating to ' + params['hostname'] - + vars = {} for var_node in func_node.childNodes: try: @@ -408,6 +408,6 @@ else: ### SUCCESS ### buff += '

                                                      SUCCESS

                                                      ' - + return buff + main_page(params) --- conga/ricci/test/new_mapper_renderer.py 2006/04/07 16:42:40 1.2 +++ conga/ricci/test/new_mapper_renderer.py 2007/09/11 02:45:29 1.3 @@ -17,11 +17,11 @@ def new_mapper_renderer(params): if 'hostname' not in params: return 'missing hostname parameter' - + buff = '

                                                      New Mapper Creation Dialog

                                                      ' - - - + + + doc = minidom.Document() req = doc.createElement("request") req.setAttribute("sequence", str(1254)) @@ -30,7 +30,7 @@ func = doc.createElement("function_call") func.setAttribute('name', 'get_mapper_templates') req.appendChild(func) - + com = Communicator(params['hostname']) try: ret = com.process(doc.toxml()) @@ -38,10 +38,10 @@ return '1. failure communicating to ' + params['hostname'] if ret == None: return '2. failure communicating to ' + params['hostname'] - + #print doc.toprettyxml() #print ret.toxml() - + # response resp_node = None for node in ret.childNodes: @@ -50,7 +50,7 @@ resp_node = node if resp_node == None: return '3. failure communicating to ' + params['hostname'] - + # function func_node = None for node in resp_node.childNodes: @@ -59,7 +59,7 @@ func_node = node if func_node == None: return '4. failure communicating to ' + params['hostname'] - + vars = {} for var_node in func_node.childNodes: try: @@ -73,7 +73,7 @@ return params['hostname'] + ' reported error' if 'mapper_templates' not in vars: return 'missing mapper_templates variable' - + mapper_temps = [] for node in vars['mapper_templates'].get_value(): if node.nodeType == xml.dom.Node.ELEMENT_NODE: @@ -81,8 +81,8 @@ mapper_temps.append(node) if len(mapper_temps) == 0: return buff + ' no available mapper_templates on ' + params['hostname'] - - + + ### dialogs ### for template_node in mapper_temps: buff += '
                                                      New Mapper ("' + template_node.getAttribute('mapper_type') + '"): '
                                                      @@ -90,11 +90,11 @@
                                                               buff += ''
                                                               buff += ''
                                                               buff += ''
                                                      -        
                                                      +
                                                               ### props ###
                                                               props = PropsObject().import_xml(template_node)
                                                               buff += '\tproperties:\n' + render_props_editor(props, '\t\t')
                                                      -        
                                                      +
                                                               ### sources ###
                                                               new_sources_node = None
                                                               for node in template_node.childNodes:
                                                      @@ -108,7 +108,7 @@
                                                                           path = node.getAttribute('path')
                                                                           buff += '\t\t'
                                                                           buff += path + '\n'
                                                      -        
                                                      +
                                                               # "create mapper" button
                                                               buff += ''
                                                               buff += '

                                                      ' @@ -123,14 +123,14 @@ return 'missing hostname parameter' if 'mapper_template_xml' not in params: return 'missing bd_template_xml parameter' - + xml_buff = params['mapper_template_xml'].replace(PARENTH_SIG, '"') mapper_template_node = minidom.parseString(xml_buff).firstChild - + buff = '

                                                      Creating New Mapper

                                                      ' - + ### update mapper_template_node ### - + new_values = {} for param in params: if param.startswith(VARIABLE_SIG): @@ -141,7 +141,7 @@ if node.nodeName == str(PROPS_TAG): props_node = node update_props(props_node, new_values) - + # sources paths = [] for param in params: @@ -166,10 +166,10 @@ for bd in bd_nodes: node.appendChild(bd) print mapper_template_node.toxml() - - + + ### prepare request ### - + doc = minidom.Document() req = doc.createElement("request") req.setAttribute("API_version", "1.0") @@ -179,9 +179,9 @@ func.setAttribute('name', 'create_mapper') func.appendChild(Variable('mapper', mapper_template_node).export_xml(doc)) req.appendChild(func) - + ### submit request ### - + com = Communicator(params['hostname']) ret = None try: @@ -190,10 +190,10 @@ return 'failure communicating to ' + params['hostname'] if ret == None: return 'failure communicating to ' + params['hostname'] - + #print doc.toprettyxml() #print ret.toxml() - + # response resp_node = None for node in ret.childNodes: @@ -202,7 +202,7 @@ resp_node = node if resp_node == None: return 'failure communicating to ' + params['hostname'] - + # function func_node = None for node in resp_node.childNodes: @@ -211,7 +211,7 @@ func_node = node if func_node == None: return 'failure communicating to ' + params['hostname'] - + vars = {} for var_node in func_node.childNodes: try: @@ -230,6 +230,6 @@ else: ### SUCCESS ### buff += '

                                                      SUCCESS

                                                      ' - + buff += render_mapper(vars['mapper'].get_value(), params['hostname']) return buff --- conga/ricci/test/new_target_renderer.py 2006/04/07 16:42:40 1.2 +++ conga/ricci/test/new_target_renderer.py 2007/09/11 02:45:29 1.3 @@ -23,20 +23,20 @@ return 'missing mapper_id parameter' if 'targets_xml' not in params: return 'missing targets_xml parameter' - + xml_buff = params['targets_xml'].replace(PARENTH_SIG, '"') targets_node = minidom.parseString(xml_buff).firstChild - + mapper_type = params['mapper_type'] mapper_id = params['mapper_id'] - + buff = '

                                                      New Target Creation Dialog
                                                      ' buff += 'Mapper Type: "' + mapper_type + '"
                                                      ' buff += 'Mapper ID: "' + mapper_id + '"

                                                      ' - + buff += targets_node.toxml() - - + + ### target ### for node in targets_node.childNodes: if node.nodeType == xml.dom.Node.ELEMENT_NODE: @@ -48,14 +48,14 @@ buff += '' buff += '' buff += '' - + ### props ### props = PropsObject().import_xml(node) buff += render_props_editor(props, '\t') - + ### content ### buff += render_edit_content(node, '\t') - + buff += '' buff += '

                                                      ' return buff @@ -77,31 +77,31 @@ return 'missing content_xml parameter' if 'current_content_id' not in params: return 'missing current_content_id parameter' - + xml_buff = params['bd_template_xml'].replace(PARENTH_SIG, '"') bd_template_node = minidom.parseString(xml_buff).firstChild - + current_content_id = params['current_content_id'] - + xml_buff = params['content_xml'].replace(PARENTH_SIG, '"') new_content_node = minidom.parseString(xml_buff).firstChild - - + + mapper_type = params['mapper_type'] mapper_id = params['mapper_id'] - + buff = '

                                                      Adding New Target
                                                      ' buff += 'Mapper Type: "' + mapper_type + '"
                                                      ' buff += 'Mapper ID: "' + mapper_id + '"

                                                      ' - - + + ### update bd_template_node ### - + new_values = {} for param in params: if param.startswith(VARIABLE_SIG): new_values[param[len(VARIABLE_SIG):]] = params[param] - + props_node = None for node in bd_template_node.childNodes: if node.nodeType == xml.dom.Node.ELEMENT_NODE: @@ -128,10 +128,10 @@ new_content_node, params, current_content_id) - - + + ### prepare request ### - + doc = minidom.Document() req = doc.createElement("request") req.setAttribute("sequence", str(1254)) @@ -141,9 +141,9 @@ func.setAttribute('name', 'create_bd') func.appendChild(Variable('bd', bd_template_node).export_xml(doc)) req.appendChild(func) - + ### submit request ### - + com = Communicator(params['hostname']) try: ret = com.process(doc.toxml()) @@ -151,10 +151,10 @@ return 'failure communicating to ' + params['hostname'] if ret == None: return 'failure communicating to ' + params['hostname'] - + #print doc.toprettyxml() #print ret.toxml() - + # response resp_node = None for node in ret.childNodes: @@ -163,7 +163,7 @@ resp_node = node if resp_node == None: return 'failure communicating to ' + params['hostname'] - + # function func_node = None for node in resp_node.childNodes: @@ -172,7 +172,7 @@ func_node = node if func_node == None: return 'failure communicating to ' + params['hostname'] - + vars = {} for var_node in func_node.childNodes: try: @@ -191,7 +191,7 @@ else: ### SUCCESS ### buff += '

                                                      SUCCESS

                                                      ' - + buff += '
                                                      ' buff += '' buff += '' @@ -199,13 +199,13 @@ buff += '' buff += '' buff += '
                                                      ' - + buff += '
                                                      '
                                                           buff += 'Newly created target:\n'
                                                           buff += bd_renderer().render_target(params['hostname'],
                                                                                               vars['bd'].get_value())
                                                           buff += '
                                                      ' - - - + + + return buff --- conga/ricci/test/props_renderer.py 2006/03/13 20:48:27 1.1 +++ conga/ricci/test/props_renderer.py 2007/09/11 02:45:29 1.2 @@ -72,7 +72,7 @@ for mod in modifiers: if mod not in ['mutable']: buff += indent + indent + indent + mod + '=' + modifiers[mod] + '\n' - + return buff --- conga/ricci/test_suite/README 2007/03/05 20:45:17 1.2 +++ conga/ricci/test_suite/README 2007/09/11 02:45:29 1.3 @@ -1,6 +1,6 @@ 1. generate SSL cert/key pair ./generate_certs.sh - this step needs to be performed only once + this step needs to be performed only once (cert can be used for multiple riccis - each requires authentication) 2. modify ricci/authenticate.xml, writing root password of machine hosting ricci to 'password' attribute 3. execute `./send_to_ricci ricci_hostname ricci/authenticate.xml` --- conga/ricci/test_suite/SSLClient_send_to_ricci 2007/03/22 03:42:38 1.1 +++ conga/ricci/test_suite/SSLClient_send_to_ricci 2007/09/11 02:45:29 1.2 @@ -20,7 +20,7 @@ def send_to_ricci(hostname, msg): ss = SSLSocket(hostname, RICCI_PORT, CONNECT_TIMEOUT) - + res1 = ss.recv(READ_TIMEOUT) ss.send(msg, WRITE_TIMEOUT) res2 = '' @@ -45,7 +45,7 @@ if os.access('privkey.pem', os.R_OK) == False: print 'cannot find privkey.pem' certs_present = False - + if len(argv) != 3 or not certs_present: print 'sends to ricci on , and writes its response to stdout' print '\t' + argv[0] + ' ' --- conga/ricci/test_suite/send_to_ricci 2006/10/27 19:30:30 1.1 +++ conga/ricci/test_suite/send_to_ricci 2007/09/11 02:45:29 1.2 @@ -18,7 +18,7 @@ s.connect((hostname, RICCI_PORT)) ss = socket.ssl(s, 'privkey.pem', 'cacert.pem') s.settimeout(600.0) - + res1 = ss.read(1024) ss.write(msg) res2 = '' @@ -43,7 +43,7 @@ if os.access('privkey.pem', os.R_OK) == False: print 'cannot find privkey.pem' certs_present = False - + if len(argv) != 3 or not certs_present: print 'sends to ricci on , and writes its response to stdout' print '\t' + argv[0] + ' '