Whitespace
by Andrew Beekhof
You'll be happy to know I have enabled the following from
http://www.jwz.org/doc/tabs-vs-spaces.html for all C/C++ files
[quote]
To cause TAB characters to not be used in the file for compression,
and for only spaces to be used, do this:
(setq indent-tabs-mode nil)
[/quote]
And I still only have to press the TAB-key so everyone can be happy.
12 years, 8 months
Documentation for Matahari users
by Russell Bryant
Greetings,
Documentation is absolutely critical for the success of our project.
I've spent some time thinking about documentation for our users. Here
is my proposal for the direction we should take.
---- Existing Documentation
First, it's worth looking at what we have so far. We have 2
documentation sets up and running so far:
a) http://matahariproject.org/dev-manual/
b) http://clusterlabs.org/doxygen/matahari/1f5dfea/index.html
There is not necessarily overlap between the content, but the audience
for these two sets of documentation is the same: people working on
matahari itself. If all goes as planned, there will be a much larger
audience that needs documentation from us: those that write applications
against the agents we provide.
---- To-Do
The gap in the documentation we have today is for the users of the
matahari agents. I don't think it's in the scope of our project to
document how to write applications using QMF or DBus in general.
However, we can help fill in the gaps in this area as we see fit. One
of the biggest things we can do here is provide good examples in our
project.
It is definitely within the scope of our project to make it quick and
easy to figure out the details of the APIs we provide.
Andrew has done some nice work demonstrating how an XSLT can be used to
transform the schema files into another format. Take a look:
$ xsltproc doc/api.xsl src/host/schema.xml
I think we can take this, run with it, and end up with some great docs.
Proposed steps:
1) Continue adding documentation in the schema. For some items, the
schema already provides a place to include a description. For more
verbose descriptions of methods, etc., we can place it in an XML comment
above the entry in the schema. The host schema has some examples of
this and the existing XSLT demonstrates how we can grab the contents of
the comment. We should go through and add documentation for
_everything_ in the schemas.
2) Use the existing docbook manual (dev-manual in links above) as the
base for the documentation. Move the existing content to be a "Writing
a new agent" chapter.
3) Create two new chapters:
- Chapter 1: Project Overview
Go over the project from a user's point of view. List the
agents that we have and at a high level, what they provide.
- Matahari APIs
The APIs we provide. The core of this chapter can be
automatically generated using an XSLT similar to doc/api.xsl.
Instead of transforming into a plain text format, it could
generate docbook XML.
Publican does a great job of rendering stellar looking documentation
from docbook. If we complete these steps, I think we'll have a great
manual that addresses our entire audience.
As always, feedback welcome.
Thanks,
--
Russell Bryant
12 years, 8 months
[IANA #483358] Application for port-number: matahari
by Pearl Liang via RT
Thank you for the reply.
> Assignee Name (REQUIRED): Matahari Project
> Assignee E-mail (REQUIRED): matahari(a)lists.fedorahosted.org
Please confirm if http://matahariproject.org/ is the organization's
website.
On Wed Aug 24 06:07:57 2011, zbitter(a)redhat.com wrote:
> Assignee Name (REQUIRED): Matahari Project
> Assignee E-mail (REQUIRED): matahari(a)lists.fedorahosted.org
> (The Assignee is the organization, company or individual person
> responsible
> for the initial assignment. )
> Contact Name (REQUIRED): Zane Bitter
> Contact E-mail (REQUIRED): zbitter(a)redhat.com
>
> Transport Protocol(s) (REQUIRED): (Please indicate which protocols are
> currently required.)
> [ X ] TCP [ ] UDP [ ] SCTP [ ] DCCP
>
> Service Code (REQUIRED for DCCP only)
>
> A: ____________________________
>
> Service Name (REQUIRED, 15 character maximum):
>
> A: matahari
>
> Desired Port Number (OPTIONAL, for Port Number only)
>
> A: 49000
> NOTE: It is *inappropriate* to use a port number until your
> application has
> been approved for assignment. Leave it blank if no number preference.
>
> Description (REQUIRED) (For example: Super User Messaging)
>
> A: Matahari Broker
>
> Reference (REQUIRED): Please provide a brief and basic technical
> description
> of the protocol that will use the service name or port number,
> including
> message
> formats, types, sequences, functionalities, of your protocol. In
> addition,
> please address the specific questions included below to the extent
> possible.
>
> A: The Matahari server is an implementation of an Advanced Message
> Queuing Protocol (AMQP) broker. Matahari uses a subset of the Qpid
> Management Framework (QMF), which sits on top of AMQP (Apache Qpid is
> an
> implementation of AMQP). AMQP is an open standard which is documented
> here:
> http://www.amqp.org/confluence/download/attachments/720900/amqp.0-
> 10.pdf
>
> In short, AMQP is a generic protocol for handling message queues.
> Client
> applications can create and subscribe to queues and publish messages
> to
> them.
>
> Matahari (http://www.matahariproject.org/) is a service to provide
> remote access to system management APIs over QMF. Existing APIs
> support
> system configuration and querying of system parameters for virtual
> servers, however the protocol is extensible so users can add their own
> custom APIs.
>
> Q: If broadcast/multicast is used, how and what for?
>
> A: Multicast may optionally be used to efficiently combine multiple
> brokers into a high-availability cluster.
>
> Q: If UDP is requested, please explain how traffic is limited, and
> whether the protocol reacts to congestion.
>
> A:
> ___________________________________________________________________________
>
> Q: If UDP is requested, please indicate whether the service is solely
> for the discovery of hosts supporting this protocol.
>
> A:
> ___________________________________________________________________________
>
> Q: Please explain how your protocol supports versioning.
>
> A: All AMQP messages begin with a version field, and AMQP defines a
> method for the client and server to negotiate a mutually compatible
> protocol version. QMF objects have a schema which can be queried over
> the protocol.
>
> Q: If your request is for more than one transport, please explain in
> detail how the protocol differs over each transport.
>
> A:
> __________________________________________________________________________
>
> Q: Please describe how your protocol supports security. Please note
> that
> there is current debate as to whether additional future ports will be
> allocated for newly assigned services that lack security, e.g., solely
> for the addition of a secure variant. Applicants are strongly advised
> to
> address this issue as early as possible in the design of their
> protocols.
>
>
> A: The protocol may optionally be tunnelled over SSL.
>
>
> Q: Please explain the state of development of your protocol.
>
> A: AMQP is a published open standard with four published versions
> since
> 2006 and multiple available implementations. QMF has undergone a major
> revision and is now considered stable.
>
> Q: If SCTP is requested, please describe the following: Is there an
> existing TCP and/or UDP service name or port number assignment?
> If so, please indicate the details below:
>
> Service Name: _______________; Port number: _______________
>
> What specific SCTP capability is used by the application such that a
> user who has the choice of both TCP (and/or UDP) and SCTP ports for
> this application would choose SCTP? See [RFC4960 section 7.1]
> (http://tools.ietf.org/html/rfc4960#section-7.1)
>
> A:
> _____________________________________________________________________________
>
> ________________________________________________________________________________
>
>
> Please provide any other information that would be helpful in
> understanding how this protocol differs from existing assigned
> services.
>
> A: Matahari differs from a generic AMQP broker in that it requires the
> QMF protocol running on top, so only the Apache Qpid implementation of
> AMQP can be used. Since Matahari is designed for system configuration,
> for security reasons it places a tighter than usual set of
> restrictions
> on how the connection can be used, and thus must be segregated from
> regular applications' AMQP traffic.
>
12 years, 8 months
[PATCH v2] Fix compiler warnings in Windows builds
by Zane Bitter
Signed-off-by: Zane Bitter <zbitter(a)redhat.com>
---
src/lib/host_windows.c | 25 +++++++++-----------
src/lib/network_windows.c | 56 ++++++++++++++------------------------------
src/lib/services_windows.c | 6 ++---
3 files changed, 33 insertions(+), 54 deletions(-)
diff --git a/src/lib/host_windows.c b/src/lib/host_windows.c
index 0a599d3..149cc2a 100644
--- a/src/lib/host_windows.c
+++ b/src/lib/host_windows.c
@@ -44,27 +44,29 @@ host_os_get_cpu_flags(void)
}
static void
-get_token_priv(HANDLE token, TOKEN_PRIVILEGES tkp)
+enable_se_priv(void)
{
- OpenProcessToken(GetCurrentProcess(),
- TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &token);
+ HANDLE token;
+ TOKEN_PRIVILEGES tkp;
+
LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME,
&tkp.Privileges[0].Luid);
tkp.PrivilegeCount = 1;
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
- AdjustTokenPrivileges(token, FALSE, &tkp, 0,
- (PTOKEN_PRIVILEGES) NULL, 0);
+ if (OpenProcessToken(GetCurrentProcess(),
+ TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &token)) {
+ AdjustTokenPrivileges(token, FALSE, &tkp, 0,
+ (PTOKEN_PRIVILEGES) NULL, 0);
+ CloseHandle(token);
+ }
}
void
host_os_reboot(void)
{
- HANDLE token;
- TOKEN_PRIVILEGES tkp;
-
- get_token_priv(token, tkp);
+ enable_se_priv();
ExitWindowsEx(EWX_REBOOT | EWX_FORCE,
SHTDN_REASON_FLAG_PLANNED);
}
@@ -72,10 +74,7 @@ host_os_reboot(void)
void
host_os_shutdown(void)
{
- HANDLE token;
- TOKEN_PRIVILEGES tkp;
-
- get_token_priv(token, tkp);
+ enable_se_priv();
ExitWindowsEx(EWX_SHUTDOWN | EWX_FORCE,
SHTDN_REASON_FLAG_PLANNED);
}
diff --git a/src/lib/network_windows.c b/src/lib/network_windows.c
index 8e017ad..fe300e7 100644
--- a/src/lib/network_windows.c
+++ b/src/lib/network_windows.c
@@ -25,64 +25,44 @@
#endif
#include "matahari/network.h"
+#include "matahari/utilities.h"
#include <config.h>
#include <glib.h>
#include <windows.h>
-void
-network_os_stop(const char *iface)
+static void
+network_os_setstate(const char *iface, const char *state)
{
PROCESS_INFORMATION pi;
STARTUPINFO si;
char *p;
char *exe_path;
+ wchar_t *wexe_path;
p = getenv("WINDIR");
- exe_path = g_strdup_printf("%s\\system32\\netsh interface set interface "
- "%s disabled", p, iface);
+ exe_path = g_strdup_printf("\"%s\\system32\\netsh\" "
+ "interface set interface %s %s",
+ p, iface, state);
+ wexe_path = char2wide(exe_path);
+ g_free(exe_path);
- gboolean ok = CreateProcess(NULL,
- exe_path,
- NULL,
- NULL,
- TRUE,
- 0,
- NULL,
- NULL,
- &si,
- &pi);
+ CreateProcess(NULL, wexe_path, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi);
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
- g_free(exe_path);
+ free(wexe_path);
}
void
-network_os_start(const char *iface)
+network_os_stop(const char *iface)
{
- PROCESS_INFORMATION pi;
- STARTUPINFO si;
- char *p;
- char *exe_path;
-
- p = getenv("WINDIR");
- exe_path = g_strdup_printf("%s\\system32\\netsh interface set interface "
- "%s enabled", p, iface);
-
- gboolean ok = CreateProcess(NULL,
- exe_path,
- NULL,
- NULL,
- TRUE,
- 0,
- NULL,
- NULL,
- &si,
- &pi);
+ network_os_setstate(iface, "disabled");
+}
- CloseHandle(pi.hThread);
- CloseHandle(pi.hProcess);
- g_free(exe_path);
+void
+network_os_start(const char *iface)
+{
+ network_os_setstate(iface, "enabled");
}
diff --git a/src/lib/services_windows.c b/src/lib/services_windows.c
index 80b9a39..b48805d 100644
--- a/src/lib/services_windows.c
+++ b/src/lib/services_windows.c
@@ -109,10 +109,9 @@ static int
extract_service_status(const char *unmutable, int max)
{
int lpc = 0, last = 0;
- int rc = LSB_STATUS_OTHER_ERROR;
if (unmutable == NULL || max < 10) {
- return rc;
+ return LSB_STATUS_OTHER_ERROR;
}
for (; lpc < max; lpc++) {
@@ -147,6 +146,7 @@ extract_service_status(const char *unmutable, int max)
rc = LSB_STATUS_OK;
break;
default:
+ rc = LSB_STATUS_OTHER_ERROR;
mh_info("Unknown status: %s", next);
}
/* free(next); */
@@ -160,7 +160,7 @@ extract_service_status(const char *unmutable, int max)
}
}
mh_info("Couldn't parse service status");
- return rc;
+ return LSB_STATUS_OTHER_ERROR;
}
gboolean
12 years, 8 months
[PATCH] Fix compiler warnings in Windows builds
by Zane Bitter
Signed-off-by: Zane Bitter <zbitter(a)redhat.com>
---
src/lib/host_windows.c | 25 +++++++++-----------
src/lib/network_windows.c | 56 ++++++++++++++------------------------------
src/lib/services_windows.c | 5 ++--
3 files changed, 32 insertions(+), 54 deletions(-)
diff --git a/src/lib/host_windows.c b/src/lib/host_windows.c
index 0a599d3..149cc2a 100644
--- a/src/lib/host_windows.c
+++ b/src/lib/host_windows.c
@@ -44,27 +44,29 @@ host_os_get_cpu_flags(void)
}
static void
-get_token_priv(HANDLE token, TOKEN_PRIVILEGES tkp)
+enable_se_priv(void)
{
- OpenProcessToken(GetCurrentProcess(),
- TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &token);
+ HANDLE token;
+ TOKEN_PRIVILEGES tkp;
+
LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME,
&tkp.Privileges[0].Luid);
tkp.PrivilegeCount = 1;
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
- AdjustTokenPrivileges(token, FALSE, &tkp, 0,
- (PTOKEN_PRIVILEGES) NULL, 0);
+ if (OpenProcessToken(GetCurrentProcess(),
+ TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &token)) {
+ AdjustTokenPrivileges(token, FALSE, &tkp, 0,
+ (PTOKEN_PRIVILEGES) NULL, 0);
+ CloseHandle(token);
+ }
}
void
host_os_reboot(void)
{
- HANDLE token;
- TOKEN_PRIVILEGES tkp;
-
- get_token_priv(token, tkp);
+ enable_se_priv();
ExitWindowsEx(EWX_REBOOT | EWX_FORCE,
SHTDN_REASON_FLAG_PLANNED);
}
@@ -72,10 +74,7 @@ host_os_reboot(void)
void
host_os_shutdown(void)
{
- HANDLE token;
- TOKEN_PRIVILEGES tkp;
-
- get_token_priv(token, tkp);
+ enable_se_priv();
ExitWindowsEx(EWX_SHUTDOWN | EWX_FORCE,
SHTDN_REASON_FLAG_PLANNED);
}
diff --git a/src/lib/network_windows.c b/src/lib/network_windows.c
index 8e017ad..fe300e7 100644
--- a/src/lib/network_windows.c
+++ b/src/lib/network_windows.c
@@ -25,64 +25,44 @@
#endif
#include "matahari/network.h"
+#include "matahari/utilities.h"
#include <config.h>
#include <glib.h>
#include <windows.h>
-void
-network_os_stop(const char *iface)
+static void
+network_os_setstate(const char *iface, const char *state)
{
PROCESS_INFORMATION pi;
STARTUPINFO si;
char *p;
char *exe_path;
+ wchar_t *wexe_path;
p = getenv("WINDIR");
- exe_path = g_strdup_printf("%s\\system32\\netsh interface set interface "
- "%s disabled", p, iface);
+ exe_path = g_strdup_printf("\"%s\\system32\\netsh\" "
+ "interface set interface %s %s",
+ p, iface, state);
+ wexe_path = char2wide(exe_path);
+ g_free(exe_path);
- gboolean ok = CreateProcess(NULL,
- exe_path,
- NULL,
- NULL,
- TRUE,
- 0,
- NULL,
- NULL,
- &si,
- &pi);
+ CreateProcess(NULL, wexe_path, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi);
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
- g_free(exe_path);
+ free(wexe_path);
}
void
-network_os_start(const char *iface)
+network_os_stop(const char *iface)
{
- PROCESS_INFORMATION pi;
- STARTUPINFO si;
- char *p;
- char *exe_path;
-
- p = getenv("WINDIR");
- exe_path = g_strdup_printf("%s\\system32\\netsh interface set interface "
- "%s enabled", p, iface);
-
- gboolean ok = CreateProcess(NULL,
- exe_path,
- NULL,
- NULL,
- TRUE,
- 0,
- NULL,
- NULL,
- &si,
- &pi);
+ network_os_setstate(iface, "disabled");
+}
- CloseHandle(pi.hThread);
- CloseHandle(pi.hProcess);
- g_free(exe_path);
+void
+network_os_start(const char *iface)
+{
+ network_os_setstate(iface, "enabled");
}
diff --git a/src/lib/services_windows.c b/src/lib/services_windows.c
index 80b9a39..8344d2d 100644
--- a/src/lib/services_windows.c
+++ b/src/lib/services_windows.c
@@ -109,10 +109,9 @@ static int
extract_service_status(const char *unmutable, int max)
{
int lpc = 0, last = 0;
- int rc = LSB_STATUS_OTHER_ERROR;
if (unmutable == NULL || max < 10) {
- return rc;
+ return LSB_STATUS_OTHER_ERROR;
}
for (; lpc < max; lpc++) {
@@ -160,7 +159,7 @@ extract_service_status(const char *unmutable, int max)
}
}
mh_info("Couldn't parse service status");
- return rc;
+ return LSB_STATUS_OTHER_ERROR;
}
gboolean
12 years, 8 months
Re: [Matahari] IANA Port assignment application
by Russell Bryant
Moved to the ML.
On 08/23/2011 03:10 PM, Perry Myers wrote:
> On 08/22/2011 01:07 PM, Zane Bitter wrote:
>> Folks,
>> We need to get the IANA to assign matahari a TCP port so that we can get
>> into /etc/services. The process for doing so is documented here:
>> http://tools.ietf.org/html/draft-ietf-tsvwg-iana-ports-10
>
> excellent, I'm glad to see this getting pushed forward. Though... if
> we're going to get a different port than 49000 we probably need to know
> sooner rather than later since switching ports once things are 'out
> there' and in use will be difficult, no?
There's not a great way to handle it. At some point we need to make a
release that uses the new port number by default. Any older versions
that want to connect to newer stuff will have to use the --port options.
Release documentation can help that a bit. The sooner we do it the
better, for sure.
--
Russell Bryant
12 years, 8 months
Patch workflow
by Russell Bryant
Greetings,
I would like to offer up an alternative patch workflow for discussion.
Currently we're using the mailing list for posting patches and reviews.
How would you feel about using a code review tool to manage the patch
workflow? The main reason I have for proposing the change is to help
ensure that things don't get dropped and that it's very clear to
everyone what the status is of each pending patch.
Specifically, the tool I have in mind is Review Board [1]. fedorahosted
has a reviewboard instance up that (I presume) we could use [2].
Q&A:
1) Well what about keeping discussions on the mailing list?
If we used this tool, we could still have code review discussions echoed
to the mailing list so everyone still sees what's going on. As an
example, the qpid project is using Review Board [3] and review requests
are sent to their dev mailing list [4].
2) How do you post patches?
Here is a general workflow overview [5]. Posting patches is pretty easy
to do from the command line. There is a tool called post-review [6]
that you use.
3) I hate the web. If I can't do it from my terminal, it's terrible.
Ok, well that's not a question. I do respect your right to have an
opinion, even if it's wrong. I do believe that there are some tools
coming in future versions of Review Board that will allow you to do
everything from the command line, but it's not there yet.
[1] http://www.reviewboard.org/
[2] http://fedorahosted.org/reviewboard/
[3] https://reviews.apache.org/groups/qpid/
[4] http://mail-archives.apache.org/mod_mbox/qpid-dev/201108.mbox/browser
[5]
http://www.reviewboard.org/docs/manual/1.5/users/getting-started/workflow/
[6]
http://www.reviewboard.org/docs/manual/1.5/users/tools/post-review/#post-...
Let me know what you think!
Thanks,
--
Russell Bryant
12 years, 8 months
[PATCH] Resolve errors reported by coverity.
by Russell Bryant
[PATCH 1/4] core: rework dead code.
[PATCH 2/4] core: Remove unused variable.
This is not a coverity reported error. I just pulled out the formatting
cleanup from the real code changes in patch 4/4.
[PATCH 3/4] host: Clean up indentation.
[PATCH 4/4] qmf: Don't use string after it has been destroyed.
--
Russell Bryant
12 years, 8 months