Merge "Object services user-agent string uses full name"
This commit is contained in:
commit
8aefe579b4
@ -126,9 +126,11 @@ status_int The response code for the request.
|
|||||||
content_length The value of the Content-Length header in the response.
|
content_length The value of the Content-Length header in the response.
|
||||||
referer The value of the HTTP Referer header.
|
referer The value of the HTTP Referer header.
|
||||||
transaction_id The transaction id of the request.
|
transaction_id The transaction id of the request.
|
||||||
user_agent The value of the HTTP User-Agent header. Swift's proxy
|
user_agent The value of the HTTP User-Agent header. Swift services
|
||||||
server sets its user-agent to
|
report a user-agent string of the service name followed by
|
||||||
``"proxy-server <pid of the proxy>".``
|
the process ID, such as ``"proxy-server <pid of the
|
||||||
|
proxy>"`` or ``"object-updater <pid of the object
|
||||||
|
updater>"``.
|
||||||
request_time The duration of the request.
|
request_time The duration of the request.
|
||||||
additional_info Additional useful information.
|
additional_info Additional useful information.
|
||||||
server_pid The process id of the server
|
server_pid The process id of the server
|
||||||
|
@ -70,7 +70,7 @@ class ObjectController(server.ObjectController):
|
|||||||
:param objdevice: device name that the object is in
|
:param objdevice: device name that the object is in
|
||||||
:param policy_idx: the associated storage policy index
|
:param policy_idx: the associated storage policy index
|
||||||
"""
|
"""
|
||||||
headers_out['user-agent'] = 'obj-server %s' % os.getpid()
|
headers_out['user-agent'] = 'object-server %s' % os.getpid()
|
||||||
full_path = '/%s/%s/%s' % (account, container, obj)
|
full_path = '/%s/%s/%s' % (account, container, obj)
|
||||||
if all([host, partition, contdevice]):
|
if all([host, partition, contdevice]):
|
||||||
try:
|
try:
|
||||||
|
@ -86,7 +86,7 @@ class ObjectReplicator(Daemon):
|
|||||||
self.disk_chunk_size = int(conf.get('disk_chunk_size', 65536))
|
self.disk_chunk_size = int(conf.get('disk_chunk_size', 65536))
|
||||||
self.headers = {
|
self.headers = {
|
||||||
'Content-Length': '0',
|
'Content-Length': '0',
|
||||||
'user-agent': 'obj-replicator %s' % os.getpid()}
|
'user-agent': 'object-replicator %s' % os.getpid()}
|
||||||
self.rsync_error_log_line_length = \
|
self.rsync_error_log_line_length = \
|
||||||
int(conf.get('rsync_error_log_line_length', 0))
|
int(conf.get('rsync_error_log_line_length', 0))
|
||||||
self.handoffs_first = config_true_value(conf.get('handoffs_first',
|
self.handoffs_first = config_true_value(conf.get('handoffs_first',
|
||||||
|
@ -169,7 +169,7 @@ class ObjectController(object):
|
|||||||
:param objdevice: device name that the object is in
|
:param objdevice: device name that the object is in
|
||||||
:param policy_index: the associated storage policy index
|
:param policy_index: the associated storage policy index
|
||||||
"""
|
"""
|
||||||
headers_out['user-agent'] = 'obj-server %s' % os.getpid()
|
headers_out['user-agent'] = 'object-server %s' % os.getpid()
|
||||||
full_path = '/%s/%s/%s' % (account, container, obj)
|
full_path = '/%s/%s/%s' % (account, container, obj)
|
||||||
if all([host, partition, contdevice]):
|
if all([host, partition, contdevice]):
|
||||||
try:
|
try:
|
||||||
|
@ -258,7 +258,7 @@ class ObjectUpdater(Daemon):
|
|||||||
:param headers: headers to send with the update
|
:param headers: headers to send with the update
|
||||||
"""
|
"""
|
||||||
headers_out = headers.copy()
|
headers_out = headers.copy()
|
||||||
headers_out['user-agent'] = 'obj-updater %s' % os.getpid()
|
headers_out['user-agent'] = 'object-updater %s' % os.getpid()
|
||||||
try:
|
try:
|
||||||
with ConnectionTimeout(self.conn_timeout):
|
with ConnectionTimeout(self.conn_timeout):
|
||||||
conn = http_connect(node['ip'], node['port'], node['device'],
|
conn = http_connect(node['ip'], node['port'], node['device'],
|
||||||
|
@ -689,7 +689,7 @@ class TestObjectReplicator(unittest.TestCase):
|
|||||||
self.replicator.partition_times = []
|
self.replicator.partition_times = []
|
||||||
|
|
||||||
self.headers = {'Content-Length': '0',
|
self.headers = {'Content-Length': '0',
|
||||||
'user-agent': 'obj-replicator %s' % os.getpid()}
|
'user-agent': 'object-replicator %s' % os.getpid()}
|
||||||
self.replicator.logger = mock_logger = mock.MagicMock()
|
self.replicator.logger = mock_logger = mock.MagicMock()
|
||||||
mock_tpool_reraise.return_value = (0, {})
|
mock_tpool_reraise.return_value = (0, {})
|
||||||
|
|
||||||
|
@ -2319,7 +2319,7 @@ class TestObjectController(unittest.TestCase):
|
|||||||
given_args,
|
given_args,
|
||||||
['127.0.0.1', '1234', 'sdc1', 1, 'PUT', '/a/c/o', {
|
['127.0.0.1', '1234', 'sdc1', 1, 'PUT', '/a/c/o', {
|
||||||
'x-timestamp': '1', 'x-out': 'set',
|
'x-timestamp': '1', 'x-out': 'set',
|
||||||
'user-agent': 'obj-server %s' % os.getpid(),
|
'user-agent': 'object-server %s' % os.getpid(),
|
||||||
'X-Backend-Storage-Policy-Index': policy.idx}])
|
'X-Backend-Storage-Policy-Index': policy.idx}])
|
||||||
|
|
||||||
@patch_policies([storage_policy.StoragePolicy(0, 'zero', True),
|
@patch_policies([storage_policy.StoragePolicy(0, 'zero', True),
|
||||||
@ -2399,7 +2399,7 @@ class TestObjectController(unittest.TestCase):
|
|||||||
'x-timestamp': utils.Timestamp('12345').internal,
|
'x-timestamp': utils.Timestamp('12345').internal,
|
||||||
'X-Backend-Storage-Policy-Index': '37',
|
'X-Backend-Storage-Policy-Index': '37',
|
||||||
'referer': 'PUT http://localhost/sda1/p/a/c/o',
|
'referer': 'PUT http://localhost/sda1/p/a/c/o',
|
||||||
'user-agent': 'obj-server %d' % os.getpid(),
|
'user-agent': 'object-server %d' % os.getpid(),
|
||||||
'X-Backend-Storage-Policy-Index': policy.idx,
|
'X-Backend-Storage-Policy-Index': policy.idx,
|
||||||
'x-trans-id': '-'})})
|
'x-trans-id': '-'})})
|
||||||
self.assertEquals(
|
self.assertEquals(
|
||||||
@ -2417,7 +2417,7 @@ class TestObjectController(unittest.TestCase):
|
|||||||
'x-size': '0',
|
'x-size': '0',
|
||||||
'x-timestamp': utils.Timestamp('12345').internal,
|
'x-timestamp': utils.Timestamp('12345').internal,
|
||||||
'referer': 'PUT http://localhost/sda1/p/a/c/o',
|
'referer': 'PUT http://localhost/sda1/p/a/c/o',
|
||||||
'user-agent': 'obj-server %d' % os.getpid(),
|
'user-agent': 'object-server %d' % os.getpid(),
|
||||||
# system account storage policy is 0
|
# system account storage policy is 0
|
||||||
'X-Backend-Storage-Policy-Index': 0,
|
'X-Backend-Storage-Policy-Index': 0,
|
||||||
'x-trans-id': '-'})})
|
'x-trans-id': '-'})})
|
||||||
@ -2436,7 +2436,7 @@ class TestObjectController(unittest.TestCase):
|
|||||||
'x-size': '0',
|
'x-size': '0',
|
||||||
'x-timestamp': utils.Timestamp('12345').internal,
|
'x-timestamp': utils.Timestamp('12345').internal,
|
||||||
'referer': 'PUT http://localhost/sda1/p/a/c/o',
|
'referer': 'PUT http://localhost/sda1/p/a/c/o',
|
||||||
'user-agent': 'obj-server %d' % os.getpid(),
|
'user-agent': 'object-server %d' % os.getpid(),
|
||||||
# system account storage policy is 0
|
# system account storage policy is 0
|
||||||
'X-Backend-Storage-Policy-Index': 0,
|
'X-Backend-Storage-Policy-Index': 0,
|
||||||
'x-trans-id': '-'})})
|
'x-trans-id': '-'})})
|
||||||
@ -2507,7 +2507,7 @@ class TestObjectController(unittest.TestCase):
|
|||||||
'x-timestamp': utils.Timestamp('12345').internal,
|
'x-timestamp': utils.Timestamp('12345').internal,
|
||||||
'X-Backend-Storage-Policy-Index': '26',
|
'X-Backend-Storage-Policy-Index': '26',
|
||||||
'referer': 'PUT http://localhost/sda1/p/a/c/o',
|
'referer': 'PUT http://localhost/sda1/p/a/c/o',
|
||||||
'user-agent': 'obj-server %d' % os.getpid(),
|
'user-agent': 'object-server %d' % os.getpid(),
|
||||||
'x-trans-id': '-'})})
|
'x-trans-id': '-'})})
|
||||||
self.assertEquals(
|
self.assertEquals(
|
||||||
http_connect_args[1],
|
http_connect_args[1],
|
||||||
@ -2525,7 +2525,7 @@ class TestObjectController(unittest.TestCase):
|
|||||||
'x-timestamp': utils.Timestamp('12345').internal,
|
'x-timestamp': utils.Timestamp('12345').internal,
|
||||||
'X-Backend-Storage-Policy-Index': '26',
|
'X-Backend-Storage-Policy-Index': '26',
|
||||||
'referer': 'PUT http://localhost/sda1/p/a/c/o',
|
'referer': 'PUT http://localhost/sda1/p/a/c/o',
|
||||||
'user-agent': 'obj-server %d' % os.getpid(),
|
'user-agent': 'object-server %d' % os.getpid(),
|
||||||
'x-trans-id': '-'})})
|
'x-trans-id': '-'})})
|
||||||
|
|
||||||
def test_object_delete_at_aysnc_update(self):
|
def test_object_delete_at_aysnc_update(self):
|
||||||
@ -2639,7 +2639,7 @@ class TestObjectController(unittest.TestCase):
|
|||||||
'06fbf0b514e5199dfc4e00f42eb5ea83-%s' %
|
'06fbf0b514e5199dfc4e00f42eb5ea83-%s' %
|
||||||
utils.Timestamp(1).internal))),
|
utils.Timestamp(1).internal))),
|
||||||
{'headers': {'x-timestamp': '1', 'x-out': 'set',
|
{'headers': {'x-timestamp': '1', 'x-out': 'set',
|
||||||
'user-agent': 'obj-server %s' % os.getpid(),
|
'user-agent': 'object-server %s' % os.getpid(),
|
||||||
'X-Backend-Storage-Policy-Index': policy.idx},
|
'X-Backend-Storage-Policy-Index': policy.idx},
|
||||||
'account': 'a', 'container': 'c', 'obj': 'o', 'op': 'PUT'})
|
'account': 'a', 'container': 'c', 'obj': 'o', 'op': 'PUT'})
|
||||||
|
|
||||||
@ -2680,7 +2680,8 @@ class TestObjectController(unittest.TestCase):
|
|||||||
'06fbf0b514e5199dfc4e00f42eb5ea83-%s' %
|
'06fbf0b514e5199dfc4e00f42eb5ea83-%s' %
|
||||||
utils.Timestamp(1).internal))),
|
utils.Timestamp(1).internal))),
|
||||||
{'headers': {'x-timestamp': '1', 'x-out': str(status),
|
{'headers': {'x-timestamp': '1', 'x-out': str(status),
|
||||||
'user-agent': 'obj-server %s' % os.getpid(),
|
'user-agent':
|
||||||
|
'object-server %s' % os.getpid(),
|
||||||
'X-Backend-Storage-Policy-Index':
|
'X-Backend-Storage-Policy-Index':
|
||||||
policy.idx},
|
policy.idx},
|
||||||
'account': 'a', 'container': 'c', 'obj': 'o',
|
'account': 'a', 'container': 'c', 'obj': 'o',
|
||||||
@ -2803,7 +2804,7 @@ class TestObjectController(unittest.TestCase):
|
|||||||
self.assertEqual(method, 'PUT')
|
self.assertEqual(method, 'PUT')
|
||||||
self.assertEqual(path, '/cdevice/cpartition/a/c/o')
|
self.assertEqual(path, '/cdevice/cpartition/a/c/o')
|
||||||
self.assertEqual(headers, HeaderKeyDict({
|
self.assertEqual(headers, HeaderKeyDict({
|
||||||
'user-agent': 'obj-server %s' % os.getpid(),
|
'user-agent': 'object-server %s' % os.getpid(),
|
||||||
'x-size': '0',
|
'x-size': '0',
|
||||||
'x-etag': 'd41d8cd98f00b204e9800998ecf8427e',
|
'x-etag': 'd41d8cd98f00b204e9800998ecf8427e',
|
||||||
'x-content-type': 'text/plain',
|
'x-content-type': 'text/plain',
|
||||||
@ -2844,7 +2845,7 @@ class TestObjectController(unittest.TestCase):
|
|||||||
self.assertEqual(data, {
|
self.assertEqual(data, {
|
||||||
'headers': HeaderKeyDict({
|
'headers': HeaderKeyDict({
|
||||||
'X-Size': '0',
|
'X-Size': '0',
|
||||||
'User-Agent': 'obj-server %s' % os.getpid(),
|
'User-Agent': 'object-server %s' % os.getpid(),
|
||||||
'X-Content-Type': 'text/plain',
|
'X-Content-Type': 'text/plain',
|
||||||
'X-Timestamp': utils.Timestamp(1).internal,
|
'X-Timestamp': utils.Timestamp(1).internal,
|
||||||
'X-Trans-Id': '123',
|
'X-Trans-Id': '123',
|
||||||
|
Loading…
Reference in New Issue
Block a user