mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fix simulator and marvin
- Remove additional parantheses in marvin VirtualMachine.create( - Implement createEntityExtractUrl command for simulator Signed-off-by: Prasanna Santhanam <tsp@apache.org> (cherry picked from commit 908df7aabdd7bfca1d0a3c1b39a83111b61ee692)
This commit is contained in:
parent
abfc351b78
commit
2c660cdbc2
@ -26,31 +26,26 @@ import com.cloud.agent.api.to.DataStoreTO;
|
|||||||
import com.cloud.agent.api.to.NfsTO;
|
import com.cloud.agent.api.to.NfsTO;
|
||||||
import com.cloud.storage.Storage;
|
import com.cloud.storage.Storage;
|
||||||
import com.cloud.storage.VMTemplateStorageResourceAssoc;
|
import com.cloud.storage.VMTemplateStorageResourceAssoc;
|
||||||
import com.cloud.storage.VMTemplateVO;
|
|
||||||
import com.cloud.storage.VolumeVO;
|
|
||||||
import com.cloud.storage.dao.VMTemplateDao;
|
import com.cloud.storage.dao.VMTemplateDao;
|
||||||
import com.cloud.storage.dao.VolumeDao;
|
import com.cloud.storage.dao.VolumeDao;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult;
|
import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
|
import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
|
||||||
|
import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
|
||||||
import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher;
|
import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher;
|
||||||
import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
|
import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
|
||||||
import org.apache.cloudstack.framework.async.AsyncRpcContext;
|
|
||||||
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
|
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
|
||||||
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
|
|
||||||
import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreDao;
|
import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreDao;
|
||||||
import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreVO;
|
|
||||||
import org.apache.cloudstack.storage.image.BaseImageStoreDriverImpl;
|
import org.apache.cloudstack.storage.image.BaseImageStoreDriverImpl;
|
||||||
import org.apache.cloudstack.storage.image.store.ImageStoreImpl;
|
import org.apache.cloudstack.storage.image.store.ImageStoreImpl;
|
||||||
import org.apache.cloudstack.storage.to.TemplateObjectTO;
|
import org.apache.log4j.Logger;
|
||||||
import org.apache.cloudstack.storage.to.VolumeObjectTO;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class SimulatorImageStoreDriverImpl extends BaseImageStoreDriverImpl {
|
public class SimulatorImageStoreDriverImpl extends BaseImageStoreDriverImpl {
|
||||||
|
private static final Logger s_logger = Logger.getLogger(SimulatorImageStoreDriverImpl.class);
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
TemplateDataStoreDao _templateStoreDao;
|
TemplateDataStoreDao _templateStoreDao;
|
||||||
@ -60,6 +55,8 @@ public class SimulatorImageStoreDriverImpl extends BaseImageStoreDriverImpl {
|
|||||||
VolumeDao _volumeDao;
|
VolumeDao _volumeDao;
|
||||||
@Inject
|
@Inject
|
||||||
VolumeDataStoreDao _volumeStoreDao;
|
VolumeDataStoreDao _volumeStoreDao;
|
||||||
|
@Inject
|
||||||
|
EndPointSelector _epSelector;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataStoreTO getStoreTO(DataStore store) {
|
public DataStoreTO getStoreTO(DataStore store) {
|
||||||
@ -71,11 +68,6 @@ public class SimulatorImageStoreDriverImpl extends BaseImageStoreDriverImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public String createEntityExtractUrl(DataStore store, String installPath, Storage.ImageFormat format) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createAsync(DataStore dataStore, DataObject data, AsyncCompletionCallback<CreateCmdResult> callback) {
|
public void createAsync(DataStore dataStore, DataObject data, AsyncCompletionCallback<CreateCmdResult> callback) {
|
||||||
if (data.getType() == DataObjectType.TEMPLATE) {
|
if (data.getType() == DataObjectType.TEMPLATE) {
|
||||||
@ -112,4 +104,20 @@ public class SimulatorImageStoreDriverImpl extends BaseImageStoreDriverImpl {
|
|||||||
caller.complete(answer);
|
caller.complete(answer);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String createEntityExtractUrl(DataStore store, String installPath, Storage.ImageFormat format, DataObject dataObject) {
|
||||||
|
EndPoint ep = _epSelector.select(store);
|
||||||
|
// Create Symlink at ssvm
|
||||||
|
String path = installPath;
|
||||||
|
String uuid = UUID.randomUUID().toString() + "." + format.getFileExtension();
|
||||||
|
// Construct actual URL locally now that the symlink exists at SSVM
|
||||||
|
return generateCopyUrl(ep.getPublicAddr(), uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String generateCopyUrl(String ipAddress, String uuid){
|
||||||
|
String hostname = ipAddress;
|
||||||
|
String scheme = "http";
|
||||||
|
return scheme + "://" + hostname + "/userdata/" + uuid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user