mingw32-sigar and list interfaces
by Adam Stokes
sigar enumerates pre-defined int's when doing a network list on w32
for (i=0; i<ift->dwNumEntries; i++) {
char name[16];
int key;
MIB_IFROW *ifr = ift->table + i;
sigar_cache_entry_t *entry;
if (strEQ(ifr->bDescr, MS_LOOPBACK_ADAPTER)) {
/* special-case */
sprintf(name, NETIF_LA "%d", la++);
}
else if (ifr->dwType == MIB_IF_TYPE_LOOPBACK) {
sprintf(name, "lo%d", lo++);
}
else if ((ifr->dwType == MIB_IF_TYPE_ETHERNET) ||
(ifr->dwType == IF_TYPE_IEEE80211))
{
sprintf(name, "eth%d", eth++);
}
else {
continue; /*XXX*/
}
So rather than returning w32 friendly adapter name we are left with
things like ethX, loX, etc. The problem with this is that when
attempting to start/stop the network interfaces Windows has no idea
what eth0 is. The fix would be to pull the 'adaptername/friendlyname'
from the interface table structure but that requires getting the patch
accepted upstream. There is always the option of doing a one-off patch
and wouldn't require any additional testing.
thoughts?
( adam stokes ) || ( adam.stokes(a)gmail.com )
13 years, 4 months
[PATCH] Link host/net agents against SIGAR
by Adam Stokes
---
src/CMakeLists.txt | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d5c4995..f4cf1f0 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -56,7 +56,7 @@ set_target_properties(mcommon PROPERTIES SOVERSION ${MCOMMON_VERSION})
add_library (mhost SHARED lib/host.c lib/host_${VARIANT}.c)
set_target_properties(mhost PROPERTIES SOVERSION ${MHOST_VERSION})
-target_link_libraries(mhost mcommon)
+target_link_libraries(mhost mcommon ${SIGAR})
add_library (msrv SHARED lib/services.c lib/services_${VARIANT}.c)
set_target_properties(msrv PROPERTIES SOVERSION ${MSRV_VERSION})
@@ -64,7 +64,7 @@ target_link_libraries(msrv mcommon)
add_library (mnet SHARED lib/network.c lib/network_${VARIANT}.c)
set_target_properties(mnet PROPERTIES SOVERSION ${MNET_VERSION})
-target_link_libraries(mnet mcommon)
+target_link_libraries(mnet mcommon ${SIGAR})
if(WIN32)
target_link_libraries(mhost wsock32)
--
1.7.3.4
13 years, 4 months
[PATCH] Beginnings of Matahari test cases: - One test case added to count active network agents Contributions by Ted Ross <tross@redhat.com> - Rakefile provided to enable an easy way to execute a 'testsuite' (e.g. rake test)
by Adam Stokes
---
src/tests/Rakefile | 29 ++++++++++++++++++++++++++
src/tests/agent.rb | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 87 insertions(+), 0 deletions(-)
create mode 100644 src/tests/Rakefile
create mode 100644 src/tests/agent.rb
diff --git a/src/tests/Rakefile b/src/tests/Rakefile
new file mode 100644
index 0000000..a343e7d
--- /dev/null
+++ b/src/tests/Rakefile
@@ -0,0 +1,29 @@
+#
+# Rakefile: ruby build helpers
+#
+# Copyright (C) 2010 Red Hat Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Author: Adam Stokes <astokes(a)fedoraproject.org>
+#
+
+require 'rake/clean'
+require 'rake/testtask'
+require 'pathname'
+
+Rake::TestTask.new(:test) do |t|
+ t.test_files = FileList['*.rb']
+end
diff --git a/src/tests/agent.rb b/src/tests/agent.rb
new file mode 100644
index 0000000..016f36c
--- /dev/null
+++ b/src/tests/agent.rb
@@ -0,0 +1,58 @@
+#
+# agent.rb: test routines for matahari agents
+#
+# Copyright (C) 2010 Red Hat Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Author: Adam Stokes <astokes(a)fedoraproject.org>
+#
+
+require 'test/unit'
+require 'cqpid'
+require 'qmf2'
+
+class AgentSetup < Test::Unit::TestCase
+ def setup
+ @connection = Cqpid::Connection.new("localhost:49000")
+ @connection.open
+ @session = Qmf2::ConsoleSession.new(@connection)
+ @session.open
+ end
+
+ def teardown
+ @session.close if @session
+ @connection.close if @connection
+ end
+
+ def test_agents
+ @session.set_agent_filter("[eq, _vendor, [quote, 'matahariproject.org']]")
+ net_agent = nil
+ count = 0
+ while :true
+ agent_list = @session.agents
+ agent_list.each do |agent|
+ net_agent = agent if agent.product == 'net'
+ end
+ break if net_agent
+ count = count + 1
+ assert(count < 5)
+ sleep(1)
+ end
+
+ network_agent = net_agent.query("{class:network, package:'org.matahariproject'}")
+ assert_equal(1, network_agent.length)
+ end
+end
--
1.7.3.4
13 years, 4 months
[PATCH] add folders used by matahari-broker initscript
by apevec@redhat.com
/var/lib/matahari
/var/run/matahari
---
matahari.spec | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/matahari.spec b/matahari.spec
index f1a0563..4397050 100644
--- a/matahari.spec
+++ b/matahari.spec
@@ -76,6 +76,9 @@ make DESTDIR=%{buildroot} install
%{__install} matahari.sysconf $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/matahari
%{__install} matahari-broker.sysconf $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/matahari-broker
+%{__install} -d -m0755 %{buildroot}%{_localstatedir}/lib/%{name}
+%{__install} -d -m0755 %{buildroot}%{_localstatedir}/run/%{name}
+
%post
for svc in net host broker; do
/sbin/chkconfig --level 2345 matahari-$svc on
@@ -117,6 +120,9 @@ test "x%{buildroot}" != "x" && rm -rf %{buildroot}
%config(noreplace) %{_sysconfdir}/sysconfig/matahari-broker
%config(noreplace) %{_sysconfdir}/matahari-broker.conf
+%attr(755, qpidd, qpidd) %{_localstatedir}/lib/%{name}
+%attr(755, qpidd, qpidd) %{_localstatedir}/run/%{name}
+
%doc AUTHORS COPYING
%files devel
--
1.7.2.3
13 years, 4 months