Re: [Matahari] Scrum 2011-09-23
by Zane Bitter
(Moving this discussion to the mailing list.)
On 24/09/11 03:24, ajs(a)redhat.com wrote:
> - WRT: Vios-Proxy:
> https://github.com/matahari/matahari/wiki/Vios-Proxy
> Use cases A,B are do-able.
> Use case C !do-able:
> Brokers are designed to create sockets rather than bind to them.
> Which is bad in our case since only our agents are able to bind to
> the virtioserial devices. So federated brokers outside of tcp connections
> does not seem feasible at this time. In conclusion, qpid broker code will
> need to be updated in order to use vios in a federated environment.
>
> For verification, I used this script to start up my guests
>
> #!/bin/bash
> # $1 - location of qemu img
> QPID_BROKER_ROOT="/tmp/qpid"
> for gnameseq in `seq 1 2`
> do
> GUEST_NAME="guest"$gnameseq
> mkdir -p ${QPID_BROKER_ROOT}/${GUEST_NAME}
> sudo qemu-kvm -name "${GUEST_NAME}" \
> -m 512M \
> -smp 2 \
> -snapshot $1 \
> -device virtio-serial \
> -chardev socket,path=${QPID_BROKER_ROOT}/${GUEST_NAME}/0,server,nowait,id=${GUEST_NAME}_0 \
> -chardev socket,path=${QPID_BROKER_ROOT}/${GUEST_NAME}/1,server,nowait,id=${GUEST_NAME}_1 \
> -device virtserialport,chardev=${GUEST_NAME}_0,name=qpid.0 \
> -device virtserialport,chardev=${GUEST_NAME}_1,name=qpid.1 \
> &
> PID=$!
> echo "started ${GUEST_NAME} pid = $PID"
> done
>
> Next startup `vios-proxy-host /tmp/qpid 49000`
> Startup broker on host `service matahari-broker start`
>
> On guest(s) startup `vios-proxy-guest /dev/virtio-devs/ 49000`
> Just for sanity sake, used qpidd on the guest to attempt to bind to our
> virtioserial devices `qpidd -p 49000 --auth no`
> Experience unable to bind to port 49000, port in use .. etc.
> Verify communication actually works, startup a agent on either guest
> `service matahari-host start` and do the normal querying via qmf-tool.
I think C is do-able but only using two separate ports. i.e.
`vios-proxy-guest /dev/virtio-devs 48999` then have the broker federate
with localhost:48999.
It doesn't seem like there's a way to make that configuration easy out
of the box, though.
cheers,
Zane.
12 years, 6 months
[PATCH] Add test for augeas support in sysconfig agent
by Radek Novacek
The test compares results from mh_sysconfig_query,
mh_sysconfig_run_string and mh_sysconfig_run_uri.
---
src/tests/mh_api_sysconfig.h | 78 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 78 insertions(+), 0 deletions(-)
diff --git a/src/tests/mh_api_sysconfig.h b/src/tests/mh_api_sysconfig.h
index 5eb4fe7..1cbe18a 100644
--- a/src/tests/mh_api_sysconfig.h
+++ b/src/tests/mh_api_sysconfig.h
@@ -23,6 +23,29 @@ extern "C" {
using namespace std;
+/**
+ * Callback function, doesn't do anything
+ */
+void f(void *, int)
+{
+}
+
+/**
+ * Result from run_string and run_uri functions is in the form "query = result\n"
+ * This function will extract the "result"
+ *
+ * \note The return of this routine must be freed with free()
+ */
+char *strip(const char *result)
+{
+ char *stripped;
+ // strip the "query = " part
+ stripped = strdup(strstr(result, " = ") + 3);
+ // and the line end
+ stripped[strlen(stripped) - 1] = '\0';
+ return stripped;
+}
+
class MhApiSysconfigSuite : public CxxTest::TestSuite
{
public:
@@ -46,6 +69,61 @@ class MhApiSysconfigSuite : public CxxTest::TestSuite
TS_ASSERT((mh_sysconfig_set_configured(invalid_keys[i], "OK")) == FALSE);
}
}
+
+ /**
+ * This test compares result of mh_sysconfig_query, mh_sysconfig_run_string
+ * and mh_sysconfig_run_uri commands.
+ */
+ void testAugeasQuery(void)
+ {
+ const char key[] = "org.matahariproject.test.unittest.augeas";
+ const char query[] = "/files/etc/fstab/1/spec";
+ const char command[] = "get /files/etc/fstab/1/spec";
+ char tmp_file[] = "matahari-sysconfig-test_XXXXXX";
+ char *query_result, *run_string_result, *run_string_result_stripped;
+ char *run_uri_result, *run_uri_result_stripped;
+ char *uri, *abs_path;
+ int fd = mkstemp(tmp_file);
+ TS_ASSERT(fd >= 0);
+
+ // test query function
+ query_result = mh_sysconfig_query(query, 0, "augeas");
+ TS_ASSERT(query_result != NULL);
+ TS_ASSERT(strlen(query_result) > 0);
+
+ // test run_string function
+ TS_ASSERT(mh_sysconfig_run_string(command, MH_SYSCONFIG_FLAG_FORCE, "augeas", key, f, NULL) == MH_RES_SUCCESS);
+ run_string_result = mh_sysconfig_is_configured(key);
+ TS_ASSERT(run_string_result != NULL);
+
+ run_string_result_stripped = strip(run_string_result);
+ free(run_string_result);
+
+ // test run_uri function
+ write(fd, command, strlen(command));
+ write(fd, "\n", 1);
+ close(fd);
+
+ abs_path = realpath(tmp_file, NULL);
+ asprintf(&uri, "file://%s", abs_path);
+ TS_ASSERT(mh_sysconfig_run_uri(uri, MH_SYSCONFIG_FLAG_FORCE, "augeas", key, f, NULL) == MH_RES_SUCCESS);
+ run_uri_result = mh_sysconfig_is_configured(key);
+ TS_ASSERT(run_uri_result != NULL);
+
+ run_uri_result_stripped = strip(run_uri_result);
+ free(run_uri_result);
+ unlink(tmp_file);
+
+ // compare the results of all functions above
+ TS_ASSERT(strcmp(query_result, run_string_result_stripped) == 0);
+ TS_ASSERT(strcmp(query_result, run_uri_result_stripped) == 0);
+
+ free(query_result);
+ free(run_string_result_stripped);
+ free(run_uri_result_stripped);
+ free(abs_path);
+ free(uri);
+ }
};
#endif
--
1.7.6.2
12 years, 7 months
[PATCH 0/4] Support EC2 instance ID on Linux
by Russell Bryant
Greetings,
When running on EC2, using the UUID from SMBIOS will not work.
Instead, get the EC2 instance ID when the "hardware" UUID is requested.
This patch implements this for Linux. Windows will come next.
[PATCH 1/4] host: style changes in get_uuid.
[PATCH 2/4] build: indentation fix.
[PATCH 3/4] core: Move global curl init to libmcommon.
[PATCH 4/4] host: Add EC2 instance-id support on Linux.
CMakeLists.txt | 2 -
host.c | 37 ++++++++-----------
host_linux.c | 97 +++++++++++++++++++++++++++++++++++++++++++++++++---
host_private.h | 3 +
host_windows.c | 8 ++++
sysconfig_linux.c | 16 ++------
utilities_linux.c | 22 +++++++++++
utilities_private.h | 8 ++++
8 files changed, 155 insertions(+), 38 deletions(-)
Thanks,
--
Russell Bryant
12 years, 7 months
Matahari on Windows
by Russell Bryant
Greetings,
I spent time this week working with Matahari on Windows. I wanted to
write down some notes on the experience and my thoughts on some things
we need to do to improve Matahari on Windows while it's fresh on my mind.
In case you haven't worked with Matahari on Windows before, here is an
overview of my test environment.
My environment was Windows Server 2008 R2 in a VM. The development/test
cycle involved building and installing the mingw32-matahari package,
which results in an ISO being available here:
/usr/i686-pc-mingw32/sys-root/mingw/share/matahari/matahari-0.4.7-win32.iso
I connected the ISO to the VM so it showed up as its CD drive. The ISO
contains an installer which runs like a typical Windows installer.
Here are some things that I came across that I think we should fix or
improve:
1) Fix stopping services
When you stop a service, the underlying agent process doesn't actually
get stopped.
2) Logging
Logging isn't supported. We should implement support for logging things
to the Windows event log.
Matahari is installed as a set of Windows services (one service per
agent). However, it is incredibly difficult to do any troubleshooting
on agents while they are running as a service since there is no log. In
my testing, I stopped the services and ran the agents manually in a
shell so that I could see the output.
Even when the agent was run in a shell, the only output you could get
was whatever the default logger verbosity setting was. I implemented
the "verbose" option for the registry so that you could get the more
verbose debug output.
3) Fixes for uninstall
When you uninstall Matahari, it still leaves the services installed
(which at that point are broken). I think it also leaves some entries
in the start menu.
4) Windows installer availability
I'm not sure when this will become a real issue, but at some point I
think we will need to start delivering a Windows installer along side
tarball releases. Even if a Windows VM on a Linux host is the primary
production use case, I think a standalone installer that can be
downloaded would be good to make it easier to try out Matahari on Windows.
That's it for now.
Thanks,
--
Russell Bryant
12 years, 7 months
[PATCH] build: Build man pages at tarball export time.
by Russell Bryant
Don't rely on being able to run all of the matahari executables on
whatever is doing the builds. Build them locally when a tarball is
being built and include them in the tarball.
Related: rhbz#737088
Signed-off-by: Russell Bryant <rbryant(a)redhat.com>
---
GNUmakefile | 14 +++++++++-----
mkrelease.sh | 3 +--
src/cmake/modules/MatahariMacros.cmake | 8 +++++++-
3 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/GNUmakefile b/GNUmakefile
index 5fcaf9b..d96ce85 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -20,8 +20,8 @@
PACKAGE ?= matahari
VERSION ?= $(shell cat .version)
-TARPREFIX = $(PACKAGE)-$(PACKAGE)-$(TAG)
-TARFILE = $(TARPREFIX).tgz
+TARPREFIX ?= $(PACKAGE)-$(PACKAGE)-$(TAG)
+TARFILE ?= $(TARPREFIX).tgz
HTML_ROOT = coverity@www.clusterlabs.org:/var/www/html
RPM_ROOT ?= $(shell pwd)
@@ -43,7 +43,7 @@ DOT:=$(shell which dot 2>/dev/null)
linux.build:
@echo "=::=::=::= Setting up for Linux =::=::=::= "
mkdir -p $@
- cd $@ && eval "`rpm --eval "%{cmake}" | grep -v -e "^%"`" -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
+ cd $@ && eval "`rpm --eval "%{cmake}" | grep -v -e "^%"`" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DREQUIRE_HELP2MAN=$(REQUIRE_HELP2MAN) ..
@$(MAKE) --no-print-dir -C $@
tests: linux.build
@@ -76,7 +76,12 @@ check-mock:
export:
rm -f $(TARFILE).tgz
- git archive --prefix=$(TARPREFIX)/ $(TAG) | gzip > $(TARFILE)
+ git archive --prefix=$(TARPREFIX)/ $(TAG) | tar x
+ cd $(TARPREFIX) && \
+ $(MAKE) linux.build REQUIRE_HELP2MAN=1 && \
+ for n in `find linux.build/ -iname '*.8.gz'` ; do cp $$n $${n:12}; done && \
+ cd .. && rm -rf linux.build
+ tar czvf $(TARFILE) $(TARPREFIX)
echo `date`: Rebuilt $(TARFILE) from $(TAG)
$(VARIANT)$(PACKAGE).spec: $(VARIANT)$(PACKAGE).spec.in
@@ -93,7 +98,6 @@ $(VARIANT)$(PACKAGE).spec: $(VARIANT)$(PACKAGE).spec.in
srpm: export $(VARIANT)$(PACKAGE).spec
rm -f *.src.rpm
-
rpmbuild -bs $(RPM_OPTS) $(VARIANT)$(PACKAGE).spec
# eg. WITH="--with cman" make rpm
diff --git a/mkrelease.sh b/mkrelease.sh
index db650c4..7c5219e 100755
--- a/mkrelease.sh
+++ b/mkrelease.sh
@@ -18,5 +18,4 @@ if [ "$(cat .version)" != "${TAG:1}" ] ; then
git commit -s -m "build: update .version to ${TAG:1}"
fi
git tag -a -m "Tagged release $TAG" $TAG $BRANCH
-git archive --prefix=matahari-${TAG:1}/ $TAG | tar x
-tar czvf matahari-${TAG:1}.tar.gz matahari-${TAG:1}/
+make export TAG=${TAG} TARPREFIX=matahari-${TAG:1} TARFILE=matahari-${TAG:1}.tar.gz
diff --git a/src/cmake/modules/MatahariMacros.cmake b/src/cmake/modules/MatahariMacros.cmake
index e051b2b..7cdb7e1 100644
--- a/src/cmake/modules/MatahariMacros.cmake
+++ b/src/cmake/modules/MatahariMacros.cmake
@@ -109,8 +109,14 @@ macro(create_manpage BINARY SECTION DESC)
COMMENT "Generating ${BINARY} man page"
VERBATIM
)
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${BINARY}.${SECTION}.gz DESTINATION share/man/man${SECTION})
+ else(HELP2MAN)
+ if(REQUIRE_HELP2MAN)
+ message(FATAL_ERROR "help2man is required.")
+ endif(REQUIRE_HELP2MAN)
endif(HELP2MAN)
+ if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${BINARY}.${SECTION}.gz)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${BINARY}.${SECTION}.gz DESTINATION share/man/man${SECTION})
+ endif(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${BINARY}.${SECTION}.gz)
endmacro(create_manpage)
macro(create_service_scripts BASE)
--
1.7.6.2
12 years, 7 months
[PATCH] sysconfig: update return value checks.
by Russell Bryant
Update checks of the return value from mh_sysconfig_set_configured() to
explicitly check for the enum mh_result values.
Signed-off-by: Russell Bryant <rbryant(a)redhat.com>
---
src/lib/sysconfig_linux.c | 4 ++--
src/tests/mh_api_sysconfig.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/lib/sysconfig_linux.c b/src/lib/sysconfig_linux.c
index 32c08b2..1474962 100644
--- a/src/lib/sysconfig_linux.c
+++ b/src/lib/sysconfig_linux.c
@@ -128,7 +128,7 @@ action_cb(svc_action_t *action)
snprintf(buf, sizeof(buf), "FAILED\n%d", action->rc);
}
- if (mh_sysconfig_set_configured(action_data->key, buf) == FALSE) {
+ if (mh_sysconfig_set_configured(action_data->key, buf) != MH_RES_SUCCESS) {
mh_err("Unable to write to key file '%s'", action_data->key);
}
@@ -286,7 +286,7 @@ return_failure:
action_data = NULL;
}
- if (mh_sysconfig_set_configured(key, "ERROR") == FALSE) {
+ if (mh_sysconfig_set_configured(key, "ERROR") != MH_RES_SUCCESS) {
mh_err("Unable to write to file.");
}
diff --git a/src/tests/mh_api_sysconfig.h b/src/tests/mh_api_sysconfig.h
index 5eb4fe7..a4f33c6 100644
--- a/src/tests/mh_api_sysconfig.h
+++ b/src/tests/mh_api_sysconfig.h
@@ -37,13 +37,13 @@ class MhApiSysconfigSuite : public CxxTest::TestSuite
mh_sysconfig_keys_dir_set("/tmp/matahari-sysconfig-keys/");
- TS_ASSERT((mh_sysconfig_set_configured(key, "OK")) == TRUE);
+ TS_ASSERT((mh_sysconfig_set_configured(key, "OK")) == MH_RES_SUCCESS);
TS_ASSERT(((key_res = mh_sysconfig_is_configured(key))) != NULL);
TS_ASSERT(!strcmp("OK", key_res));
free(key_res);
for (int i = 0; i < DIMOF(invalid_keys); i++) {
- TS_ASSERT((mh_sysconfig_set_configured(invalid_keys[i], "OK")) == FALSE);
+ TS_ASSERT((mh_sysconfig_set_configured(invalid_keys[i], "OK")) == MH_RES_INVALID_ARGS);
}
}
};
--
1.7.6.2
12 years, 7 months
[PATCH] sysconfig: rhbz#741965 check key sanity sooner.
by Russell Bryant
This bug pointed out that while the keys were being checked, in some
cases it was being done a little too late. This patch makes it so if
the key is invalid, the run_uri or run_string operation isn't performed
at all and a QMF exception is raised.
Signed-off-by: Russell Bryant <rbryant(a)redhat.com>
---
src/include/matahari/sysconfig.h | 5 +--
src/lib/sysconfig.c | 63 ++++++++++++++++++++++---------------
2 files changed, 39 insertions(+), 29 deletions(-)
diff --git a/src/include/matahari/sysconfig.h b/src/include/matahari/sysconfig.h
index f19f439..3a74c61 100644
--- a/src/include/matahari/sysconfig.h
+++ b/src/include/matahari/sysconfig.h
@@ -102,10 +102,9 @@ mh_sysconfig_query(const char *query, uint32_t flags, const char *scheme);
* \param[in] key config item to define
* \param[in] contents specifies success/fail with error where applicable
*
- * \retval 1 if writing to file suceeds
- * \retval 0 failed to write to file
+ * \return See enum mh_result
*/
-gboolean
+enum mh_result
mh_sysconfig_set_configured(const char *key, const char *contents);
/**
diff --git a/src/lib/sysconfig.c b/src/lib/sysconfig.c
index c32e498..ef192d5 100644
--- a/src/lib/sysconfig.c
+++ b/src/lib/sysconfig.c
@@ -64,43 +64,61 @@ mh_sysconfig_keys_dir_set(const char *path)
mh_string_copy(_keys_dir, path, sizeof(_keys_dir));
}
-static gboolean
-set_key(const char *key, const char *contents)
+/**
+ * \internal
+ * \brief Chcek sanity of a key
+ *
+ * \retval 0 sane
+ * \retval non-zero bonkers
+ */
+static int
+check_key_sanity(const char *key)
{
- char key_file[PATH_MAX];
- static const char valid_chars[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-.";
+ static const char VALID_CHARS[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-.";
char sanitized_key[PATH_MAX];
if (mh_strlen_zero(key)) {
mh_err("key cannot be empty");
- return FALSE;
+ return -1;
}
if (g_str_has_prefix(key, ".")) {
mh_err("Invalid key filename %s", key);
- return FALSE;
+ return -1;
}
mh_string_copy(sanitized_key, key, sizeof(sanitized_key));
- g_strcanon(sanitized_key, valid_chars, '!');
+ g_strcanon(sanitized_key, VALID_CHARS, '!');
if (strchr(sanitized_key, '!') != NULL) {
mh_err("Invalid key filename %s", sanitized_key);
- return FALSE;
+ return -1;
+ }
+
+ return 0;
+}
+
+static enum mh_result
+set_key(const char *key, const char *contents)
+{
+ char key_file[PATH_MAX];
+
+ if (check_key_sanity(key)) {
+ return MH_RES_INVALID_ARGS;
}
if (!g_file_test(keys_dir_get(), G_FILE_TEST_IS_DIR) &&
g_mkdir(keys_dir_get(), 0755) < 0) {
mh_err("Could not create keys directory %s", keys_dir_get());
- return FALSE;
+ return MH_RES_OTHER_ERROR;
}
-
+
g_snprintf(key_file, sizeof(key_file), "%s%s", keys_dir_get(), key);
if (!g_file_set_contents(key_file, contents, strlen(contents), NULL)) {
mh_err("Could not set file %s", key_file);
- return FALSE;
+ return MH_RES_OTHER_ERROR;
}
- return TRUE;
+ return MH_RES_SUCCESS;
}
static char *
@@ -110,8 +128,7 @@ get_key(const char *key)
char *contents = NULL;
size_t length;
- if (mh_strlen_zero(key)) {
- mh_err("key cannot be empty");
+ if (check_key_sanity(key)) {
return NULL;
}
@@ -125,14 +142,10 @@ get_key(const char *key)
return contents;
}
-int
+enum mh_result
mh_sysconfig_set_configured(const char *key, const char *contents)
{
- if (!set_key(key, contents)) {
- return FALSE;
- }
-
- return TRUE;
+ return set_key(key, contents);
}
char *
@@ -145,9 +158,8 @@ enum mh_result
mh_sysconfig_run_uri(const char *uri, uint32_t flags, const char *scheme, const char *key,
mh_sysconfig_result_cb result_cb, void *cb_data)
{
- if (mh_strlen_zero(key)) {
- mh_err("key cannot be empty");
- return -1;
+ if (check_key_sanity(key)) {
+ return MH_RES_INVALID_ARGS;
}
return sysconfig_os_run_uri(uri, flags, scheme, key, result_cb, cb_data);
@@ -158,9 +170,8 @@ mh_sysconfig_run_string(const char *string, uint32_t flags, const char *scheme,
const char *key, mh_sysconfig_result_cb result_cb,
void *cb_data)
{
- if (mh_strlen_zero(key)) {
- mh_err("key cannot be empty");
- return -1;
+ if (check_key_sanity(key)) {
+ return MH_RES_INVALID_ARGS;
}
return sysconfig_os_run_string(string, flags, scheme, key, result_cb, cb_data);
--
1.7.6.2
12 years, 7 months
[PATCH] host: Implement "hardware" UUID on Windows.
by Russell Bryant
Just like the "reboot" UUID, I couldn't just leave this UUID not working
on Windows. Remove the commented out failed implementation and replace
it with something else that works. "WMIC" to the rescue.
Signed-off-by: Russell Bryant <rbryant(a)redhat.com>
---
src/host/schema.xml | 2 +-
src/lib/host_windows.c | 65 +++++++++++++++++++++++++-----------------------
2 files changed, 35 insertions(+), 32 deletions(-)
diff --git a/src/host/schema.xml b/src/host/schema.xml
index 904a3ab..cb179cf 100644
--- a/src/host/schema.xml
+++ b/src/host/schema.xml
@@ -53,7 +53,7 @@
<varlistentry><term><literal>Hardware</literal></term>
<listitem><para>
- UUID supplied by or generated from the underlying hardware. (Linux only).
+ UUID supplied by or generated from the underlying hardware.
</para></listitem>
</varlistentry>
diff --git a/src/lib/host_windows.c b/src/lib/host_windows.c
index 5031c4f..aae2166 100644
--- a/src/lib/host_windows.c
+++ b/src/lib/host_windows.c
@@ -103,51 +103,54 @@ host_os_identify(void)
char *
host_os_machine_uuid(void)
{
-#if 0
- UINT res;
- char *uuid = NULL;
- struct RawSMBIOSDData *smbios_data;
+ gchar *output = NULL, *begin, *end;
+ char *ret;
+ GError *error = NULL;
+ gboolean res;
+ gchar *argv[] = { "WMIC", "CSPRODUCT", "Get", "UUID", NULL };
- /*
- * Doc on SMBIOS support in windows:
- * http://msdn.microsoft.com/en-us/windows/hardware/gg463136
- *
- * See GetSystemFirmwareTable()
- * http://msdn.microsoft.com/en-us/library/ms724379%28v=VS.85%29.aspx
- */
+ res = g_spawn_sync(NULL, argv, NULL, G_SPAWN_SEARCH_PATH,
+ NULL, NULL, &output, NULL, NULL, &error);
- res = GetSystemFirmwareTable('RSMB', 0, NULL, 0);
+ if (res == FALSE) {
+ mh_err("Failed to run WMIC.exe to get SMBIOS UUID: %s\n", error->message);
+ g_error_free(error);
+ error = NULL;
+ }
- if (!res) {
- mh_info("Failed to get required SMBIOS buffer size.");
- return NULL;
+ if (!output) {
+ mh_err("Got no output from WMIC.exe when trying to get SMBIOS UUID.\n");
+ return -1;
}
- if (!(buf = malloc(res))) {
- return NULL;
+ if (!(begin = strstr(output, "\r\n"))) {
+ mh_err("Unexpected format of output: '%s'", output);
+ g_free(output);
+ return -1;
}
- res = GetSystemFirmwareTable('RSMB', 0, (void *) smbios_data, res);
+ begin += 2;
- if (!res) {
- mh_info("Failed to get SMBIOS data.");
- goto return_cleanup;
+ if (mh_strlen_zero(begin)) {
+ mh_err("Unexpected format of output: '%s'", output);
+ g_free(output);
+ return -1;
}
- uuid = find_uuid(smbios_data->SMBIOSTableData, smbios_data->Length);
-
-return_cleanup:
+ if (!(end = strstr(begin, "\r\n"))) {
+ mh_err("Unexpected format of output: '%s'", output);
+ g_free(output);
+ return -1;
+ }
- free(buf);
+ *end = '\0';
- return uuid;
-#endif
+ ret = strdup(begin);
- /*
- * GetSystemFirmwareTable() does not appear to be available with mingw32.
- */
+ g_free(output);
+ output = NULL;
- return NULL;
+ return ret;
}
/**
--
1.7.6.2
12 years, 7 months
[PATCH 0/2] Windows "reboot" UUID, for real this time.
by Russell Bryant
My last approach wasn't going to work so I left it commented out.
I came up with a new approach that actually works, so this UUID
lifetime is now supported on Windows, as well.
[PATCH 1/2] build: Include glib's gspawn helpers on Windows.
[PATCH 2/2] host: Implement "reboot" UUID for Windows.
CMakeLists.txt | 3 ++
src/host/schema.xml | 2 -
src/lib/host_windows.c | 57 ++++++++++++++++++++++---------------------------
3 files changed, 30 insertions(+), 32 deletions(-)
Thanks,
--
Russell Bryant
12 years, 7 months
[PATCH] SSL & non-SSL on the same port
by Zane Bitter
The Matahari Project (http:://matahariproject.org for the uninitiated) has
run into an issue with our use of Qpid in that IANA policy is now to refuse
to assign separate TCP ports for SSL/TLS-wrapped versions of protocols,
which leaves us with only a single port assigned to Matahari.
We would like to be able to accept both SSL and non-SSL connections on the
same port. The following patch implements this when the SSL Plugin is
enabled and both AMQP and AMQPS are configured to use the same port (i.e.
port == ssl-port).
We would like to work with the Qpid community to hopefully see this feature
or something equivalent implemented in Fedora 16 (Qpid 0.12). Any questions
or comments are, of course, most welcome.
thanks,
Zane.
---
Zane Bitter (1):
Multiplex SSL and non-SSL connections on the same port
qpid/cpp/src/qpid/sys/Socket.h | 2
qpid/cpp/src/qpid/sys/SslPlugin.cpp | 145 ++++++++++++++++++++++++----
qpid/cpp/src/qpid/sys/TCPIOPlugin.cpp | 33 ++++++
qpid/cpp/src/qpid/sys/ssl/SslIo.cpp | 20 +++-
qpid/cpp/src/qpid/sys/ssl/SslIo.h | 16 ++-
qpid/cpp/src/qpid/sys/ssl/SslSocket.cpp | 159 +++++++++++++++++++------------
qpid/cpp/src/qpid/sys/ssl/SslSocket.h | 44 ++-------
7 files changed, 283 insertions(+), 136 deletions(-)
12 years, 7 months