Skip to contentSkip to conversation

Convert libvirt-qpid plugin to QMFv2

PATCH New Zane Bitter 2 participants 4 messages Aug 3, 2011 – Aug 11, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Convert libvirt-qpid plugin to QMFv2

---

 0 files changed, 0 insertions(+), 0 deletions(-)
server/Makefile.in +1 -1
index 90811ae..bf5ebba 100644
@@ -24,7 +24,7 @@ AIS_LIBS=-L/usr/lib64/openais -lSaCkpt
 COROSYNC_LIBS=-L/usr/lib64/corosync -lcpg
 CMAN_LIBS=-lcman
 VIRT_LIBS=-lvirt
-VIRT_QPID=-lqmfconsole -lqpidclient -lqpidcommon
+VIRT_QPID=-lqmf2 -lqpidclient -lqpidtypes -lqpidcommon -lqpidmessaging
 NSS_LIBS=-lnss3
 XML_LIBS=`xml2-config --libs`
 INCLUDES=-I../include `nss-config --cflags` `nspr-config --cflags` `xml2-config --cflags`
server/libvirt-qpid.cpp +157 -149

395 lines not on this page · raw message

#1 lore raw

PATCH 2/2 Add libvirt-qmf support to the libvirt-qpid plugin

libvirt-qmf has replaced libvirt-qpid. It performs the same functions, but has a slightly different schema. It is also a matahari agent, so the default port to connect to is now matahari-brokerd's port, not qpidd's.
---

 0 files changed, 0 insertions(+), 0 deletions(-)
server/libvirt-qpid.cpp +20 -7
index 151bd2e..d133346 100644
@@ -56,9 +56,6 @@ struct lq_info {
 };
 
 
-const std::string domainQuery("{class: domain, package: 'org.redhat.libvirt'}");
-
-
 #define VALIDATE(arg) \
 do {\
 	if (!arg || ((struct lq_info *)arg)->magic != MAGIC) { \
@@ -95,7 +92,10 @@ lq_open_session(struct lq_info *info)
 		session = qmf::ConsoleSession(connection);
 
 		std::stringstream filter;
-		filter << "[eq, _product, [quote, 'libvirt-qpid']]";
+		filter << "[or, "
+			   "[eq, _product, [quote, 'libvirt-qmf']], "
+			   "[eq, _product, [quote, 'libvirt-qpid']]"
+			  "]";
 		session.setAgentFilter(filter.str());
 		session.open();
 	}
@@ -103,6 +103,19 @@ lq_open_session(struct lq_info *info)
 	return session;
 }
 
+static qmf::ConsoleEvent
+queryDomain(qmf::Agent& agent)
+{
+	std::string query;
+	if (agent.getProduct() == "libvirt-qmf") {
+		query = "{class: Domain, package: 'org.libvirt'}";
+	} else {
+		query = "{class: domain, package: 'com.redhat.libvirt'}";
+	}
+
+	return agent.query(query);
+}
+
 int
 do_lq_request(struct lq_info *info, const char *vm_name,
 	      const char *action)
@@ -132,7 +145,7 @@ do_lq_request(struct lq_info *info, const char *vm_name,
 		for (unsigned a = 0; !found && a < numAgents; a++) {
 			agent = session.getAgent(a);
 
-			qmf::ConsoleEvent event(agent.query(domainQuery));
+			qmf::ConsoleEvent event(queryDomain(agent));
 			uint32_t numDomains = event.getDataCount();
 			for (unsigned d = 0; !found && d < numDomains; d++) {
 				domain = event.getData(d);
@@ -318,7 +331,7 @@ lq_hostlist(hostlist_callback callback, void *arg, void *priv)
 		uint32_t numAgents = session.getAgentCount();
 		for (unsigned a = 0; a < numAgents; a++) {
 			qmf::Agent agent(session.getAgent@);
-			event = agent.query(domainQuery);
+			event = queryDomain(agent);
 
 			numDomains = event.getDataCount();
 			if (numDomains >= 1) {
@@ -366,7 +379,7 @@ lq_init(backend_context_t *c, config_object_t *config)
 		return -1;
 
 	memset(info, 0, sizeof(*info));
-	info->port = 5672;
+	info->port = 49000;
 
 	if(sc_get(config, "backends/libvirt-qpid/@host",
 		   value, sizeof(value))==0){
#2 lore raw

PATCH 2/2 Add libvirt-qmf support to the libvirt-qpid plugin

Quoted 3 lines · Zane Bitter

libvirt-qmf has replaced libvirt-qpid. It performs the same functions, but has a slightly different schema. It is also a matahari agent, so the default port to connect to is now matahari-brokerd's port, not qpidd's.

Everything looks good, only question I have is should we use libvirt-qmf
instead of libvirt-qpid in the config file? (Happy to do that work if
needed).

Merged.

Signature · 1 line
Lon Hohberger - Red Hat, Inc.
#3 lore raw

PATCH 2/2 Add libvirt-qmf support to the libvirt-qpid plugin

Quoted 11 lines · Lon Hohberger
Quoted 3 lines · Zane Bitter

libvirt-qmf has replaced libvirt-qpid. It performs the same functions, but has a slightly different schema. It is also a matahari agent, so the default port to connect to is now matahari-brokerd's port, not qpidd's.

Everything looks good, only question I have is should we use libvirt-qmf
instead of libvirt-qpid in the config file? (Happy to do that work if
needed).

Merged.

Yeah, I wondered about doing s/libvirt-qpid/libvirt-qmf/ on everything. Maybe we still want to do that in the future, but I think it is probably OK for now. It's going to be confusing either way. The plugin works with either schema.

cheers,
Zane.