Darryl L. Pierce
2010-Mar-15 20:17 UTC
[Ovirt-devel] [PATCH] Updated the list of ignored files and fixed whitespace issues.
This patch changes no functionality. It merely adds items to the ignore file, cleans up the formatting for source files and updates the prologs for files to include the name of the file being licensed. Signed-off-by: Darryl L. Pierce <dpierce at redhat.com> --- .gitignore | 12 +++++++++++ AUTHORS | 3 +- ChangeLog | 1 - INSTALL | 1 - Makefile.am | 2 +- matahari.init.in | 5 +-- matahari.spec | 5 +-- src/cpu.cpp | 35 ++++++++++++++++----------------- src/cpu.h | 22 ++++++++++---------- src/hal.cpp | 13 ++++------- src/hal.h | 2 +- src/host.cpp | 56 +++++++++++++++++++++++++++--------------------------- src/host.h | 7 ++--- src/main.cpp | 6 ++-- src/nic.cpp | 54 ++++++++++++++++++++++++++-------------------------- src/nic.h | 27 ++++++++++++------------- 16 files changed, 127 insertions(+), 124 deletions(-) diff --git a/.gitignore b/.gitignore index 30d6b42..ad6d70b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,17 @@ aclocal.m4 autom4te.cache config.h config.h.in +config.log +config.status configure depcomp +.deps +install-sh +missing +stamp-h1 +*.o +*.patch +*~ + +src/matahari +src/qmf diff --git a/AUTHORS b/AUTHORS index 2fac0a7..834b11a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,6 +1,7 @@ Current Maintainer: -Arjun Roy <arroy at redhat.com> +Arjun Roy <arroy at redhat.com> +Darryl L. Pierce <dpierce at redhat.com> Contributors: diff --git a/ChangeLog b/ChangeLog index 28d63da..0d3f3e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,4 +20,3 @@ v 0.0.1 Initial version using autotools. Tracks Node, CPU and NIC info. Provides method to physically identify NIC. - diff --git a/INSTALL b/INSTALL index 8b82ade..c9fd2c0 100644 --- a/INSTALL +++ b/INSTALL @@ -288,4 +288,3 @@ operates. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. - diff --git a/Makefile.am b/Makefile.am index 449ac9c..defbd32 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,7 +28,7 @@ matahari.init: matahari.init.in chmod a+x $@-t mv $@-t $@ -EXTRA_DIST = autogen.sh \ +EXTRA_DIST = autogen.sh \ matahari.init.in \ matahari.sysconf diff --git a/matahari.init.in b/matahari.init.in index ceb8c68..1f6be49 100644 --- a/matahari.init.in +++ b/matahari.init.in @@ -63,14 +63,13 @@ case "$1" in ;; force-reload) reload - ;; + ;; condrestart|try-restart) [ -f @localstatedir@/lock/subsys/$SERVICE ] && restart || : ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}" - exit 1 + exit 1 ;; esac exit $RETVAL - diff --git a/matahari.spec b/matahari.spec index 9ccdc18..b1e00bc 100644 --- a/matahari.spec +++ b/matahari.spec @@ -28,10 +28,10 @@ BuildRequires: pcre-devel >= 7.8 matahari provides a QMF Agent that can be used to control and manage various pieces of functionality for an ovirt node, using the AMQP protocol. -The Advanced Message Queuing Protocol (AMQP) is an open standard application +The Advanced Message Queuing Protocol (AMQP) is an open standard application layer protocol providing reliable transport of messages. -QMF provides a modeling framework layer on top of qpid (which implements +QMF provides a modeling framework layer on top of qpid (which implements AMQP). This interface allows you to manage a host and its various components as a set of objects with properties and methods. @@ -115,4 +115,3 @@ test "x%{buildroot}" != "x" && rm -rf %{buildroot} * Tue Jun 23 2009 Arjun Roy <arroy at redhat.com> - 0.0.1-1 - Initial rpmspec packaging - diff --git a/src/cpu.cpp b/src/cpu.cpp index 30348b4..453c571 100644 --- a/src/cpu.cpp +++ b/src/cpu.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Red Hat, Inc. +/* cpu.cpp - Copyright (C) 2009 Red Hat, Inc. * Written by Arjun Roy <arroy at redhat.com> * * This program is free software; you can redistribute it and/or modify @@ -39,9 +39,9 @@ template<typename targetType> targetType convert(const std::string& str) if (!(i >> t)) throw invalid_argument("Conversion failure for " + str); return t; -} +} -ostream& operator<<(ostream& output, const CPUWrapper& cpu) +ostream& operator<<(ostream& output, const CPUWrapper& cpu) { output << "Processor" << endl; output << "CPU #: " << cpu.cpunum << endl; @@ -61,7 +61,7 @@ void CPUWrapper::setupQMFObject(ManagementAgent *agent, Manageable *parent) { mgmt_object = new _qmf::CPU(agent, this, parent); agent->addObject(mgmt_object); - syncQMFObject(); + syncQMFObject(); } void CPUWrapper::cleanupQMFObject(void) @@ -85,7 +85,7 @@ void CPUWrapper::syncQMFObject(void) /** * void fillCPUInfo(vector <CPUWrapper*> &cpus, ManagementAgent *agent) - * + * * Takes in a vector of CPUWrapper object pointers and populates it with * CPUs found by querying /proc/cpuinfo. NOTE: This method is very sensitive * to the output format of /proc/cpuinfo. @@ -149,7 +149,7 @@ void CPUWrapper::fillCPUInfo(vector<CPUWrapper*> &cpus, ManagementAgent *agent) string flags = "unknown"; // Get the cpu # from this line - cpunum = convert<int>(line.substr(results[4], + cpunum = convert<int>(line.substr(results[4], results[5] - results[4])); // And now grab the rest do { @@ -162,13 +162,13 @@ void CPUWrapper::fillCPUInfo(vector<CPUWrapper*> &cpus, ManagementAgent *agent) PCRE_NOTEMPTY, // options bitvector results, // Results vector matchArraySize // Vector size - ); + ); if (match == desiredmatches) { - string key = line.substr(results[2], + string key = line.substr(results[2], results[3] - results[2]); - string value = line.substr(results[4], + string value = line.substr(results[4], results[5] - results[4]); if (key == "core id") { @@ -191,11 +191,11 @@ void CPUWrapper::fillCPUInfo(vector<CPUWrapper*> &cpus, ManagementAgent *agent) } else if (key == "flags") { flags = value; } - } - } - while (line != ""); + } + } + while (line != ""); - // Got all the data. Add the CPU to our list + // Got all the data. Add the CPU to our list CPUWrapper *cpu = new CPUWrapper(cpunum, coreid, cpucores, @@ -206,12 +206,11 @@ void CPUWrapper::fillCPUInfo(vector<CPUWrapper*> &cpus, ManagementAgent *agent) cache, vendor, flags); - cpus.push_back(cpu); - } + cpus.push_back(cpu); + } } - else + else continue; } - cpuinfo.close(); + cpuinfo.close(); } - diff --git a/src/cpu.h b/src/cpu.h index e557314..bb3a9b3 100644 --- a/src/cpu.h +++ b/src/cpu.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Red Hat, Inc. +/* cpu.h - Copyright (C) 2009 Red Hat, Inc. * Written by Arjun Roy <arroy at redhat.com> * * This program is free software; you can redistribute it and/or modify @@ -62,15 +62,15 @@ class CPUWrapper : public Manageable ~CPUWrapper() {} CPUWrapper(int cpunum__, - int corenum__, - int numcores__, - int model__, - int family__, - int cpuid_lvl__, - double speed__, - int cache__, - const string &vendor__, - const string &flags__) { + int corenum__, + int numcores__, + int model__, + int family__, + int cpuid_lvl__, + double speed__, + int cache__, + const string &vendor__, + const string &flags__) { cpunum = cpunum__; corenum = corenum__; numcores = numcores__; @@ -82,7 +82,7 @@ class CPUWrapper : public Manageable vendor = vendor__; flags = flags__; } - + public: // Factory like method diff --git a/src/hal.cpp b/src/hal.cpp index 71fcab8..66c1464 100644 --- a/src/hal.cpp +++ b/src/hal.cpp @@ -1,8 +1,5 @@ -/* hal_support.c -- Interfaces with the HAL libraries. - * - * Copyright (C) 2008 Red Hat, Inc. +/* hal_support.c - Copyright (C) 2008 Red Hat, Inc. * Written by Darryl L. Pierce <dpierce at redhat.com> - * Modified by Arjun Roy <arroy at redhat.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -48,7 +45,7 @@ get_hal_ctx(void) fprintf(stderr, "Failed to initial libhal context: %s : %s\n", dbus_error.name, dbus_error.message); - } + } } else { fprintf(stderr, "Unable to connect to system bus: %s : %s\n", dbus_error.name, dbus_error.message); @@ -75,9 +72,9 @@ char* get_uuid(LibHalContext *hal_ctx) int type = libhal_device_get_property_type(hal_ctx, udi, key, &dbus_error); if (type == LIBHAL_PROPERTY_TYPE_STRING) { - value = libhal_device_get_property_string(hal_ctx, - udi, - key, + value = libhal_device_get_property_string(hal_ctx, + udi, + key, &dbus_error); } if (!value) diff --git a/src/hal.h b/src/hal.h index 00390e9..03dd909 100644 --- a/src/hal.h +++ b/src/hal.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Red Hat, Inc. +/* hal.h - Copyright (C) 2009 Red Hat, Inc. * Written by Arjun Roy <arroy at redhat.com> * * This program is free software; you can redistribute it and/or modify diff --git a/src/host.cpp b/src/host.cpp index a9197e3..0d22211 100644 --- a/src/host.cpp +++ b/src/host.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Red Hat, Inc. +/* host.cpp - Copyright (C) 2009 Red Hat, Inc. * Written by Arjun Roy <arroy at redhat.com> * * This program is free software; you can redistribute it and/or modify @@ -49,17 +49,17 @@ ostream& operator<<(ostream &output, const HostWrapper& host) vector<CPUWrapper*> cpus = host.cpus; vector<NICWrapper*> nics = host.nics; - for (vector<CPUWrapper*>::iterator iter = cpus.begin(); - iter!= cpus.end(); - iter++) { + for (vector<CPUWrapper*>::iterator iter = cpus.begin(); + iter!= cpus.end(); + iter++) { output << **iter << endl; } - for (vector<NICWrapper*>::iterator iter = nics.begin(); - iter!= nics.end(); - iter++) { + for (vector<NICWrapper*>::iterator iter = nics.begin(); + iter!= nics.end(); + iter++) { output << **iter << endl; } - + output << "End Node" << endl; return output; } @@ -79,15 +79,15 @@ void HostWrapper::setupQMFObjects(ManagementAgent *agent) syncQMFHostObject(); // Iterate over list and set up CPU objects - for (vector<CPUWrapper*>::iterator iter = cpus.begin(); - iter!= cpus.end(); - iter++) { + for (vector<CPUWrapper*>::iterator iter = cpus.begin(); + iter!= cpus.end(); + iter++) { (*iter)->setupQMFObject(agent, this); } // Iterate over list and set up NIC objects - for (vector<NICWrapper*>::iterator iter = nics.begin(); - iter!= nics.end(); - iter++) { + for (vector<NICWrapper*>::iterator iter = nics.begin(); + iter!= nics.end(); + iter++) { (*iter)->setupQMFObject(agent, this); } } @@ -108,15 +108,15 @@ void HostWrapper::cleanupQMFObjects(void) mgmt_object->resourceDestroy(); // Iterate over list and clean up CPU objects - for (vector<CPUWrapper*>::iterator iter = cpus.begin(); - iter!= cpus.end(); - iter++) { + for (vector<CPUWrapper*>::iterator iter = cpus.begin(); + iter!= cpus.end(); + iter++) { (*iter)->cleanupQMFObject(); } // Iterate over list and clean up NIC objects - for (vector<NICWrapper*>::iterator iter = nics.begin(); - iter!= nics.end(); - iter++) { + for (vector<NICWrapper*>::iterator iter = nics.begin(); + iter!= nics.end(); + iter++) { (*iter)->cleanupQMFObject(); } } @@ -142,7 +142,7 @@ void HostWrapper::disposeHostWrapper() hostSingleton->cleanupQMFObjects(); hostSingleton->cleanupMemberObjects(); - + delete hostSingleton; hostSingleton = NULL; } @@ -197,7 +197,7 @@ HostWrapper* HostWrapper::setupHostWrapper(ManagementAgent *agent) host->memory = info.memory; } } - virConnectClose(connection); + virConnectClose(connection); host->beeping = false; } @@ -228,16 +228,16 @@ void HostWrapper::shutdown() system("shutdown -h now"); } -Manageable::status_t -HostWrapper::ManagementMethod(uint32_t methodId, Args& args, string& text) +Manageable::status_t +HostWrapper::ManagementMethod(uint32_t methodId, Args& args, string& text) { switch(methodId) { case _qmf::Host::METHOD_SHUTDOWN: - shutdown(); - return Manageable::STATUS_OK; + shutdown(); + return Manageable::STATUS_OK; case _qmf::Host::METHOD_REBOOT: - reboot(); - return Manageable::STATUS_OK; + reboot(); + return Manageable::STATUS_OK; } return Manageable::STATUS_NOT_IMPLEMENTED; } diff --git a/src/host.h b/src/host.h index c69a4f3..06bdbf0 100644 --- a/src/host.h +++ b/src/host.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Red Hat, Inc. +/* host.h - Copyright (C) 2009 Red Hat, Inc. * Written by Arjun Roy <arroy at redhat.com> * * This program is free software; you can redistribute it and/or modify @@ -36,7 +36,7 @@ class HostWrapper : public Manageable static HostWrapper *hostSingleton; friend ostream& operator<<(ostream &output, const HostWrapper& host); - + // Host Parameters string uuid; string hostname; @@ -78,7 +78,7 @@ class HostWrapper : public Manageable // QMF Methods ManagementObject* GetManagementObject(void) const { return mgmt_object; } status_t ManagementMethod(uint32_t methodId, Args& args, string& text); - + // Field Accessors const string &getUUID(void) { return uuid; } const string &getHostname(void) { return hostname; } @@ -93,4 +93,3 @@ class HostWrapper : public Manageable // Main Loop void doLoop(void); }; - diff --git a/src/main.cpp b/src/main.cpp index d51c4d9..002a02e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Red Hat, Inc. +/* main.cpp - Copyright (C) 2009 Red Hat, Inc. * Written by Arjun Roy <arroy at redhat.com> * * This program is free software; you can redistribute it and/or modify @@ -190,7 +190,7 @@ int do_main(int argc, char **argv) } catch (...) { cleanup(); - throw; + throw; } // Main loop @@ -205,7 +205,7 @@ int main(int argc, char** argv) { try { return do_main(argc, argv); - } + } catch(std::exception& e) { cout << "Top Level Exception: " << e.what() << endl; } diff --git a/src/nic.cpp b/src/nic.cpp index ae90151..197f5c7 100644 --- a/src/nic.cpp +++ b/src/nic.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Red Hat, Inc. +/* nic.cpp - Copyright (C) 2009 Red Hat, Inc. * Written by Arjun Roy <arroy at redhat.com> * * This program is free software; you can redistribute it and/or modify @@ -83,9 +83,9 @@ void NICWrapper::syncQMFObject(void) mgmt_object->set_bandwidth(bandwidth); } -NICWrapper *NICWrapper::getNIC(ManagementAgent *agent, - LibHalContext *hal_ctx, - char *nic_handle) +NICWrapper *NICWrapper::getNIC(ManagementAgent *agent, + LibHalContext *hal_ctx, + char *nic_handle) { // Used to get the data char *macaddr_c; @@ -102,12 +102,12 @@ NICWrapper *NICWrapper::getNIC(ManagementAgent *agent, string netmask; string broadcast; int bandwidth; - + // Grab the MAC Address from libhal macaddr_c = libhal_device_get_property_string(hal_ctx, - nic_handle, - "net.address", - &dbus_error); + nic_handle, + "net.address", + &dbus_error); // Or throw an exception if we could not find it. No cleanup yet. if (!macaddr_c) throw runtime_error("Could not get mac address for NIC"); @@ -143,7 +143,7 @@ NICWrapper *NICWrapper::getNIC(ManagementAgent *agent, } // Get the netmask ret = ioctl(sock, SIOCGIFNETMASK, &ifr); - if(ret == 0 && strcmp("255.255.255.255", + if(ret == 0 && strcmp("255.255.255.255", inet_ntoa(((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr))) { struct sockaddr_in *addr = (struct sockaddr_in *) &ifr.ifr_addr; @@ -205,11 +205,11 @@ NICWrapper *NICWrapper::getNIC(ManagementAgent *agent, macaddr = macaddr_c; interface = interface_c; nic = new NICWrapper(interface, - macaddr, - ipaddr, - netmask, - broadcast, - bandwidth); + macaddr, + ipaddr, + netmask, + broadcast, + bandwidth); // Free resources and return libhal_free_string(interface_c); @@ -218,23 +218,23 @@ NICWrapper *NICWrapper::getNIC(ManagementAgent *agent, } /** - * void fillNICInfo(vector <NICWrapper*> &nics, - * ManagementAgent *agent, + * void fillNICInfo(vector <NICWrapper*> &nics, + * ManagementAgent *agent, * LibHalContext *hal_ctx) * * Takes in a vector of NICWrapper object pointers and populates it with * NICs found in the system found by querying dbus and making other system * calls. */ -void NICWrapper::fillNICInfo(vector <NICWrapper*> &nics, - ManagementAgent *agent, - LibHalContext *hal_ctx) +void NICWrapper::fillNICInfo(vector <NICWrapper*> &nics, + ManagementAgent *agent, + LibHalContext *hal_ctx) { char **net_devices; int num_results, i; - net_devices = libhal_find_device_by_capability(hal_ctx, + net_devices = libhal_find_device_by_capability(hal_ctx, "net.80203", - &num_results, + &num_results, &dbus_error); if (!net_devices) throw runtime_error("Error: Couldn't get NIC devices through libhal."); @@ -277,20 +277,20 @@ int NICWrapper::identifyNIC(int seconds) close(sock); if (ret != 0) - ret = errno; + ret = errno; return ret; } -Manageable::status_t +Manageable::status_t NICWrapper::ManagementMethod(uint32_t methodId, Args& args, string& text) { switch (methodId) { case _qmf::NIC::METHOD_IDENTIFY_NIC: - _qmf::ArgsNICIdentify_nic& ioArgs = (_qmf::ArgsNICIdentify_nic&) args; - int seconds = ioArgs.i_seconds; - ioArgs.o_ret = identifyNIC(seconds); - return STATUS_OK; + _qmf::ArgsNICIdentify_nic& ioArgs = (_qmf::ArgsNICIdentify_nic&) args; + int seconds = ioArgs.i_seconds; + ioArgs.o_ret = identifyNIC(seconds); + return STATUS_OK; } return STATUS_NOT_IMPLEMENTED; diff --git a/src/nic.h b/src/nic.h index ee14072..15f31fb 100644 --- a/src/nic.h +++ b/src/nic.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Red Hat, Inc. +/* nic.h - Copyright (C) 2009 Red Hat, Inc. * Written by Arjun Roy <arroy at redhat.com> * * This program is free software; you can redistribute it and/or modify @@ -57,11 +57,11 @@ class NICWrapper : public Manageable ~NICWrapper() {} NICWrapper(const string &interfaceName__, - const string &macaddr__, - const string &ipaddr__, - const string &netmask__, - const string &broadcast__, - int bandwidth__) { + const string &macaddr__, + const string &ipaddr__, + const string &netmask__, + const string &broadcast__, + int bandwidth__) { interfaceName = interfaceName__; macaddr = macaddr__; ipaddr = ipaddr__; @@ -69,18 +69,18 @@ class NICWrapper : public Manageable broadcast = broadcast__; bandwidth = bandwidth__; } - - static NICWrapper *getNIC(ManagementAgent *agent, - LibHalContext *hal_ctx, - char *nic_handle); + + static NICWrapper *getNIC(ManagementAgent *agent, + LibHalContext *hal_ctx, + char *nic_handle); int identifyNIC(int seconds); public: // Factory like method - static void fillNICInfo(vector<NICWrapper*> &nics, - ManagementAgent *agent, - LibHalContext *ctx); + static void fillNICInfo(vector<NICWrapper*> &nics, + ManagementAgent *agent, + LibHalContext *ctx); // QMF Methods ManagementObject *GetManagementObject(void) const { return mgmt_object; } @@ -94,4 +94,3 @@ public: const string &getBroadcast(void) { return broadcast; } int getBandwidth(void) { return bandwidth; } }; - -- 1.6.6.1