- def register(self, name, location, metadata):
- params = {'is_public':'true', 'disk_format':'diskdump'}
- try:
- self.image_client.register(name, location, params, metadata)
- except ClientError as e:
- raise FatalError("Image client: %d %s" % (e.status, e.message))
+ hash_cb = self.out.progress_generator(hp) if hp is not None else None
+ upload_cb = self.out.progress_generator(up) if up is not None else None
+
+ self.pithos_client.upload_object(path, file_obj, size, hash_cb,
+ upload_cb)
+
+ return "pithos://%s/%s/%s" % (self.account['uuid'], self.CONTAINER,
+ path)
+
+ def register(self, name, location, metadata, public=False):
+ """Register an image to ~okeanos"""
+
+ # Convert all metadata to strings
+ str_metadata = {}
+ for (key, value) in metadata.iteritems():
+ str_metadata[str(key)] = str(value)
+ is_public = 'true' if public else 'false'
+ params = {'is_public': is_public, 'disk_format': 'diskdump'}
+ self.image_client.register(name, location, params, str_metadata)