Skip to content

Commit

Permalink
Merge remote-tracking branch 'gh/next'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sage Weil committed Aug 9, 2013
2 parents 9baaf86 + 44b093c commit d3d56ee
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 30 deletions.
38 changes: 23 additions & 15 deletions src/ceph.in
Original file line number Diff line number Diff line change
Expand Up @@ -691,26 +691,34 @@ def main():
childargs.extend(['--format', parsed_args.output_format])
ret, outbuf, outs = send_command(cluster_handle, target, childargs,
inbuf)
elif ret:
if ret < 0:
outs = 'problem getting command descriptions from {0}.{1}'.format(*target)
else:
sigdict = parse_json_funcsigs(outbuf, 'cli')

if parsed_args.completion:
return complete(sigdict, childargs, target)
if ret == -errno.EINVAL:
# did we race with a mon upgrade? try again!
ret, outbuf, outs = json_command(cluster_handle, target=target,
prefix='get_command_descriptions')
if ret == 0:
compat = False # yep, carry on
if not compat:
if ret:
if ret < 0:
outs = 'problem getting command descriptions from {0}.{1}'.format(*target)
else:
sigdict = parse_json_funcsigs(outbuf, 'cli')

ret, outbuf, outs = new_style_command(parsed_args, childargs, target,
sigdict, inbuf, verbose)
if parsed_args.completion:
return complete(sigdict, childargs, target)

# debug tool: send any successful command *again* to
# verify that it is idempotent.
if not ret and 'CEPH_CLI_TEST_DUP_COMMAND' in os.environ:
ret, outbuf, outs = new_style_command(parsed_args, childargs, target,
sigdict, inbuf, verbose)
if ret < 0:
ret = -ret
print >> sys.stderr, prefix + 'Second attempt of previously successful command failed with {0}: {1}'.format(errno.errorcode[ret], outs)

# debug tool: send any successful command *again* to
# verify that it is idempotent.
if not ret and 'CEPH_CLI_TEST_DUP_COMMAND' in os.environ:
ret, outbuf, outs = new_style_command(parsed_args, childargs, target,
sigdict, inbuf, verbose)
if ret < 0:
ret = -ret
print >> sys.stderr, prefix + 'Second attempt of previously successful command failed with {0}: {1}'.format(errno.errorcode[ret], outs)

