Bug 1086816
| Summary: | When the node name starts with '#' character the node shall be created | |||
|---|---|---|---|---|
| Product: | Red Hat Enterprise MRG | Reporter: | Petr Matousek <pematous> | |
| Component: | python-qpid | Assignee: | Pavel Moravec <pmoravec> | |
| Status: | CLOSED ERRATA | QA Contact: | Petr Matousek <pematous> | |
| Severity: | medium | Docs Contact: | ||
| Priority: | medium | |||
| Version: | Development | CC: | esammons, iboverma, jross, pematous, pmoravec, zkraus | |
| Target Milestone: | 3.1 | Keywords: | Improvement | |
| Target Release: | --- | |||
| Hardware: | Unspecified | |||
| OS: | Unspecified | |||
| Whiteboard: | ||||
| Fixed In Version: | python-qpid-0.30-5 | Doc Type: | Enhancement | |
| Doc Text: | Story Points: | --- | ||
| Clone Of: | ||||
| : | 1086817 (view as bug list) | Environment: | ||
| Last Closed: | 2015-04-14 13:47:52 UTC | Type: | Bug | |
| Regression: | --- | Mount Type: | --- | |
| Documentation: | --- | CRM: | ||
| Verified Versions: | Category: | --- | ||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
| Cloudforms Team: | --- | Target Upstream Version: | ||
| Embargoed: | ||||
| Bug Depends On: | ||||
| Bug Blocks: | 1086817 | |||
|
Description
Petr Matousek
2014-04-11 15:01:25 UTC
A trivial patch covering the basic usage is:
--- /usr/lib/python2.6/site-packages/qpid/messaging/endpoints.py.orig 2014-01-28 18:49:12.000000000 +0100
+++ /usr/lib/python2.6/site-packages/qpid/messaging/endpoints.py.new 2014-06-15 14:32:27.825739016 +0200
@@ -758,6 +758,8 @@ class Session(Endpoint):
def _mangle(addr):
if addr and addr.startswith("#"):
+ if (";" not in addr): # ensure queue is created as auto-delete exclusive
+ addr = addr + "; {create:always, node:{ x-declare:{auto-delete:True, exclusive:True}}}"
return str(uuid4()) + addr
else:
return addr
It covers addresses without options. If an address is like "#q; { .. }", then the patch won't help.
Fixing all those options would be quite complex. C++ client has whole class about it, to parse the address string and potentially modify it like with "#". Not sure if worth spending time on that just for this use case.
Petre, is this change sufficient?
Disregard the previous.. /me was stupid, python client has similar address string parsing.
Following what C++ client does:
if (qpid::messaging::AddressImpl::isTemporary(a) && createPolicy.isVoid()) {
createPolicy = "always";
Opt specified = Opt(a)/NODE/X_DECLARE;
if (!specified.hasKey(AUTO_DELETE)) autoDelete = true;
if (!specified.hasKey(EXCLUSIVE)) exclusive = true;
}
Python patch should be:
--- /usr/lib/python2.6/site-packages/qpid/messaging/endpoints.py.orig 2014-01-28 18:49:12.000000000 +0100
+++ /usr/lib/python2.6/site-packages/qpid/messaging/endpoints.py.new 2014-06-15 15:02:03.868738972 +0200
@@ -587,7 +587,6 @@ class Session(Endpoint):
@rtype: Sender
@return: a new Sender for the specified target
"""
- target = _mangle(target)
sender = Sender(self, self.next_sender_id, target, options)
self.next_sender_id += 1
self.senders.append(sender)
@@ -611,7 +610,6 @@ class Session(Endpoint):
@rtype: Receiver
@return: a new Receiver for the specified source
"""
- source = _mangle(source)
receiver = Receiver(self, self.next_receiver_id, source, options)
self.next_receiver_id += 1
self.receivers.append(receiver)
@@ -756,12 +754,6 @@ class Session(Endpoint):
finally:
self.connection._remove_session(self)
-def _mangle(addr):
- if addr and addr.startswith("#"):
- return str(uuid4()) + addr
- else:
- return addr
-
class Sender(Endpoint):
"""
--- /usr/lib/python2.6/site-packages/qpid/messaging/driver.py.orig 2014-01-28 18:49:12.000000000 +0100
+++ /usr/lib/python2.6/site-packages/qpid/messaging/driver.py.new 2014-06-15 15:01:29.976739603 +0200
@@ -34,6 +34,7 @@ from qpid.selector import Selector
from qpid.util import URL, default
from qpid.validator import And, Context, List, Map, Types, Values
from threading import Condition, Thread
+from qpid.datatypes import uuid4
log = getLogger("qpid.messaging")
rawlog = getLogger("qpid.messaging.io.raw")
@@ -944,6 +945,16 @@ class Engine:
# XXX: subject
if lnk.options is None:
lnk.options = {}
+ # if address starts with '#', create auxiliary queue with name preceded by uuid
+ if addr.startswith("#") and 'create' not in lnk.options:
+ lnk.name = str(uuid4()) + lnk.name
+ lnk.options['create'] = "always"
+ if 'node' not in lnk.options:
+ lnk.options['node'] = {}
+ if 'x-declare' not in lnk.options['node']:
+ lnk.options['node']['x-declare'] = {}
+ lnk.options['node']['x-declare']['auto-delete'] = "True"
+ lnk.options['node']['x-declare']['exclusive'] = "True"
except address.LexError, e:
return MalformedAddress(text=str(e))
except address.ParseError, e:
/me to run automated tests..
Autotests passed. Committed to upstream r1602820. (In reply to Pavel Moravec from comment #3) > Autotests passed. > > Committed to upstream r1602820. Disregard.. that breaks application to get expanded address. A fix proposal covering that is at https://reviews.apache.org/r/22630/ Committed revision 1608350. This is the only commit relevant for / fixing this BZ. *** Bug 1086817 has been marked as a duplicate of this bug. *** When the temporary node is requested (using address starting with '#' character) using the Qpid python client, the temporary node created has always auto-delete and exclusive flags set to true, even if explicitly requested otherwise.
I believe that there still should be possibility to declare the temporary node to be non-auto-delete/non-exclusive as with Qpid C++ client, this is imho needless inconsistency. Feel free to argue.
C++ client:
# ./drain -t 5 "#q-non-exclusive;{node:{x-declare:{exclusive:False}}}" &
c52b06ff-ca57-40f4-ac10-fccb5a114795#q-non-exclusive auto-del
# ./drain -t 5 "#q-non-auto-delete;{node:{x-declare:{auto-delete:False}}}" &
deda220f-4e80-49de-ab52-16ac4ff082e9#q-non-auto-delete excl
Python client:
# ./drain -t 5 "#q-non-exclusive;{node:{x-declare:{exclusive:False}}}" &
a0ca7851-73a4-49a8-bb64-cec2f42c5cef#q-non-exclusive auto-del excl
# ./drain -t 5 "#q-non-auto-delete;{node:{x-declare:{exclusive:False}}}" &
76b0b2f4-8b44-40e4-b968-69ca756b63b1#q-non-auto-delete auto-del excl
The proposal makes sense. Committed to upstream as 1656278. This issue has been fixed. Verified on rhel6.6 (x86_64 and i386) and rhel7. Packages: qpid-cpp-*-0.30-6 -> VERIFIED (In reply to Petr Matousek from comment #13) > This issue has been fixed. Verified on rhel6.6 (x86_64 and i386) and rhel7. > > Packages: > qpid-cpp-*-0.30-6 > > -> VERIFIED - qpid-cpp-*-0.30-6 + python-qpid-0.30-5 Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHEA-2015-0805.html |