(no subject)
by Radek Novacek
The following patch introduces systemd support for Resources API in services agent. To be honest, I'm not quite satisfied with the resources interface. I think we should define the difference between services and resources API more clearly.
As far as I understand it, services API should provide basic access to system services using preferred way on given system (upstart for Fedora < 15, systemd for Fedora >= 15, sysvinit, windows services, etc.). Current list of methods seems OK.
But I'm not sure about resources API. What is the purpose for having it this way? It partially overlaps with services API, but doesn't provide some functions like 'status'. It should have at least defined concepts like standard/provider/agent somewhere. The requirements comes from other project (pacemaker?), right? Do we have it written down somewhere? IMHO we should rethink the concept now, before it will be too late. Or at least document it better, because now it's not clear how to use it.
Radek Novacek
12 years, 6 months
Patch review on broker automated federation
by Adam Stokes
This patch is intended to either be accepted as a way for defining
aggregate or dynamic routes in a federation of brokers.. or would like
feedback on the direction I've taken or any suggestions as to how to improve
the reliability of automating this task.
Thanks
12 years, 7 months
[sigar PATCH] Parse /proc/cpuinfo correctly on non-x86 platforms
by Zane Bitter
S/390, PPC64 & Itanium have different formats for /proc/cpuinfo
Signed-off-by: Zane Bitter <zbitter(a)redhat.com>
---
src/os/linux/linux_sigar.c | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/src/os/linux/linux_sigar.c b/src/os/linux/linux_sigar.c
index e65abd6..1814c98 100644
--- a/src/os/linux/linux_sigar.c
+++ b/src/os/linux/linux_sigar.c
@@ -1515,6 +1515,7 @@ static int get_cpu_info(sigar_t *sigar, processor_info_t *proc,
int found = 0;
memset(proc, 0, sizeof(*proc));
+ info->cores_per_socket = 1;
#ifdef __powerpc64__
SIGAR_SSTRCPY(info->vendor, "IBM");
@@ -1525,6 +1526,29 @@ static int get_cpu_info(sigar_t *sigar, processor_info_t *proc,
case 'p': /* processor : 0 */
if (strnEQ(ptr, "processor", 9)) {
found = 1;
+
+#ifdef __s390__
+ /*
+ * Handle S/390 processors, in the format:
+ * processor 0: version = FF, identification = 32C5C2, machine = 2097
+ * processor 1: version = FF, identification = 32C5C2, machine = 2097
+ */
+ if (sscanf(ptr, "processor %d", &proc->socket) == 1) {
+ ptr = cpu_info_strval(ptr);
+ ptr = strstr(ptr, "machine = ");
+ if (ptr) {
+ ptr = strtok(ptr, ",\n");
+ size_t len = sizeof(info->model) - 1;
+ ptr = strchr(ptr, '=') + 2;
+ strncpy(info->model, ptr, sizeof(info->model));
+ info->model[sizeof(info->model) - 1] = '\0';
+ return found;
+ }
+ }
+#else
+ ptr = cpu_info_strval(ptr);
+ proc->socket = sigar_strtoul(ptr);
+#endif
}
else if (strnEQ(ptr, "physical id", 11)) {
ptr = cpu_info_strval(ptr);
@@ -1591,6 +1615,20 @@ static int get_cpu_info(sigar_t *sigar, processor_info_t *proc,
/* "POWER5 (gr)" -> "POWER5" */
*ptr = '\0';
}
+
+ if (strncmp(info->model, "POWER", 5) == 0) {
+ switch (info->model[5]) {
+ case '5': // POWER5
+ case '6': // POWER6
+ proc->socket /= 2; // 2 threads per core
+ break;
+ case '7': // POWER7
+ proc->socket /= 4; // 4 threads per core
+ break;
+ default:
+ break;
+ }
+ }
}
#endif
break;
12 years, 7 months
Can't compile matahari-agent-example
by Vivek Goyal
Hi,
I cloned matahari-agent-example git tree on Fedora 15. Installed bunch of
packages as ./configure kept on giving me one or other error. After that
"make" fails.
cd /root/git/matahari-agent-example/src/qmf && /usr/bin/c++ -Wall
-Wshadow -I/root/git/matahari-agent-example/src/include
-I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -o
CMakeFiles/matahari-qmf-testagentd.dir/test-qmf.cpp.o -c
/root/git/matahari-agent-example/src/qmf/test-qmf.cpp
/root/git/matahari-agent-example/src/qmf/test-qmf.cpp: In member function
‘virtual gboolean TestAgent::invoke(qmf::AgentSession, qmf::AgentEvent,
gpointer)’:
/root/git/matahari-agent-example/src/qmf/test-qmf.cpp:75:43: error:
‘MH_RES_NOT_IMPLEMENTED’ was not declared in this scope
/root/git/matahari-agent-example/src/qmf/test-qmf.cpp:75:43: error:
‘mh_result_to_str’ was not declared in this scope
make[2]: ***
[src/qmf/CMakeFiles/matahari-qmf-testagentd.dir/test-qmf.cpp.o] Error 1
make[2]: Leaving directory `/root/git/matahari-agent-example'
make[1]: *** [src/qmf/CMakeFiles/matahari-qmf-testagentd.dir/all] Error 2
make[1]: Leaving directory `/root/git/matahari-agent-example'
make: *** [all] Error 2
Thanks
Vivek
12 years, 7 months
[PATCH] Host: rhbz#746288 - Read CPU flags on non-x86 archs
by Zane Bitter
On the S/390 and Itanium architectures, /proc/cpuinfo lists the CPU flags
under "features" instead of "flags". On the PowerPC, "altivec supported"
may be indicated under "cpu".
Signed-off-by: Zane Bitter <zbitter(a)redhat.com>
---
src/lib/host_linux.c | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/src/lib/host_linux.c b/src/lib/host_linux.c
index 304592a..138aff4 100644
--- a/src/lib/host_linux.c
+++ b/src/lib/host_linux.c
@@ -102,7 +102,26 @@ host_os_get_cpu_flags(void)
0, PCRE_NOTEMPTY, found,
sizeof(found) / sizeof(found[0]));
- if (match != expected || strncmp(cur + found[2], "flags", 5)) {
+ if (match != expected) {
+ continue;
+ }
+
+ // PowerPC
+ if (strncmp(cur + found[2], "cpu ", 4)) {
+ static const char *altivec = "altivec";
+ char *p = strstr(cur + found[4], altivec);
+ if (p && (p - cur) < found[5]) {
+
+ if (!(flags = malloc(sizeof(altivec)))) {
+ goto done;
+ }
+ mh_string_copy(flags, altivec, sizeof(altivec));
+ break;
+ }
+ }
+
+ if (strncmp(cur + found[2], "flags", 5) &&
+ strncmp(cur + found[2], "features", 8)) {
continue;
}
12 years, 7 months
Services agent in Fedora 16+
by Russell Bryant
Greetings,
I came across an issue with how the services agent works that makes it
seriously impaired in Fedora 16 and above (systems that make heavy use
of systemd).
The services agent supports two different "standards" on Linux: OCF and
LSB. In the OCF case, it's executing OCF resource agents. That's all
fine. In the LSB case, it's running scripts in /etc/init.d. Also keep
in mind that there are two APIs in the services agent: Services and
Resources. The Resources API is the more advanced version. The
Services API is much simpler, and uses the code for the LSB standard
under the hood.
For example, if you run this QMF API call:
Services::start("httpd")
that turns into running this command on the host:
# /etc/init.d/httpd start
Some work is needed here. Here is a first pass at what I think needs to
be done.
1) Add a "systemd" standard to the Resources API.
I don't think we need to venture into adding any new API calls here. We
should just make the existing API work.
2) Change the Services agent to use the systemd API if possible, and
fall back to the LSB if systemd is not in use.
Comments welcome.
Thanks,
--
Russell Bryant
12 years, 7 months
[PATCH] Build: Fix make install
by Zane Bitter
Signed-off-by: Zane Bitter <zbitter(a)redhat.com>
---
CMakeLists.txt | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1978d82..077687d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -168,7 +168,7 @@ else(WIN32)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/matahari-broker.service DESTINATION ${systemdunitdir})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/matahari-vios-proxy-host.service DESTINATION ${systemdunitdir})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/matahari-vios-proxy-guest.service DESTINATION ${systemdunitdir})
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/99-matahari-guest-agent.rules DESTINATION ${sysconfdir}/udev/rules.d)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/99-matahari-guest-agent.rules DESTINATION ${sysconfdir}/udev/rules.d)
endif(systemd_FOUND)
endif(WIN32)
12 years, 7 months
[PATCH v2] Core: Enable SSL support in agents
by Zane Bitter
---
matahari-broker.sysconf.in | 5 ++
matahari.init.in | 3 +
matahari.spec.in | 1
matahari.sysconf.in | 12 +++--
src/CMakeLists.txt | 9 ++++
src/broker/broker_federation.c | 9 +++-
src/lib/mh_agent.cpp | 97 ++++++++++++++++++++++------------------
7 files changed, 86 insertions(+), 50 deletions(-)
diff --git a/matahari-broker.sysconf.in b/matahari-broker.sysconf.in
index 4d3cf12..cd3d942 100644
--- a/matahari-broker.sysconf.in
+++ b/matahari-broker.sysconf.in
@@ -7,8 +7,11 @@ QPIDD_OPTIONS="--config @sysconfdir(a)/matahari-broker.conf"
# The following formats are allowed:
# Hostname and port
# <fqdn>:<port>
-# DNS SRV query format ("_matahari._tcp" is REQUIRED)
+# amqp:tcp:<fqdn>:<port>
+# amqp:ssl:<fqdn>:<port>
+# DNS SRV query format ("_matahari._<protocol>" is REQUIRED)
# _matahari._tcp.<fqdn>
+# _matahari._tls.<fqdn>
#
# Note that only the first (highest priority) SRV record returned by the DNS
# for each given query will be used.
diff --git a/matahari.init.in b/matahari.init.in
index 323ad89..ba9df14 100644
--- a/matahari.init.in
+++ b/matahari.init.in
@@ -47,6 +47,9 @@ start() {
fi
+ export QPID_SSL_CERT_DB
+ export QPID_SSL_CERT_PASSWORD_FILE
+
daemon $PROCESS $MATAHARI_ARGS --daemon
RETVAL=$?
echo
diff --git a/matahari.spec.in b/matahari.spec.in
index cabc6ba..74e9f1d 100644
--- a/matahari.spec.in
+++ b/matahari.spec.in
@@ -53,6 +53,7 @@ BuildRequires: pcre-devel
BuildRequires: glib2-devel
BuildRequires: sigar-devel
BuildRequires: libcurl-devel
+BuildRequires: nss-devel
BuildRequires: help2man
BuildRequires: augeas-devel >= 0.9.0
diff --git a/matahari.sysconf.in b/matahari.sysconf.in
index edd0065..e84e0cc 100644
--- a/matahari.sysconf.in
+++ b/matahari.sysconf.in
@@ -9,12 +9,16 @@ MATAHARI_BROKER=@MATAHARI_BROKER@
# Other options that all agents should observe
MATAHARI_AGENT_ARGS="--reconnect=yes"
+# SSL client options
+#QPID_SSL_CERT_DB=
+#QPID_SSL_CERT_PASSWORD_FILE=
+
# Other options that all consoles should observe
-# MATAHARI_CONSOLE_ARGS=...
+#MATAHARI_CONSOLE_ARGS=
# Per agent options
-# host_AGENT_ARGS=...
-# network_AGENT_ARGS=...
+#host_AGENT_ARGS=
+#network_AGENT_ARGS=
# Per console options
-# sysconfig_CONSOLE_ARGS=...
+#sysconfig_CONSOLE_ARGS=
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index bcc2ca5..b9f546f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -10,6 +10,15 @@ if(WIN32)
else(WIN32)
set(VARIANT "linux")
+
+ # Enable TLS/SSL support
+ add_definitions(-DMH_SSL)
+ execute_process(COMMAND nss-config --includedir
+ OUTPUT_VARIABLE NSS_INCLUDE)
+ execute_process(COMMAND nspr-config --includedir
+ OUTPUT_VARIABLE NSPR_INCLUDE)
+ include_directories(${NSS_INCLUDE} ${NSPR_INCLUDE})
+
# DBus makes sense only on linux
# WITH-DBUS == OFF means no DBus,
# TRY means autodetection
diff --git a/src/broker/broker_federation.c b/src/broker/broker_federation.c
index f4d09bb..e775d3e 100644
--- a/src/broker/broker_federation.c
+++ b/src/broker/broker_federation.c
@@ -31,7 +31,12 @@
#include "broker_federation.h"
-#define DNS_SRV_PREFIX "_matahari._tcp."
+#define DNS_SRV_PREFIX_TCP "_matahari._tcp."
+#define DNS_SRV_PREFIX_TLS "_matahari._tls."
+
+#define IS_DNS_SRV(ADDR, TYPE) (strncmp(ADDR, \
+ DNS_SRV_PREFIX_##TYPE, \
+ strlen(DNS_SRV_PREFIX_##TYPE)) == 0)
#define ROUTE_LIST(LOCAL, REMOTE) { \
{REMOTE, LOCAL, "amq.direct"}, \
@@ -102,7 +107,7 @@ void broker_federation_configure(void)
mh_string_copy(peers, brokers, sizeof(peers));
while ((peer = strtok_r(p ? NULL : peers, ",; ", &p)) != NULL) {
- if (strncmp(peer, DNS_SRV_PREFIX, strlen(DNS_SRV_PREFIX)) == 0) {
+ if (IS_DNS_SRV(peer, TCP) || IS_DNS_SRV(peer, TLS)) {
peer = broker_lookup(peer);
}
diff --git a/src/lib/mh_agent.cpp b/src/lib/mh_agent.cpp
index 5aee0a9..5417680 100644
--- a/src/lib/mh_agent.cpp
+++ b/src/lib/mh_agent.cpp
@@ -37,7 +37,6 @@
#include <qpid/sys/Time.h>
#include <qpid/agent/ManagementAgent.h>
#include <qpid/client/ConnectionSettings.h>
-// #include <qpid/sys/ssl/util.h>
#include <qmf/DataAddr.h>
#include "matahari/agent.h"
@@ -49,6 +48,9 @@ extern "C" {
#ifndef WIN32
#include <sys/socket.h>
#include <netdb.h>
+#ifdef MH_SSL
+#include <secmod.h>
+#endif
#endif
}
@@ -175,7 +177,8 @@ map_option(int code, const char *name, const char *arg, void *userdata)
(*options)["servername"] = arg;
} else if(strcmp(name, "port") == 0) {
- (*options)["serverport"] = atoi(arg);
+ uint16_t port = atoi(arg);
+ (*options)["serverport"] = port;
} else if(strcmp(name, "dns-srv") == 0) {
(*options)["dns-srv"] = 1;
@@ -186,35 +189,6 @@ map_option(int code, const char *name, const char *arg, void *userdata)
return 0;
}
-#ifdef MH_SSL
-static int
-ssl_option(int code, const char *name, const char *arg, void *userdata)
-{
- qpid::sys::ssl::SslOptions *options = static_cast<qpid::sys::ssl::SslOptions*>(userdata);
-
- if(strcmp(name, "ssl-cert-db") == 0) {
- options->certDbPath = strdup(arg);
- setenv("QPID_SSL_CERT_DB", arg, 1);
- if (!g_file_test(arg, G_FILE_TEST_IS_DIR)) {
- fprintf(stderr, "SSL Certificate database is not accessible. See --help\n");
- exit(1);
- }
-
- } else if(strcmp(name, "ssl-cert-name") == 0) {
- options->certName = strdup(arg);
-
- } else if(strcmp(name, "ssl-cert-password-file") == 0) {
- options->certPasswordFile = strdup(arg);
- setenv("QPID_SSL_CERT_PASSWORD_FILE", arg, 1);
- if (!g_file_test(arg, G_FILE_TEST_EXISTS)) {
- fprintf(stderr, "SSL Password file is not accessible. See --help.\n");
- exit(1);
- }
- }
- return 0;
-}
-#endif /* MH_SSL */
-
static int
connection_option(int code, const char *name, const char *arg, void *userdata)
{
@@ -228,7 +202,11 @@ connection_option(int code, const char *name, const char *arg, void *userdata)
strcasecmp(arg, "false") != 0);
(*options)["reconnect"] = reconnect;
} else {
- (*options)[name] = arg;
+ if (arg) {
+ (*options)[name] = arg;
+ } else {
+ (*options)[name] = true;
+ }
}
return 0;
}
@@ -313,10 +291,12 @@ mh_connect(OptionsMap mh_options, OptionsMap amqp_options, int retry)
std::stringstream query;
+ query << "_matahari.";
+ query << ((mh_options["protocol"]) == "ssl" ? "_tls" : "_tcp") << ".";
if (mh_options.count("servername")) {
- query << "_matahari._tcp." << mh_options["servername"];
+ query << mh_options["servername"];
} else {
- query << "_matahari._tcp." << mh_dnsdomainname();
+ query << mh_dnsdomainname();
}
if ((cur_srv_record = srv_records = mh_dnssrv_lookup(query.str().c_str()))) {
@@ -394,6 +374,7 @@ read_environment(OptionsMap& options)
if (!mh_strlen_zero(data)) {
options["serverport"] = data;
}
+
data = getenv("KRB5_KEYTAB");
if (!mh_strlen_zero(data)) {
options["krb5_keytab"] = data;
@@ -407,6 +388,27 @@ read_environment(OptionsMap& options)
} else {
options["krb5_interval"] = "10";
}
+
+#ifdef MH_SSL
+ data = getenv("QPID_SSL_CERT_DB");
+ if (!mh_strlen_zero(data)) {
+ options["ssl-cert-db"] = data;
+ if (!g_file_test(data, G_FILE_TEST_IS_DIR)) {
+ mh_crit("SSL Certificate database is not accessible. See --help");
+ exit(1);
+ }
+ }
+
+ data = getenv("QPID_SSL_CERT_NAME");
+ if (!mh_strlen_zero(data)) {
+ options["ssl-cert-name"] = data;
+ }
+
+ data = getenv("QPID_SSL_CERT_PASSWORD_FILE");
+ if (!mh_strlen_zero(data)) {
+ options["ssl-cert-password-file"] = data;
+ }
+#endif /* MH_SSL */
}
static void
@@ -456,10 +458,8 @@ mh_parse_options(const char *proc_name, int argc, char **argv, OptionsMap &optio
mh_add_option('r', required_argument, "reconnect", "attempt to reconnect if the broker connection is lost", &amqp_options, connection_option);
#ifdef MH_SSL
- qpid::sys::ssl::SslOptions ssl_options;
- mh_add_option('n', required_argument, "ssl-cert-name", "name of the certificate to use", &ssl_options, ssl_option);
- mh_add_option('C', required_argument, "ssl-cert-db", "file containing the certificate database", &ssl_options, ssl_option);
- mh_add_option('f', required_argument, "ssl-cert-password-file", "file containing the certificate password", &ssl_options, ssl_option);
+ mh_add_option('n', required_argument, "ssl-cert-name", "name of the certificate to use", &amqp_options, connection_option);
+ mh_add_option('t', no_argument, "use-tls", "Use TLS/SSL encryption", &options, connection_option);
#endif
#ifdef WIN32
@@ -540,13 +540,19 @@ mh_parse_options(const char *proc_name, int argc, char **argv, OptionsMap &optio
#endif
#ifdef MH_SSL
- if (ssl_options.certDbPath && ssl_options.certName && ssl_options.certPasswordFile) {
+ if (options.count("use-tls")) {
options["protocol"] = "ssl";
- qpid::sys::ssl::initNSS(ssl_options, true);
- } else if (ssl_options.certDbPath || ssl_options.certName || ssl_options.certPasswordFile) {
- fprintf(stderr, "To enable SSL, you must supply a cert name, db and password file. See --help.\n");
- exit(1);
+ if (!options.count("ssl-cert-db")) {
+ mh_warn("To enable SSL, you must supply a certificate database");
+ }
+ if (!options.count("ssl-cert-password-file")) {
+ mh_warn("To enable SSL, you must supply a certificate password file");
+ }
+ if (!(amqp_options.count("ssl-cert-name") ||
+ options.count("ssl-cert-name"))) {
+ mh_warn("No SSL certificate name specified");
+ }
}
#endif
@@ -584,6 +590,11 @@ mh_should_daemonize(int code, const char *name, const char *arg, void *userdata)
// Don't attempt to log to the console
mh_enable_stderr(false);
+
+#ifdef MH_SSL
+ // NSS doesn't like being fork()ed.
+ SECMOD_RestartModules(PR_FALSE);
+#endif
#endif
return 0;
12 years, 7 months
Fwd: CFP: High Availability and Distributed Storage miniconf at LCA 2012
by Tim Serong
Just in case there's anyone on matahari or pcmk-cloud who hasn't already
seen this via one of the other HA mailing lists... :)
-------- Original Message --------
Subject: CFP: High Availability and Distributed Storage miniconf at LCA 2012
Date: Mon, 10 Oct 2011 12:46:38 +1100
From: Tim Serong <tserong(a)suse.com>
Reply-To: tserong(a)suse.com
To: ha-wg(a)lists.linux-foundation.org, General Linux-HA mailing list
<linux-ha(a)lists.linux-ha.org>, linux-ha-dev(a)lists.linux-ha.org,
drbd-user(a)lists.linbit.com, linux-cluster(a)redhat.com,
ocfs2-users(a)oss.oracle.com, The Pacemaker cluster resource manager
<pacemaker(a)oss.clusterlabs.org>, samba-technical(a)lists.samba.org,
discuss(a)corosync.org
Hi All,
I'm pleased to announce that we will be hosting a one day High
Availability and Distributed Storage mini conference on January 16 2012,
as part of linux.conf.au in Ballarat, Australia.
We would like to invite proposals for presentations to be delivered at
the miniconf. Please feel free to forward this CFP to your colleagues
and other relevant mailing lists.
Suggested topics for presentations include (but are not limited to):
- Cluster resource management
- Cluster membership/messaging
- Clustered filesystems
- Distributed storage
- SQL and NoSQL databases
- Caching layers
The CFP is open until November 6. Proposals can be submitted at:
http://tinyurl.com/ha-lca2012-cfp
If you have any questions, please feel free to contact me directly
(please do not group reply to this announcement).
Note that as this miniconf is part of linux.conf.au, you will need to
register to attend the main conference
(http://linux.conf.au/register/prices). Unfortunately we have no
sponsorship budget for speakers, so presenting at the miniconf does not
entitle you to discounted or free registration. If you need help
convincing your employer to fund your travel, please see
http://linux.conf.au/register/business-case - this is *the* Linux
conference to be at in the southern hemisphere!
Regards,
Tim
--
Tim Serong
Senior Clustering Engineer
SUSE
tserong(a)suse.com
12 years, 7 months
[PATCH] - Include matahari specific vios-proxy host and guest initiscripts
by Adam Stokes
- Support for loading vios-proxy-guest or vios-proxy-host with
our defined configuration items.
- Supports sysv and systemd
- Uses /var/lib/libvirt for any proxy related devices
- Configuration options available to set service directory and port
Signed-off-by: Adam Stokes <astokes(a)fedoraproject.org>
---
99-matahari-guest-agent.rules | 2 +
CMakeLists.txt | 22 ++++++++
matahari-vios-proxy-guest.init.in | 96 ++++++++++++++++++++++++++++++++++
matahari-vios-proxy-guest.service.in | 12 ++++
matahari-vios-proxy-host.init.in | 96 ++++++++++++++++++++++++++++++++++
matahari-vios-proxy-host.service.in | 21 +++++++
matahari-vios-proxy.sysconf.in | 7 +++
matahari.spec.in | 71 +++++++++++++++++++++++++
8 files changed, 327 insertions(+), 0 deletions(-)
create mode 100644 99-matahari-guest-agent.rules
create mode 100644 matahari-vios-proxy-guest.init.in
create mode 100644 matahari-vios-proxy-guest.service.in
create mode 100644 matahari-vios-proxy-host.init.in
create mode 100644 matahari-vios-proxy-host.service.in
create mode 100644 matahari-vios-proxy.sysconf.in
diff --git a/99-matahari-guest-agent.rules b/99-matahari-guest-agent.rules
new file mode 100644
index 0000000..8cfacee
--- /dev/null
+++ b/99-matahari-guest-agent.rules
@@ -0,0 +1,2 @@
+SUBSYSTEM=="virtio-ports", ATTR{name}}=="org.matahariproject.vios_proxy.0", \
+ TAG+="systemd" ENV{SYSTEMD_WANTS}="matahari-vios-proxy-guest.service"
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 94a0be9..1978d82 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -123,9 +123,20 @@ else(WIN32)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/matahari-broker.sysconf.in
${CMAKE_CURRENT_BINARY_DIR}/matahari-broker.sysconf @ONLY)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/matahari-vios-proxy-host.init.in
+ ${CMAKE_CURRENT_BINARY_DIR}/matahari-vios-proxy-host.init @ONLY)
+
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/matahari-vios-proxy-guest.init.in
+ ${CMAKE_CURRENT_BINARY_DIR}/matahari-vios-proxy-guest.init @ONLY)
+
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/matahari-vios-proxy.sysconf.in
+ ${CMAKE_CURRENT_BINARY_DIR}/matahari-vios-proxy.sysconf @ONLY)
+
install(DIRECTORY DESTINATION ${localstatedir}/lib/matahari
DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_WRITE GROUP_EXECUTE)
+
+
install(CODE "execute_process(COMMAND chown root:qpidd ${localstatedir}/lib/matahari)")
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/matahari-broker DESTINATION ${initdir})
@@ -136,6 +147,8 @@ else(WIN32)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/matahari-broker.conf DESTINATION ${sysconfdir})
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/matahari-vios-proxy.sysconf DESTINATION ${sysconfdir}/sysconfig RENAME matahari-vios-proxy)
+
# Check for systemd
include(FindPkgConfig)
pkg_check_modules(systemd systemd)
@@ -146,7 +159,16 @@ else(WIN32)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/matahari-broker.service.in
${CMAKE_CURRENT_BINARY_DIR}/matahari-broker.service)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/matahari-vios-proxy-host.service.in
+ ${CMAKE_CURRENT_BINARY_DIR}/matahari-vios-proxy-host.service)
+
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/matahari-vios-proxy-guest.service.in
+ ${CMAKE_CURRENT_BINARY_DIR}/matahari-vios-proxy-guest.service)
+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/matahari-broker.service DESTINATION ${systemdunitdir})
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/matahari-vios-proxy-host.service DESTINATION ${systemdunitdir})
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/matahari-vios-proxy-guest.service DESTINATION ${systemdunitdir})
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/99-matahari-guest-agent.rules DESTINATION ${sysconfdir}/udev/rules.d)
endif(systemd_FOUND)
endif(WIN32)
diff --git a/matahari-vios-proxy-guest.init.in b/matahari-vios-proxy-guest.init.in
new file mode 100644
index 0000000..c85f712
--- /dev/null
+++ b/matahari-vios-proxy-guest.init.in
@@ -0,0 +1,96 @@
+#!/bin/sh
+
+# the following is chkconfig init header
+# matahari-vios-proxy-guest: Initscript for Matahari specific vios-proxy
+### BEGIN INIT INFO
+# Provides:
+# Required-Start: $local_fs matahari-broker
+# Required-Stop: $local_fs matahari-broker
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Starts and stops vios proxy guest daemon
+# Description: Matahari initscript for Vios Proxy Guest
+### END INIT INFO
+
+# chkconfig: - 99 01
+# description: Matahari initscript for Vios Proxy Guest
+# processname: matahari-vios-proxy-guest
+# pidfile: @localstatedir(a)/run/matahari-vios-proxy-guest.pid
+#
+
+# Turn off automatic systemd redirects
+#SYSTEMCTL_SKIP_REDIRECT=1
+
+# Source function library.
+. @sysconfdir(a)/rc.d/init.d/functions
+
+PROCESS=vios-proxy-guest
+
+RETVAL=0
+
+# Source function library.
+. @sysconfdir(a)/rc.d/init.d/functions
+
+if [ -f @sysconfdir@/sysconfig/matahari-vios-proxy ]; then
+ . @sysconfdir@/sysconfig/matahari
+fi
+
+start() {
+ echo -n $"Starting the $PROCESS daemon: "
+
+ daemon $PROCESS $VP_H_GUEST_DIR $VP_H_SERVICE_DIR
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && touch @localstatedir@/lock/subsys/$PROCESS
+}
+
+stop() {
+ echo -n $"Stopping the $PROCESS daemon: "
+
+ killproc $PROCESS
+ RETVAL=$?
+ echo
+ if [ $RETVAL -eq 0 ]; then
+ rm -f @localstatedir@/lock/subsys/$PROCESS
+ rm -f @localstatedir(a)/run/$PROCESS.pid
+ fi
+}
+
+restart() {
+ stop
+ start
+}
+
+reload() {
+ echo -n $"Reloading the $PROCESS configuration: "
+
+ killproc $PROCESS -HUP
+ RETVAL=$?
+ echo
+ return $RETVAL
+}
+
+# See how we were called.
+case "$1" in
+ start)
+ status $PROCESS >/dev/null || $1
+ ;;
+ stop|restart|reload)
+ $1
+ ;;
+ status)
+ status $PROCESS
+ RETVAL=$?
+ ;;
+ force-reload)
+ reload
+ ;;
+ condrestart|try-restart)
+ [ -f @localstatedir@/lock/subsys/$PROCESS ] && restart || :
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
+ exit 1
+ ;;
+esac
+exit $RETVAL
diff --git a/matahari-vios-proxy-guest.service.in b/matahari-vios-proxy-guest.service.in
new file mode 100644
index 0000000..b1ec32d
--- /dev/null
+++ b/matahari-vios-proxy-guest.service.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=Matahari Vios Proxy Guest
+BindTo=dev-virtio\x2dports-org.matahariproject.vios_proxy.0.device
+After=dev-virtio\x2dports-org.matahariproject.vios_proxy.0.device
+
+[Service]
+EnvironmentFile=@sysconfdir@/sysconfig/matahari-vios-proxy
+ExecStart=-/usr/bin/vios-proxy-guest $VP_G_HOST_DIR $VP_G_SERVICE_PORT
+Restart=always
+RestartSec=0
+
+[Install]
diff --git a/matahari-vios-proxy-host.init.in b/matahari-vios-proxy-host.init.in
new file mode 100644
index 0000000..098b9bd
--- /dev/null
+++ b/matahari-vios-proxy-host.init.in
@@ -0,0 +1,96 @@
+#!/bin/sh
+
+# the following is chkconfig init header
+# matahari-vios-proxy-host: Initscript for Matahari specific vios-proxy
+### BEGIN INIT INFO
+# Provides:
+# Required-Start: $local_fs matahari-broker
+# Required-Stop: $local_fs matahari-broker
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Starts and stops vios proxy host daemon
+# Description: Matahari initscript for Vios Proxy Host
+### END INIT INFO
+
+# chkconfig: - 99 01
+# description: Matahari initscript for Vios Proxy Host
+# processname: matahari-vios-proxy-host
+# pidfile: @localstatedir(a)/run/matahari-vios-proxy-host.pid
+#
+
+# Turn off automatic systemd redirects
+#SYSTEMCTL_SKIP_REDIRECT=1
+
+# Source function library.
+. @sysconfdir(a)/rc.d/init.d/functions
+
+PROCESS=vios-proxy-host
+
+RETVAL=0
+
+# Source function library.
+. @sysconfdir(a)/rc.d/init.d/functions
+
+if [ -f @sysconfdir@/sysconfig/matahari-vios-proxy ]; then
+ . @sysconfdir@/sysconfig/matahari
+fi
+
+start() {
+ echo -n $"Starting the $PROCESS daemon: "
+
+ daemon $PROCESS $VP_H_GUEST_DIR $VP_H_SERVICE_DIR
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && touch @localstatedir@/lock/subsys/$PROCESS
+}
+
+stop() {
+ echo -n $"Stopping the $PROCESS daemon: "
+
+ killproc $PROCESS
+ RETVAL=$?
+ echo
+ if [ $RETVAL -eq 0 ]; then
+ rm -f @localstatedir@/lock/subsys/$PROCESS
+ rm -f @localstatedir(a)/run/$PROCESS.pid
+ fi
+}
+
+restart() {
+ stop
+ start
+}
+
+reload() {
+ echo -n $"Reloading the $PROCESS configuration: "
+
+ killproc $PROCESS -HUP
+ RETVAL=$?
+ echo
+ return $RETVAL
+}
+
+# See how we were called.
+case "$1" in
+ start)
+ status $PROCESS >/dev/null || $1
+ ;;
+ stop|restart|reload)
+ $1
+ ;;
+ status)
+ status $PROCESS
+ RETVAL=$?
+ ;;
+ force-reload)
+ reload
+ ;;
+ condrestart|try-restart)
+ [ -f @localstatedir@/lock/subsys/$PROCESS ] && restart || :
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
+ exit 1
+ ;;
+esac
+exit $RETVAL
diff --git a/matahari-vios-proxy-host.service.in b/matahari-vios-proxy-host.service.in
new file mode 100644
index 0000000..aa4a77d
--- /dev/null
+++ b/matahari-vios-proxy-host.service.in
@@ -0,0 +1,21 @@
+[Unit]
+Description=Matahari specific requirements for a Vios proxy host
+After=syslog.target
+Requires=syslog.target
+
+[Install]
+WantedBy=multi-user.target
+
+[Service]
+Type=simple
+NotifyAccess=all
+SysVStartPriority=85
+User=root
+Group=root
+
+EnvironmentFile=@sysconfdir@/sysconfig/matahari-vios-proxy
+
+ExecStart=/usr/bin/vios-proxy-host $VP_H_GUEST_DIR $VP_H_SERVICE_PORT
+
+# Restart options include: no, on-success, on-failure, on-abort or always
+Restart=on-failure
diff --git a/matahari-vios-proxy.sysconf.in b/matahari-vios-proxy.sysconf.in
new file mode 100644
index 0000000..abe83c0
--- /dev/null
+++ b/matahari-vios-proxy.sysconf.in
@@ -0,0 +1,7 @@
+# VIOS Proxy Host configuration
+VP_H_GUEST_DIR=/var/lib/libvirt
+VP_H_SERVICE_PORT=49000
+
+# VIOS Proxy Guest configuration
+VP_G_HOST_DIR=/dev/virtio-ports
+VP_G_SERVICE_PORT=48999
diff --git a/matahari.spec.in b/matahari.spec.in
index 4bafef7..b52516e 100644
--- a/matahari.spec.in
+++ b/matahari.spec.in
@@ -104,6 +104,26 @@ Requires: qmf > 0.7
Optional AMQP Broker for Matahari
%endif
+%package vios-proxy-host
+License: ASL 2.0
+Summary: Network proxy using virtioserial for QEMU host
+Group: Applications/System
+Requires: %{name}-broker = %{version}-%{release}
+Requires: vios-proxy-host
+
+%description vios-proxy-host
+%{name} specific host initialization scripts
+
+%package vios-proxy-guest
+License: ASL 2.0
+Summary: Network proxy using virtioserial for QEMU guest
+Group: Applications/System
+Requires: %{name}-broker = %{version}-%{release}
+Requires: vios-proxy-guest
+
+%description vios-proxy-guest
+%{name} specific guest initialization scripts
+
%package lib
License: GPLv2+
Summary: C libraries used by Matahari agents
@@ -213,6 +233,8 @@ rm -f $RPM_BUILD_ROOT/%{_sysconfdir}/rc.d/init.d/matahari-host
rm -f $RPM_BUILD_ROOT/%{_sysconfdir}/rc.d/init.d/matahari-sysconfig
rm -f $RPM_BUILD_ROOT/%{_sysconfdir}/rc.d/init.d/matahari-sysconfig-console
rm -f $RPM_BUILD_ROOT/%{_sysconfdir}/rc.d/init.d/matahari-broker
+rm -f $RPM_BUILD_ROOT/%{_sysconfdir}/rc.d/init.d/matahari-vios-proxy-host
+rm -f $RPM_BUILD_ROOT/%{_sysconfdir}/rc.d/init.d/matahari-vios-proxy-guest
%endif
%post -n matahari-lib -p /sbin/ldconfig
@@ -329,6 +351,26 @@ if [ "$1" -ge "1" ]; then
/sbin/service matahari-broker condrestart >/dev/null 2>&1 || :
fi
+#== Vios Proxy Host
+%post vios-proxy-host
+%if %{systemd}
+systemctl --system daemon-reload
+%endif
+/sbin/service matahari-vios-proxy-host condrestart
+
+%preun vios-proxy-host
+if [ $1 = 0 ]; then
+ /sbin/service matahari-vios-proxy-host stop >/dev/null 2>&1 || :
+%if !%{systemd}
+ chkconfig --del matahari-vios-proxy-host
+%endif
+fi
+
+%postun vios-proxy-host
+if [ "$1" -ge "1" ]; then
+ /sbin/service matahari-vios-proxy-host condrestart >/dev/null 2>&1 || :
+fi
+
#== Core
%pre core
@@ -511,6 +553,35 @@ test "x%{buildroot}" != "x" && rm -rf %{buildroot}
%exclude %{_sysconfdir}/matahari-broker.conf
%endif
+%files vios-proxy-host
+%defattr(644, root, root, 755)
+%config(noreplace) %{_sysconfdir}/sysconfig/matahari-vios-proxy
+
+%if %{systemd}
+%{_unitdir}/matahari-vios-proxy-host.service
+%endif
+
+%if %{with qmf}
+%if !%{systemd}
+%attr(755, root, root) %{_initddir}/matahari-vios-proxy-host
+%endif
+%endif
+
+%files vios-proxy-guest
+%defattr(644, root, root, 755)
+%{_sysconfdir}/udev/rules.d/99-matahari-guest-agent.rules
+%config(noreplace) %{_sysconfdir}/sysconfig/matahari-vios-proxy
+
+%if %{systemd}
+%{_unitdir}/matahari-vios-proxy-guest.service
+%endif
+
+%if %{with qmf}
+%if !%{systemd}
+%attr(755, root, root) %{_initddir}/matahari-vios-proxy-guest
+%endif
+%endif
+
%files devel
%defattr(644, root, root, 755)
%doc AUTHORS COPYING
--
1.7.6.4
12 years, 7 months