mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
fix build
This commit is contained in:
parent
578d2f62f1
commit
25a6234a5b
@ -18,10 +18,10 @@ package com.cloud.storage;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor;
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
|
||||
public interface StoragePool extends Identity, InternalIdentity {
|
||||
@ -99,13 +99,9 @@ public interface StoragePool extends Identity, InternalIdentity {
|
||||
|
||||
Long getPodId();
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
String getStorageProviderName();
|
||||
|
||||
boolean isInMaintenance();
|
||||
|
||||
Hypervisor.HypervisorType getHypervisor();
|
||||
|
||||
}
|
||||
|
||||
@ -28,6 +28,7 @@ import org.junit.Test;
|
||||
|
||||
import com.cloud.agent.api.BackupSnapshotCommand;
|
||||
import com.cloud.agent.api.to.SwiftTO;
|
||||
import com.cloud.hypervisor.Hypervisor;
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.storage.StoragePoolStatus;
|
||||
@ -145,7 +146,14 @@ public class BackupSnapshotCommandTest {
|
||||
public boolean isInMaintenance() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Hypervisor.HypervisorType getHypervisor() {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
;
|
||||
};
|
||||
|
||||
BackupSnapshotCommand bsc = new BackupSnapshotCommand("http://secondary.Storage.Url", 101L, 102L, 103L, 104L, 105L, "vPath", pool,
|
||||
|
||||
@ -32,6 +32,7 @@ import com.cloud.agent.api.CheckNetworkAnswer;
|
||||
import com.cloud.agent.api.CheckNetworkCommand;
|
||||
import com.cloud.agent.api.storage.ResizeVolumeCommand;
|
||||
import com.cloud.agent.api.to.StorageFilerTO;
|
||||
import com.cloud.hypervisor.Hypervisor;
|
||||
import com.cloud.storage.Storage;
|
||||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.storage.StoragePoolStatus;
|
||||
@ -184,7 +185,14 @@ public class CheckNetworkAnswerTest {
|
||||
public boolean isInMaintenance() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Hypervisor.HypervisorType getHypervisor() {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
;
|
||||
};
|
||||
|
||||
Long newSize = 4194304L;
|
||||
|
||||
@ -28,6 +28,7 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.cloud.agent.api.SnapshotCommand;
|
||||
import com.cloud.hypervisor.Hypervisor;
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.storage.StoragePoolStatus;
|
||||
@ -146,7 +147,14 @@ public class SnapshotCommandTest {
|
||||
public boolean isInMaintenance() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Hypervisor.HypervisorType getHypervisor() {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
;
|
||||
};
|
||||
|
||||
SnapshotCommand ssc = new SnapshotCommand(pool, "http://secondary.Storage.Url", "420fa39c-4ef1-a83c-fd93-46dc1ff515ae", "snapshotName", 101L, 102L, 103L);
|
||||
|
||||
@ -24,8 +24,6 @@ import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver;
|
||||
@ -47,6 +45,7 @@ import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||
import org.apache.cloudstack.storage.to.PrimaryDataStoreTO;
|
||||
import org.apache.cloudstack.storage.volume.VolumeObject;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.api.to.DataObjectType;
|
||||
import com.cloud.agent.api.to.DataStoreTO;
|
||||
@ -391,6 +390,11 @@ public class PrimaryDataStoreImpl implements PrimaryDataStore {
|
||||
getStatus() == StoragePoolStatus.ErrorInMaintenance || getRemoved() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HypervisorType getHypervisor() {
|
||||
return pdsv.getHypervisor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStorageProviderName() {
|
||||
return pdsv.getStorageProviderName();
|
||||
|
||||
@ -23,7 +23,6 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.ws.rs.HEAD;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
@ -177,7 +176,7 @@ public class XcpOssResource extends CitrixResourceBase {
|
||||
@Override
|
||||
public Answer executeRequest(Command cmd) {
|
||||
if (cmd instanceof NetworkUsageCommand) {
|
||||
return execute((NetworkUsageCommand)cmd);
|
||||
return execute((NetworkUsageCommand) cmd);
|
||||
} else {
|
||||
return super.executeRequest(cmd);
|
||||
}
|
||||
|
||||
@ -30,8 +30,6 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.ws.rs.HEAD;
|
||||
|
||||
import org.apache.cloudstack.storage.command.AttachAnswer;
|
||||
import org.apache.cloudstack.storage.command.AttachCommand;
|
||||
import org.apache.cloudstack.storage.command.AttachPrimaryDataStoreAnswer;
|
||||
@ -106,14 +104,14 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
||||
|
||||
String isoURL = null;
|
||||
if (store == null) {
|
||||
TemplateObjectTO iso = (TemplateObjectTO)disk.getData();
|
||||
TemplateObjectTO iso = (TemplateObjectTO) disk.getData();
|
||||
isoURL = iso.getName();
|
||||
} else {
|
||||
if (!(store instanceof NfsTO)) {
|
||||
s_logger.debug("Can't attach a iso which is not created on nfs: ");
|
||||
return new AttachAnswer("Can't attach a iso which is not created on nfs: ");
|
||||
}
|
||||
NfsTO nfsStore = (NfsTO)store;
|
||||
NfsTO nfsStore = (NfsTO) store;
|
||||
isoURL = nfsStore.getUrl() + File.separator + data.getPath();
|
||||
}
|
||||
|
||||
@ -183,8 +181,7 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
||||
VM.Record vmr = vm.getRecord(conn);
|
||||
|
||||
vmNotRunning = vmr.powerState != VmPowerState.RUNNING;
|
||||
}
|
||||
catch (CloudRuntimeException ex) {
|
||||
} catch (CloudRuntimeException ex) {
|
||||
}
|
||||
|
||||
Map<String, String> details = disk.getDetails();
|
||||
@ -206,8 +203,7 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
||||
|
||||
return new AttachAnswer(newDisk);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
vdi = hypervisorResource.mount(conn, null, null, data.getPath());
|
||||
}
|
||||
|
||||
@ -289,14 +285,14 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
||||
|
||||
String isoURL = null;
|
||||
if (store == null) {
|
||||
TemplateObjectTO iso = (TemplateObjectTO)disk.getData();
|
||||
TemplateObjectTO iso = (TemplateObjectTO) disk.getData();
|
||||
isoURL = iso.getName();
|
||||
} else {
|
||||
if (!(store instanceof NfsTO)) {
|
||||
s_logger.debug("Can't attach a iso which is not created on nfs: ");
|
||||
return new AttachAnswer("Can't attach a iso which is not created on nfs: ");
|
||||
}
|
||||
NfsTO nfsStore = (NfsTO)store;
|
||||
NfsTO nfsStore = (NfsTO) store;
|
||||
isoURL = nfsStore.getUrl() + File.separator + data.getPath();
|
||||
}
|
||||
|
||||
@ -364,8 +360,7 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
||||
VM.Record vmr = vm.getRecord(conn);
|
||||
|
||||
vmNotRunning = vmr.powerState != VmPowerState.RUNNING;
|
||||
}
|
||||
catch (CloudRuntimeException ex) {
|
||||
} catch (CloudRuntimeException ex) {
|
||||
}
|
||||
|
||||
// if the VM is not running and we're not dealing with managed storage, just return success (nothing to do here)
|
||||
@ -450,7 +445,7 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
||||
@Override
|
||||
public Answer createSnapshot(CreateObjectCommand cmd) {
|
||||
Connection conn = hypervisorResource.getConnection();
|
||||
SnapshotObjectTO snapshotTO = (SnapshotObjectTO)cmd.getData();
|
||||
SnapshotObjectTO snapshotTO = (SnapshotObjectTO) cmd.getData();
|
||||
long snapshotId = snapshotTO.getId();
|
||||
String snapshotName = snapshotTO.getName();
|
||||
String details = "create snapshot operation Failed for snapshotId: " + snapshotId;
|
||||
@ -478,12 +473,12 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
||||
|
||||
try {
|
||||
String preSnapshotParentUUID = getVhdParent(conn, srUUID, preSnapshotUUID, isISCSI);
|
||||
if( snapshotParentUUID != null && snapshotParentUUID.equals(preSnapshotParentUUID)) {
|
||||
if (snapshotParentUUID != null && snapshotParentUUID.equals(preSnapshotParentUUID)) {
|
||||
// this is empty snapshot, remove it
|
||||
snapshot.destroy(conn);
|
||||
snapshotUUID = preSnapshotUUID;
|
||||
}
|
||||
} catch(Exception e) {
|
||||
} catch (Exception e) {
|
||||
s_logger.debug("Failed to get parent snapshot", e);
|
||||
}
|
||||
}
|
||||
@ -900,8 +895,8 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
||||
|
||||
try {
|
||||
if ((srcDataStoreTo instanceof NfsTO) && (srcDataTo.getObjectType() == DataObjectType.TEMPLATE)) {
|
||||
NfsTO srcImageStore = (NfsTO)srcDataStoreTo;
|
||||
TemplateObjectTO srcTemplateObjectTo = (TemplateObjectTO)srcDataTo;
|
||||
NfsTO srcImageStore = (NfsTO) srcDataStoreTo;
|
||||
TemplateObjectTO srcTemplateObjectTo = (TemplateObjectTO) srcDataTo;
|
||||
String storeUrl = srcImageStore.getUrl();
|
||||
URI uri = new URI(storeUrl);
|
||||
String tmplPath = uri.getHost() + ":" + uri.getPath() + "/" + srcDataTo.getPath();
|
||||
@ -916,7 +911,7 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
||||
String chapInitiatorSecret = null;
|
||||
|
||||
if (destDataStoreTo instanceof PrimaryDataStoreTO) {
|
||||
PrimaryDataStoreTO destPrimaryDataStoreTo = (PrimaryDataStoreTO)destDataStoreTo;
|
||||
PrimaryDataStoreTO destPrimaryDataStoreTo = (PrimaryDataStoreTO) destDataStoreTo;
|
||||
|
||||
Map<String, String> details = destPrimaryDataStoreTo.getDetails();
|
||||
|
||||
@ -948,8 +943,7 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
||||
details.put(DiskTO.CHAP_INITIATOR_SECRET, chapInitiatorSecret);
|
||||
|
||||
sr = hypervisorResource.prepareManagedSr(conn, details);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
String srName = destDataStoreTo.getUuid();
|
||||
Set<SR> srs = SR.getByNameLabel(conn, srName);
|
||||
|
||||
@ -974,8 +968,7 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
||||
uuidToReturn = tmplUuid;
|
||||
|
||||
tmplVdi.setNameLabel(conn, managedStoragePoolRootVolumeName);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
VDI snapshotVdi = tmplVdi.snapshot(conn, new HashMap<String, String>());
|
||||
|
||||
uuidToReturn = snapshotVdi.getUuid(conn);
|
||||
@ -1014,7 +1007,7 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
||||
@Override
|
||||
public Answer createVolume(CreateObjectCommand cmd) {
|
||||
DataTO data = cmd.getData();
|
||||
VolumeObjectTO volume = (VolumeObjectTO)data;
|
||||
VolumeObjectTO volume = (VolumeObjectTO) data;
|
||||
|
||||
try {
|
||||
Connection conn = hypervisorResource.getConnection();
|
||||
@ -1046,7 +1039,7 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
||||
Connection conn = hypervisorResource.getConnection();
|
||||
DataTO srcData = cmd.getSrcTO();
|
||||
DataTO destData = cmd.getDestTO();
|
||||
VolumeObjectTO volume = (VolumeObjectTO)destData;
|
||||
VolumeObjectTO volume = (VolumeObjectTO) destData;
|
||||
VDI vdi = null;
|
||||
try {
|
||||
VDI tmpltvdi = null;
|
||||
@ -1077,12 +1070,12 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
||||
DataTO srcData = cmd.getSrcTO();
|
||||
DataTO destData = cmd.getDestTO();
|
||||
int wait = cmd.getWait();
|
||||
VolumeObjectTO srcVolume = (VolumeObjectTO)srcData;
|
||||
VolumeObjectTO destVolume = (VolumeObjectTO)destData;
|
||||
VolumeObjectTO srcVolume = (VolumeObjectTO) srcData;
|
||||
VolumeObjectTO destVolume = (VolumeObjectTO) destData;
|
||||
DataStoreTO srcStore = srcVolume.getDataStore();
|
||||
|
||||
if (srcStore instanceof NfsTO) {
|
||||
NfsTO nfsStore = (NfsTO)srcStore;
|
||||
NfsTO nfsStore = (NfsTO) srcStore;
|
||||
try {
|
||||
SR primaryStoragePool = hypervisorResource.getStorageRepository(conn, destVolume.getDataStore().getUuid());
|
||||
String srUuid = primaryStoragePool.getUuid(conn);
|
||||
@ -1108,15 +1101,15 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
||||
@Override
|
||||
public Answer copyVolumeFromPrimaryToSecondary(CopyCommand cmd) {
|
||||
Connection conn = hypervisorResource.getConnection();
|
||||
VolumeObjectTO srcVolume = (VolumeObjectTO)cmd.getSrcTO();
|
||||
VolumeObjectTO destVolume = (VolumeObjectTO)cmd.getDestTO();
|
||||
VolumeObjectTO srcVolume = (VolumeObjectTO) cmd.getSrcTO();
|
||||
VolumeObjectTO destVolume = (VolumeObjectTO) cmd.getDestTO();
|
||||
int wait = cmd.getWait();
|
||||
DataStoreTO destStore = destVolume.getDataStore();
|
||||
|
||||
if (destStore instanceof NfsTO) {
|
||||
SR secondaryStorage = null;
|
||||
try {
|
||||
NfsTO nfsStore = (NfsTO)destStore;
|
||||
NfsTO nfsStore = (NfsTO) destStore;
|
||||
URI uri = new URI(nfsStore.getUrl());
|
||||
// Create the volume folder
|
||||
if (!hypervisorResource.createSecondaryStorageFolder(conn, uri.getHost() + ":" + uri.getPath(), destVolume.getPath())) {
|
||||
@ -1329,17 +1322,17 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
||||
NfsTO cacheStore = null;
|
||||
String destPath = null;
|
||||
if (cacheData != null) {
|
||||
cacheStore = (NfsTO)cacheData.getDataStore();
|
||||
cacheStore = (NfsTO) cacheData.getDataStore();
|
||||
secondaryStorageUrl = cacheStore.getUrl();
|
||||
destPath = cacheData.getPath();
|
||||
} else {
|
||||
cacheStore = (NfsTO)destData.getDataStore();
|
||||
cacheStore = (NfsTO) destData.getDataStore();
|
||||
secondaryStorageUrl = cacheStore.getUrl();
|
||||
destPath = destData.getPath();
|
||||
}
|
||||
|
||||
SnapshotObjectTO snapshotTO = (SnapshotObjectTO)srcData;
|
||||
SnapshotObjectTO snapshotOnImage = (SnapshotObjectTO)destData;
|
||||
SnapshotObjectTO snapshotTO = (SnapshotObjectTO) srcData;
|
||||
SnapshotObjectTO snapshotOnImage = (SnapshotObjectTO) destData;
|
||||
String snapshotUuid = snapshotTO.getPath();
|
||||
String volumeUuid = snapshotTO.getVolume().getPath();
|
||||
|
||||
@ -1365,7 +1358,7 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
||||
VDI snapshotVdi = getVDIbyUuid(conn, snapshotUuid);
|
||||
String snapshotPaUuid = null;
|
||||
|
||||
if ( prevSnapshotUuid != null && !fullbackup) {
|
||||
if (prevSnapshotUuid != null && !fullbackup) {
|
||||
try {
|
||||
snapshotPaUuid = getVhdParent(conn, psUuid, snapshotUuid, isISCSI);
|
||||
if (snapshotPaUuid != null) {
|
||||
@ -1410,7 +1403,7 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
||||
if (destStore instanceof SwiftTO) {
|
||||
try {
|
||||
String container = "S-" + snapshotTO.getVolume().getVolumeId().toString();
|
||||
String destSnapshotName = swiftBackupSnapshot(conn, (SwiftTO)destStore, snapshotSr.getUuid(conn), snapshotBackupUuid, container, false, wait);
|
||||
String destSnapshotName = swiftBackupSnapshot(conn, (SwiftTO) destStore, snapshotSr.getUuid(conn), snapshotBackupUuid, container, false, wait);
|
||||
String swiftPath = container + File.separator + destSnapshotName;
|
||||
finalPath = swiftPath;
|
||||
} finally {
|
||||
@ -1423,7 +1416,7 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
||||
|
||||
} else if (destStore instanceof S3TO) {
|
||||
try {
|
||||
finalPath = backupSnapshotToS3(conn, (S3TO)destStore, snapshotSr.getUuid(conn), folder, snapshotBackupUuid, isISCSI, wait);
|
||||
finalPath = backupSnapshotToS3(conn, (S3TO) destStore, snapshotSr.getUuid(conn), folder, snapshotBackupUuid, isISCSI, wait);
|
||||
if (finalPath == null) {
|
||||
throw new CloudRuntimeException("S3 upload of snapshots " + snapshotBackupUuid + " failed");
|
||||
}
|
||||
@ -1449,11 +1442,11 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
||||
if (destStore instanceof SwiftTO) {
|
||||
String container = "S-" + snapshotTO.getVolume().getVolumeId().toString();
|
||||
snapshotBackupUuid =
|
||||
swiftBackupSnapshot(conn, (SwiftTO)destStore, primaryStorageSRUuid, snapshotPaUuid, "S-" + snapshotTO.getVolume().getVolumeId().toString(),
|
||||
swiftBackupSnapshot(conn, (SwiftTO) destStore, primaryStorageSRUuid, snapshotPaUuid, "S-" + snapshotTO.getVolume().getVolumeId().toString(),
|
||||
isISCSI, wait);
|
||||
finalPath = container + File.separator + snapshotBackupUuid;
|
||||
} else if (destStore instanceof S3TO) {
|
||||
finalPath = backupSnapshotToS3(conn, (S3TO)destStore, primaryStorageSRUuid, folder, snapshotPaUuid, isISCSI, wait);
|
||||
finalPath = backupSnapshotToS3(conn, (S3TO) destStore, primaryStorageSRUuid, folder, snapshotPaUuid, isISCSI, wait);
|
||||
if (finalPath == null) {
|
||||
throw new CloudRuntimeException("S3 upload of snapshots " + snapshotPaUuid + " failed");
|
||||
}
|
||||
@ -1503,9 +1496,9 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
||||
@Override
|
||||
public Answer createTemplateFromVolume(CopyCommand cmd) {
|
||||
Connection conn = hypervisorResource.getConnection();
|
||||
VolumeObjectTO volume = (VolumeObjectTO)cmd.getSrcTO();
|
||||
TemplateObjectTO template = (TemplateObjectTO)cmd.getDestTO();
|
||||
NfsTO destStore = (NfsTO)cmd.getDestTO().getDataStore();
|
||||
VolumeObjectTO volume = (VolumeObjectTO) cmd.getSrcTO();
|
||||
TemplateObjectTO template = (TemplateObjectTO) cmd.getDestTO();
|
||||
NfsTO destStore = (NfsTO) cmd.getDestTO().getDataStore();
|
||||
int wait = cmd.getWait();
|
||||
|
||||
String secondaryStoragePoolURL = destStore.getUrl();
|
||||
@ -1586,7 +1579,7 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
||||
public Answer createVolumeFromSnapshot(CopyCommand cmd) {
|
||||
Connection conn = hypervisorResource.getConnection();
|
||||
DataTO srcData = cmd.getSrcTO();
|
||||
SnapshotObjectTO snapshot = (SnapshotObjectTO)srcData;
|
||||
SnapshotObjectTO snapshot = (SnapshotObjectTO) srcData;
|
||||
DataTO destData = cmd.getDestTO();
|
||||
DataStoreTO imageStore = srcData.getDataStore();
|
||||
|
||||
@ -1594,7 +1587,7 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
||||
return new CopyCmdAnswer("unsupported protocol");
|
||||
}
|
||||
|
||||
NfsTO nfsImageStore = (NfsTO)imageStore;
|
||||
NfsTO nfsImageStore = (NfsTO) imageStore;
|
||||
String primaryStorageNameLabel = destData.getDataStore().getUuid();
|
||||
String secondaryStorageUrl = nfsImageStore.getUrl();
|
||||
int wait = cmd.getWait();
|
||||
@ -1650,7 +1643,7 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
||||
|
||||
@Override
|
||||
public Answer deleteSnapshot(DeleteCommand cmd) {
|
||||
SnapshotObjectTO snapshot = (SnapshotObjectTO)cmd.getData();
|
||||
SnapshotObjectTO snapshot = (SnapshotObjectTO) cmd.getData();
|
||||
DataStoreTO store = snapshot.getDataStore();
|
||||
if (store.getRole() == DataStoreRole.Primary) {
|
||||
Connection conn = hypervisorResource.getConnection();
|
||||
|
||||
@ -24,7 +24,6 @@ import java.util.UUID;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.engine.orchestration.service.VolumeOrchestrationService;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.ChapInfo;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult;
|
||||
@ -149,10 +148,13 @@ public class CloudStackPrimaryDataStoreDriverImpl implements PrimaryDataStoreDri
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean connectVolumeToHost(VolumeInfo volumeInfo, Host host, DataStore dataStore) { return false; }
|
||||
public boolean connectVolumeToHost(VolumeInfo volumeInfo, Host host, DataStore dataStore) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnectVolumeFromHost(VolumeInfo volumeInfo, Host host, DataStore dataStore) {}
|
||||
public void disconnectVolumeFromHost(VolumeInfo volumeInfo, Host host, DataStore dataStore) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getVolumeSizeIncludingHypervisorSnapshotReserve(Volume volume, StoragePool pool) {
|
||||
@ -166,7 +168,7 @@ public class CloudStackPrimaryDataStoreDriverImpl implements PrimaryDataStoreDri
|
||||
CreateCmdResult result = new CreateCmdResult(null, null);
|
||||
if (data.getType() == DataObjectType.VOLUME) {
|
||||
try {
|
||||
answer = createVolume((VolumeInfo)data);
|
||||
answer = createVolume((VolumeInfo) data);
|
||||
if ((answer == null) || (!answer.getResult())) {
|
||||
result.setSuccess(false);
|
||||
if (answer != null) {
|
||||
@ -272,10 +274,10 @@ public class CloudStackPrimaryDataStoreDriverImpl implements PrimaryDataStoreDri
|
||||
public void takeSnapshot(SnapshotInfo snapshot, AsyncCompletionCallback<CreateCmdResult> callback) {
|
||||
CreateCmdResult result = null;
|
||||
try {
|
||||
SnapshotObjectTO snapshotTO = (SnapshotObjectTO)snapshot.getTO();
|
||||
SnapshotObjectTO snapshotTO = (SnapshotObjectTO) snapshot.getTO();
|
||||
Object payload = snapshot.getPayload();
|
||||
if (payload != null && payload instanceof CreateSnapshotPayload) {
|
||||
CreateSnapshotPayload snapshotPayload = (CreateSnapshotPayload)payload;
|
||||
CreateSnapshotPayload snapshotPayload = (CreateSnapshotPayload) payload;
|
||||
snapshotTO.setQuiescevm(snapshotPayload.getQuiescevm());
|
||||
}
|
||||
|
||||
@ -283,7 +285,7 @@ public class CloudStackPrimaryDataStoreDriverImpl implements PrimaryDataStoreDri
|
||||
EndPoint ep = this.epSelector.select(snapshot, StorageAction.TAKESNAPSHOT);
|
||||
Answer answer = null;
|
||||
|
||||
if ( ep == null ){
|
||||
if (ep == null) {
|
||||
String errMsg = "No remote endpoint to send createObjectCommand, check if host or ssvm is down?";
|
||||
s_logger.error(errMsg);
|
||||
answer = new Answer(cmd, false, errMsg);
|
||||
@ -312,16 +314,16 @@ public class CloudStackPrimaryDataStoreDriverImpl implements PrimaryDataStoreDri
|
||||
|
||||
@Override
|
||||
public void resize(DataObject data, AsyncCompletionCallback<CreateCmdResult> callback) {
|
||||
VolumeObject vol = (VolumeObject)data;
|
||||
StoragePool pool = (StoragePool)data.getDataStore();
|
||||
ResizeVolumePayload resizeParameter = (ResizeVolumePayload)vol.getpayload();
|
||||
VolumeObject vol = (VolumeObject) data;
|
||||
StoragePool pool = (StoragePool) data.getDataStore();
|
||||
ResizeVolumePayload resizeParameter = (ResizeVolumePayload) vol.getpayload();
|
||||
|
||||
ResizeVolumeCommand resizeCmd =
|
||||
new ResizeVolumeCommand(vol.getPath(), new StorageFilerTO(pool), vol.getSize(), resizeParameter.newSize, resizeParameter.shrinkOk,
|
||||
resizeParameter.instanceName);
|
||||
CreateCmdResult result = new CreateCmdResult(null, null);
|
||||
try {
|
||||
ResizeVolumeAnswer answer = (ResizeVolumeAnswer)storageMgr.sendToPool(pool, resizeParameter.hosts, resizeCmd);
|
||||
ResizeVolumeAnswer answer = (ResizeVolumeAnswer) storageMgr.sendToPool(pool, resizeParameter.hosts, resizeCmd);
|
||||
if (answer != null && answer.getResult()) {
|
||||
long finalSize = answer.getNewSize();
|
||||
s_logger.debug("Resize: volume started at size " + vol.getSize() + " and ended at size " + finalSize);
|
||||
|
||||
@ -26,10 +26,6 @@ import java.util.Set;
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.*;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
|
||||
import org.apache.cloudstack.affinity.AffinityGroupDomainMapVO;
|
||||
import org.apache.cloudstack.affinity.AffinityGroupResponse;
|
||||
@ -92,8 +88,15 @@ import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
import org.apache.cloudstack.api.response.VolumeResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreCapabilities;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateState;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.query.QueryService;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.api.query.dao.AccountJoinDao;
|
||||
import com.cloud.api.query.dao.AffinityGroupJoinDao;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user