mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
- CLOUDSTACK-3229: Fixes a think-o in the handling of unmodifiable
collections and adds a rail in s3xen to raise an exception if the file being put does not exist
This commit is contained in:
parent
1ae682de78
commit
e2bcbe90c0
@ -290,6 +290,7 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import static com.cloud.utils.ReflectUtil.flattenProperties;
|
||||
import static com.google.common.collect.Lists.newArrayList;
|
||||
|
||||
/**
|
||||
* CitrixResourceBase encapsulates the calls to the XenServer Xapi process
|
||||
@ -7404,8 +7405,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
||||
|
||||
try {
|
||||
|
||||
final List<String> parameters = flattenProperties(s3,
|
||||
S3Utils.ClientOptions.class);
|
||||
final List<String> parameters = newArrayList(flattenProperties(s3,
|
||||
S3Utils.ClientOptions.class));
|
||||
parameters.addAll(Arrays.asList("operation", "put", "directory",
|
||||
dir, "filename", filename, "iSCSIFlag",
|
||||
iSCSIFlag.toString(), "bucket", s3.getBucketName(), "key", key));
|
||||
|
||||
@ -81,6 +81,7 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import static com.cloud.utils.ReflectUtil.flattenProperties;
|
||||
import static com.google.common.collect.Lists.newArrayList;
|
||||
|
||||
public class XenServerStorageProcessor implements StorageProcessor {
|
||||
private static final Logger s_logger = Logger.getLogger(XenServerStorageProcessor.class);
|
||||
@ -1073,8 +1074,8 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
||||
|
||||
try {
|
||||
|
||||
final List<String> parameters = flattenProperties(s3,
|
||||
S3Utils.ClientOptions.class);
|
||||
final List<String> parameters = newArrayList(flattenProperties(s3,
|
||||
S3Utils.ClientOptions.class));
|
||||
parameters.addAll(Arrays.asList("operation", "put", "directory",
|
||||
dir, "filename", filename, "iSCSIFlag",
|
||||
iSCSIFlag.toString(), "bucket", s3.getBucketName(), "key", key));
|
||||
|
||||
@ -179,7 +179,7 @@ class S3Client(object):
|
||||
max_error_retry, self.DEFAULT_MAX_ERROR_RETRY)
|
||||
|
||||
def build_canocialized_resource(self, bucket, key):
|
||||
return "/" + join([bucket, key], '/')
|
||||
return "/" + join([bucket, key], "/")
|
||||
|
||||
def noop_send_body(connection):
|
||||
pass
|
||||
@ -256,6 +256,10 @@ class S3Client(object):
|
||||
|
||||
def put(self, bucket, key, src_filename):
|
||||
|
||||
if not os.path.isfile(src_filename):
|
||||
raise Exception(
|
||||
"Attempt to put " + src_filename + " that does not exist.")
|
||||
|
||||
headers = {
|
||||
self.HEADER_CONTENT_MD5: compute_md5(src_filename),
|
||||
self.HEADER_CONTENT_TYPE: 'application/octet-stream',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user