diff options
author | Colin Patrick McCabe <cmccabe@alumni.cmu.edu> | 2011-05-25 17:48:02 -0700 |
---|---|---|
committer | Colin Patrick McCabe <cmccabe@alumni.cmu.edu> | 2011-05-25 17:48:02 -0700 |
commit | 05cfb4d5cab7f19412ce09ac52408fe1ada8df5a (patch) | |
tree | 874c85da9a3532a2c5476828d0cce8ea68ad3ee1 /src/obsync | |
parent | 6cf67a26ad2cdd3bbd2aafaa11b5c355665b7d0d (diff) | |
download | ceph-05cfb4d5cab7f19412ce09ac52408fe1ada8df5a.tar.gz |
obysnc: fix content-type on RGWStore
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
Diffstat (limited to 'src/obsync')
-rwxr-xr-x | src/obsync/obsync | 14 | ||||
-rwxr-xr-x | src/obsync/test-obsync.py | 8 |
2 files changed, 15 insertions, 7 deletions
diff --git a/src/obsync/obsync b/src/obsync/obsync index a592a056352..b91f2c86f0f 100755 --- a/src/obsync/obsync +++ b/src/obsync/obsync @@ -890,7 +890,7 @@ xsi:type=\"CanonicalUser\"><ID>%s</ID> \ elif k == RGW_META_CONTENT_TYPE: meta[CONTENT_TYPE_XATTR] = v elif k[:len(RGW_META_PREFIX)] == RGW_META_PREFIX: - meta["rados.meta." + k[RGW_META_PREFIX:]] = v + meta["rados.meta." + k[len(RGW_META_PREFIX):]] = v elif opts.more_verbose: print "ignoring unknown xattr " + k if (md5 == None): @@ -976,13 +976,13 @@ xsi:type=\"CanonicalUser\"><ID>%s</ID> \ xml = ap.to_xml() bin_ = lrgw.acl_xml2bin(xml) self.ioctx.set_xattr(obj.name, "user.rgw.acl", bin_) + content_type = "application/octet-stream" for k,v in obj.meta.items(): - self.ioctx.set_xattr(obj.name, - RGW_META_PREFIX + k[META_XATTR_PREFIX:], v) - if (obj.meta.has_key(CONTENT_TYPE_XATTR)): - content_type = meta[CONTENT_TYPE_XATTR] - else: - content_type = "application/octet-stream" + if k == CONTENT_TYPE_XATTR: + content_type = v + elif k[:len(META_XATTR_PREFIX)] == META_XATTR_PREFIX: + self.ioctx.set_xattr(obj.name, + RGW_META_PREFIX + k[len(META_XATTR_PREFIX):], v) self.ioctx.set_xattr(obj.name, "user.rgw.content_type", content_type) def remove(self, obj): if (opts.dry_run): diff --git a/src/obsync/test-obsync.py b/src/obsync/test-obsync.py index 992bfb59e20..30d6870395b 100755 --- a/src/obsync/test-obsync.py +++ b/src/obsync/test-obsync.py @@ -555,10 +555,18 @@ if len(opts.pools) > 0: f = open("%s/rgw1/aaa" % tdir, 'w') f.write("aaa") f.close() + f = open("%s/rgw1/brick" % tdir, 'w') + f.write("br\0ick") + f.close() obsync_check("%s/rgw1" % tdir, opts.pools[0], []) print "testing rgw source" obsync_check(opts.pools[0], "%s/rgw2" % tdir, ["-c"]) compare_directories("%s/rgw1" % tdir, "%s/rgw2" % tdir, compare_xattr = False) + # some tests with xattrs + xattr_sync("%s/rgw2/brick" % tdir, { CONTENT_TYPE_XATTR : "bricks" }) + obsync_check("%s/rgw2" % tdir, opts.pools[0], []) + obsync_check(opts.pools[0], "%s/rgw3" % tdir, ["-c"]) + compare_directories("%s/rgw2" % tdir, "%s/rgw3" % tdir, compare_xattr = True) # print "testing rgw target with --create" # obsync_check("%s/rgw1" % tdir, opts.pools[0], ["--create"]) |