obysnc: fix content-type on RGWStore

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
This commit is contained in:
Colin Patrick McCabe 2011-05-25 17:48:02 -07:00
parent 6cf67a26ad
commit 05cfb4d5ca
2 changed files with 15 additions and 7 deletions

View File

@ -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):

View File

@ -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"])