if ret < 0:
ret = -ret
Expand Down
13 changes: 6 additions & 7 deletions src/common/pick_address.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,14 @@ static const struct sockaddr *find_ip_in_subnet_list(CephContext *cct,

// observe this change
struct Observer : public md_config_obs_t {
const char *conf_var;
Observer(const char *c) : conf_var(c) {}
const char *keys[2];
Observer(const char *c) {
keys[0] = c;
keys[1] = NULL;
}

const char** get_tracked_conf_keys() const {
static const char *foo[] = {
conf_var,
NULL
};
return foo;
return (const char **)keys;
}
void handle_conf_change(const struct md_config_t *conf,
const std::set <std::string> &changed) {
Expand Down
2 changes: 1 addition & 1 deletion src/librados/RadosClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ void librados::RadosClient::shutdown()
if (state == CONNECTED) {
finisher.stop();
}
monclient.shutdown();
bool need_objecter = false;
if (objecter && state == CONNECTED) {
need_objecter = true;
Expand All @@ -238,6 +237,7 @@ void librados::RadosClient::shutdown()
state = DISCONNECTED;
timer.shutdown(); // will drop+retake lock
lock.Unlock();
monclient.shutdown();
if (need_objecter)
objecter->shutdown_unlocked();
if (messenger) {
Expand Down
1 change: 1 addition & 0 deletions src/rgw/rgw_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ using ceph::crypto::MD5;
#define ERR_TOO_SMALL 2022
#define ERR_NOT_FOUND 2023
#define ERR_PERMANENT_REDIRECT 2024
#define ERR_LOCKED 2025
#define ERR_USER_SUSPENDED 2100
#define ERR_INTERNAL_ERROR 2200

Expand Down
6 changes: 3 additions & 3 deletions src/rgw/rgw_http_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ class RGWHTTPClient
headers.push_back(pair<string, string>(name, val));
}

virtual int receive_header(void *ptr, size_t len) { return 0; }
virtual int receive_data(void *ptr, size_t len) { return 0; }
virtual int send_data(void *ptr, size_t len) { return 0; }
virtual int receive_header(void *ptr, size_t len) = 0;
virtual int receive_data(void *ptr, size_t len) = 0;
virtual int send_data(void *ptr, size_t len) = 0;

void set_send_length(size_t len) {
send_len = len;
Expand Down
1 change: 1 addition & 0 deletions src/rgw/rgw_http_errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const static struct rgw_http_errors RGW_HTTP_ERRORS[] = {
{ ERR_PRECONDITION_FAILED, 412, "PreconditionFailed" },
{ ERANGE, 416, "InvalidRange" },
{ ERR_UNPROCESSABLE_ENTITY, 422, "UnprocessableEntity" },
{ ERR_LOCKED, 423, "Locked" },
{ ERR_INTERNAL_ERROR, 500, "InternalError" },
};

Expand Down
4 changes: 4 additions & 0 deletions src/rgw/rgw_rest_log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ void RGWOp_MDLog_Lock::execute() {
}
utime_t time(dur, 0);
http_ret = meta_log->lock_exclusive(shard_id, time, zone_id, locker_id);
if (http_ret == -EBUSY)
http_ret = -ERR_LOCKED;
}

void RGWOp_MDLog_Unlock::execute() {
Expand Down Expand Up @@ -577,6 +579,8 @@ void RGWOp_DATALog_Lock::execute() {
}
utime_t time(dur, 0);
http_ret = store->data_log->lock_exclusive(shard_id, time, zone_id, locker_id);
if (http_ret == -EBUSY)
http_ret = -ERR_LOCKED;
}

void RGWOp_DATALog_Unlock::execute() {
Expand Down
2 changes: 2 additions & 0 deletions src/rgw/rgw_rest_metadata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ void RGWOp_Metadata_Lock::execute() {
}
utime_t time(dur, 0);
http_ret = store->meta_mgr->lock_exclusive(metadata_key, time, lock_id);
if (http_ret == -EBUSY)
http_ret = -ERR_LOCKED;
}

void RGWOp_Metadata_Unlock::execute() {
Expand Down
27 changes: 23 additions & 4 deletions src/rgw/rgw_swift.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,18 @@ class RGWValidateSwiftToken : public RGWHTTPClient {
public:
RGWValidateSwiftToken(CephContext *_cct, struct rgw_swift_auth_info *_info) : RGWHTTPClient(_cct), info(_info) {}

int read_header(void *ptr, size_t len);
int receive_header(void *ptr, size_t len);
int receive_data(void *ptr, size_t len) {
return 0;
}
int send_data(void *ptr, size_t len) {
return 0;
}

friend class RGWKeystoneTokenCache;
};

int RGWValidateSwiftToken::read_header(void *ptr, size_t len)
int RGWValidateSwiftToken::receive_header(void *ptr, size_t len)
{
char line[len + 1];

Expand Down Expand Up @@ -291,10 +297,17 @@ class RGWValidateKeystoneToken : public RGWHTTPClient {
public:
RGWValidateKeystoneToken(CephContext *_cct, bufferlist *_bl) : RGWHTTPClient(_cct), bl(_bl) {}

int read_data(void *ptr, size_t len) {
int receive_data(void *ptr, size_t len) {
bl->append((char *)ptr, len);
return 0;
}
int receive_header(void *ptr, size_t len) {
return 0;
}
int send_data(void *ptr, size_t len) {
return 0;
}

};

static RGWKeystoneTokenCache *keystone_token_cache = NULL;
Expand All @@ -304,10 +317,16 @@ class RGWGetRevokedTokens : public RGWHTTPClient {
public:
RGWGetRevokedTokens(CephContext *_cct, bufferlist *_bl) : RGWHTTPClient(_cct), bl(_bl) {}

int read_data(void *ptr, size_t len) {
int receive_data(void *ptr, size_t len) {
bl->append((char *)ptr, len);
return 0;
}
int receive_header(void *ptr, size_t len) {
return 0;
}
int send_data(void *ptr, size_t len) {
return 0;
}
};

static int open_cms_envelope(CephContext *cct, string& src, string& dst)
Expand Down

0 comments on commit d3d56ee

Please sign in to comment.