Download system template while adding S3 image store is working.

This commit is contained in:
Min Chen 2013-05-09 19:07:57 -07:00
parent 0824be38ff
commit f965e2d892
5 changed files with 15 additions and 7 deletions

View File

@ -10,6 +10,7 @@ import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.util.List; import java.util.List;
import java.util.concurrent.Executors;
import org.apache.cloudstack.storage.command.DownloadSystemTemplateCommand; import org.apache.cloudstack.storage.command.DownloadSystemTemplateCommand;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -34,6 +35,7 @@ public class LocalNfsSecondaryStorageResource extends
public LocalNfsSecondaryStorageResource(){ public LocalNfsSecondaryStorageResource(){
this._dlMgr = new DownloadManagerImpl(); this._dlMgr = new DownloadManagerImpl();
((DownloadManagerImpl)_dlMgr).setThreadPool(Executors.newFixedThreadPool(10));
} }
@Override @Override

View File

@ -279,9 +279,9 @@ public class S3TemplateDownloader implements TemplateDownloader {
@Override @Override
public void progressChanged( public void progressChanged(
ProgressEvent progressEvent) { ProgressEvent progressEvent) {
s_logger.info(progressEvent.getBytesTransfered() // s_logger.debug(progressEvent.getBytesTransfered()
+ " number of byte transferd " // + " number of byte transferd "
+ new Date()); // + new Date());
totalBytes += progressEvent.getBytesTransfered(); totalBytes += progressEvent.getBytesTransfered();
if (progressEvent.getEventCode() == ProgressEvent.COMPLETED_EVENT_CODE) { if (progressEvent.getEventCode() == ProgressEvent.COMPLETED_EVENT_CODE) {
s_logger.info("download completed"); s_logger.info("download completed");

View File

@ -477,7 +477,9 @@ public class TemplateServiceImpl implements TemplateService {
return null; return null;
} }
parentCallback.complete(result); if (parentCallback != null){
parentCallback.complete(result);
}
return null; return null;
} }

View File

@ -105,6 +105,7 @@ CREATE VIEW `cloud`.`image_store_view` AS
image_store.protocol, image_store.protocol,
image_store.url, image_store.url,
image_store.scope, image_store.scope,
image_store.role,
data_center.id data_center_id, data_center.id data_center_id,
data_center.uuid data_center_uuid, data_center.uuid data_center_uuid,
data_center.name data_center_name, data_center.name data_center_name,
@ -115,8 +116,8 @@ CREATE VIEW `cloud`.`image_store_view` AS
left join left join
`cloud`.`data_center` ON image_store.data_center_id = data_center.id `cloud`.`data_center` ON image_store.data_center_id = data_center.id
left join left join
`cloud`.`image_store_details` ON image_store_details.store_id = image_store.id `cloud`.`image_store_details` ON image_store_details.store_id = image_store.id;
where image_store.role = 'Image';
-- here we have to allow null for store_id to accomodate baremetal case to search for ready templates since template state is only stored in this table -- here we have to allow null for store_id to accomodate baremetal case to search for ready templates since template state is only stored in this table
-- FK also commented out due to this -- FK also commented out due to this
@ -732,3 +733,6 @@ CREATE VIEW `cloud`.`volume_view` AS
`cloud`.`async_job` ON async_job.instance_id = volumes.id `cloud`.`async_job` ON async_job.instance_id = volumes.id
and async_job.instance_type = 'Volume' and async_job.instance_type = 'Volume'
and async_job.job_status = 0; and async_job.job_status = 0;
update `cloud`.`vm_template` set state='Allocated' where state is NULL;
update `cloud`.`vm_template` set update_count=0 where update_count is NULL;

View File

@ -91,7 +91,7 @@
}, },
{ {
"key" : "secretkey", "key" : "secretkey",
"value" : "OYAZXCAFUC1DAFOXNJWI" "value" : "YHpRtzNDwl12DtrQmwRvdpnf2xK2AeVM30rXxQ=="
}, },
{ {
"key" : "endpoint", "key" : "endpoint",