mirror of https://github.com/apache/cloudstack.git
Merge remote-tracking branch 'origin/4.14' into 4.15
This commit is contained in:
commit
6c3f4b43aa
|
|
@ -16,6 +16,7 @@
|
|||
// under the License.
|
||||
package com.cloud.hypervisor.xenserver.resource;
|
||||
|
||||
import com.cloud.storage.Storage;
|
||||
import com.xensource.xenapi.Host;
|
||||
|
||||
/**
|
||||
|
|
@ -44,4 +45,14 @@ public class CitrixHelper {
|
|||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static String getSRNameLabel(final String poolUuid,
|
||||
final Storage.StoragePoolType poolType,
|
||||
final String poolPath) {
|
||||
if (Storage.StoragePoolType.PreSetup.equals(poolType) &&
|
||||
!poolPath.contains(poolUuid)) {
|
||||
return poolPath.replaceFirst("/", "");
|
||||
}
|
||||
return poolUuid;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -798,7 +798,9 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
|||
|
||||
try {
|
||||
final Connection conn = hypervisorResource.getConnection();
|
||||
final SR poolSr = hypervisorResource.getStorageRepository(conn, data.getDataStore().getUuid());
|
||||
final PrimaryDataStoreTO primaryStore = (PrimaryDataStoreTO)data.getDataStore();
|
||||
final SR poolSr = hypervisorResource.getStorageRepository(conn,
|
||||
CitrixHelper.getSRNameLabel(primaryStore.getUuid(), primaryStore.getPoolType(), primaryStore.getPath()));
|
||||
VDI.Record vdir = new VDI.Record();
|
||||
vdir.nameLabel = volume.getName();
|
||||
vdir.SR = poolSr;
|
||||
|
|
@ -871,7 +873,9 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
|||
if (srcStore instanceof NfsTO) {
|
||||
final NfsTO nfsStore = (NfsTO) srcStore;
|
||||
try {
|
||||
final SR primaryStoragePool = hypervisorResource.getStorageRepository(conn, destVolume.getDataStore().getUuid());
|
||||
final PrimaryDataStoreTO destStore = (PrimaryDataStoreTO)destVolume.getDataStore();
|
||||
final SR primaryStoragePool = hypervisorResource.getStorageRepository(conn,
|
||||
CitrixHelper.getSRNameLabel(destStore.getUuid(), destStore.getPoolType(), destStore.getPath()));
|
||||
final String srUuid = primaryStoragePool.getUuid(conn);
|
||||
final URI uri = new URI(nfsStore.getUrl());
|
||||
final String volumePath = uri.getHost() + ":" + uri.getPath() + nfsStore.getPathSeparator() + srcVolume.getPath();
|
||||
|
|
@ -1153,7 +1157,9 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
|||
final DataTO cacheData = cmd.getCacheTO();
|
||||
final DataTO destData = cmd.getDestTO();
|
||||
final int wait = cmd.getWait();
|
||||
final String primaryStorageNameLabel = srcData.getDataStore().getUuid();
|
||||
final PrimaryDataStoreTO primaryStore = (PrimaryDataStoreTO)srcData.getDataStore();
|
||||
final String primaryStorageNameLabel = CitrixHelper.getSRNameLabel(primaryStore.getUuid(),
|
||||
primaryStore.getPoolType(), primaryStore.getPath());
|
||||
String secondaryStorageUrl = null;
|
||||
NfsTO cacheStore = null;
|
||||
String destPath = null;
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor {
|
|||
|
||||
destSr = hypervisorResource.prepareManagedSr(conn, details);
|
||||
} else {
|
||||
final String srName = destStore.getUuid();
|
||||
final String srName = CitrixHelper.getSRNameLabel(destStore.getUuid(), destStore.getPoolType(), destStore.getPath());
|
||||
final Set<SR> srs = SR.getByNameLabel(conn, srName);
|
||||
|
||||
if (srs.size() != 1) {
|
||||
|
|
@ -494,7 +494,8 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor {
|
|||
final DataTO destData = cmd.getDestTO();
|
||||
final int wait = cmd.getWait();
|
||||
final PrimaryDataStoreTO primaryStore = (PrimaryDataStoreTO)srcData.getDataStore();
|
||||
final String primaryStorageNameLabel = primaryStore.getUuid();
|
||||
final String primaryStorageNameLabel = CitrixHelper.getSRNameLabel(primaryStore.getUuid(),
|
||||
primaryStore.getPoolType(), primaryStore.getPath());
|
||||
String secondaryStorageUrl = null;
|
||||
NfsTO cacheStore = null;
|
||||
String destPath = null;
|
||||
|
|
@ -1001,7 +1002,8 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor {
|
|||
final SR srcSr = createFileSr(conn, uri.getHost() + ":" + uri.getPath(), volumeDirectory);
|
||||
Task task = null;
|
||||
try {
|
||||
final SR primaryStoragePool = hypervisorResource.getStorageRepository(conn, primaryStore.getUuid());
|
||||
final SR primaryStoragePool = hypervisorResource.getStorageRepository(conn,
|
||||
CitrixHelper.getSRNameLabel(primaryStore.getUuid(), primaryStore.getPoolType(), primaryStore.getPath()));
|
||||
final VDI srcVdi = VDI.getByUuid(conn, volumeUuid);
|
||||
task = srcVdi.copyAsync(conn, primaryStoragePool, null, null);
|
||||
// poll every 1 seconds ,
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import com.cloud.agent.api.storage.MigrateVolumeAnswer;
|
|||
import com.cloud.agent.api.storage.MigrateVolumeCommand;
|
||||
import com.cloud.agent.api.to.DiskTO;
|
||||
import com.cloud.agent.api.to.StorageFilerTO;
|
||||
import com.cloud.hypervisor.xenserver.resource.CitrixHelper;
|
||||
import com.cloud.hypervisor.xenserver.resource.XenServer610Resource;
|
||||
import com.cloud.resource.CommandWrapper;
|
||||
import com.cloud.resource.ResourceWrapper;
|
||||
|
|
@ -62,10 +63,8 @@ public final class XenServer610MigrateVolumeCommandWrapper extends CommandWrappe
|
|||
chapInitiatorUsername, chapInitiatorSecret, false);
|
||||
}
|
||||
else {
|
||||
StorageFilerTO destPoolTO = command.getPool();
|
||||
String destPoolUuid = destPoolTO.getUuid();
|
||||
|
||||
destPool = xenServer610Resource.getStorageRepository(connection, destPoolUuid);
|
||||
final StorageFilerTO pool = command.getPool();
|
||||
destPool = xenServer610Resource.getStorageRepository(connection, CitrixHelper.getSRNameLabel(pool.getUuid(), pool.getType(), pool.getPath()));
|
||||
}
|
||||
|
||||
Map<String, String> other = new HashMap<>();
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.cloud.utils.Pair;
|
||||
import org.apache.cloudstack.storage.to.VolumeObjectTO;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
|
@ -35,12 +34,14 @@ import com.cloud.agent.api.to.NicTO;
|
|||
import com.cloud.agent.api.to.StorageFilerTO;
|
||||
import com.cloud.agent.api.to.VirtualMachineTO;
|
||||
import com.cloud.agent.api.to.VolumeTO;
|
||||
import com.cloud.hypervisor.xenserver.resource.CitrixHelper;
|
||||
import com.cloud.hypervisor.xenserver.resource.XenServer610Resource;
|
||||
import com.cloud.hypervisor.xenserver.resource.XsHost;
|
||||
import com.cloud.hypervisor.xenserver.resource.XsLocalNetwork;
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
import com.cloud.resource.CommandWrapper;
|
||||
import com.cloud.resource.ResourceWrapper;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.xensource.xenapi.Connection;
|
||||
import com.xensource.xenapi.Host;
|
||||
|
|
@ -88,7 +89,9 @@ public final class XenServer610MigrateWithStorageCommandWrapper extends CommandW
|
|||
for (final Pair<VolumeTO, StorageFilerTO> entry : volumeToFiler) {
|
||||
final StorageFilerTO storageFiler = entry.second();
|
||||
final VolumeTO volume = entry.first();
|
||||
vdiMap.put(xenServer610Resource.getVDIbyUuid(connection, volume.getPath()), xenServer610Resource.getStorageRepository(connection, storageFiler.getUuid()));
|
||||
vdiMap.put(xenServer610Resource.getVDIbyUuid(connection, volume.getPath()),
|
||||
xenServer610Resource.getStorageRepository(connection,
|
||||
CitrixHelper.getSRNameLabel(storageFiler.getUuid(), storageFiler.getType(), storageFiler.getPath())));
|
||||
}
|
||||
|
||||
// Get the vm to migrate.
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import com.cloud.agent.api.storage.CreateAnswer;
|
|||
import com.cloud.agent.api.storage.CreateCommand;
|
||||
import com.cloud.agent.api.to.StorageFilerTO;
|
||||
import com.cloud.agent.api.to.VolumeTO;
|
||||
import com.cloud.hypervisor.xenserver.resource.CitrixHelper;
|
||||
import com.cloud.hypervisor.xenserver.resource.CitrixResourceBase;
|
||||
import com.cloud.resource.CommandWrapper;
|
||||
import com.cloud.resource.ResourceWrapper;
|
||||
|
|
@ -50,7 +51,8 @@ public final class CitrixCreateCommandWrapper extends CommandWrapper<CreateComma
|
|||
|
||||
VDI vdi = null;
|
||||
try {
|
||||
final SR poolSr = citrixResourceBase.getStorageRepository(conn, pool.getUuid());
|
||||
final SR poolSr = citrixResourceBase.getStorageRepository(conn,
|
||||
CitrixHelper.getSRNameLabel(pool.getUuid(), pool.getType(), pool.getPath()));
|
||||
if (command.getTemplateUrl() != null) {
|
||||
VDI tmpltvdi = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import org.apache.log4j.Logger;
|
|||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.DeleteStoragePoolCommand;
|
||||
import com.cloud.agent.api.to.StorageFilerTO;
|
||||
import com.cloud.hypervisor.xenserver.resource.CitrixHelper;
|
||||
import com.cloud.hypervisor.xenserver.resource.CitrixResourceBase;
|
||||
import com.cloud.resource.CommandWrapper;
|
||||
import com.cloud.resource.ResourceWrapper;
|
||||
|
|
@ -46,16 +47,16 @@ public final class CitrixDeleteStoragePoolCommandWrapper extends CommandWrapper<
|
|||
|
||||
// getRemoveDatastore being true indicates we are using managed storage and need to pull the SR name out of a Map
|
||||
// instead of pulling it out using getUuid of the StorageFilerTO instance.
|
||||
|
||||
String srNameLabel;
|
||||
if (command.getRemoveDatastore()) {
|
||||
Map<String, String> details = command.getDetails();
|
||||
|
||||
String srNameLabel = details.get(DeleteStoragePoolCommand.DATASTORE_NAME);
|
||||
|
||||
sr = citrixResourceBase.getStorageRepository(conn, srNameLabel);
|
||||
srNameLabel = details.get(DeleteStoragePoolCommand.DATASTORE_NAME);
|
||||
}
|
||||
else {
|
||||
sr = citrixResourceBase.getStorageRepository(conn, poolTO.getUuid());
|
||||
srNameLabel = CitrixHelper.getSRNameLabel(poolTO.getUuid(), poolTO.getType(), poolTO.getPath());
|
||||
}
|
||||
sr = citrixResourceBase.getStorageRepository(conn, srNameLabel);
|
||||
|
||||
citrixResourceBase.removeSR(conn, sr);
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import com.cloud.agent.api.Answer;
|
|||
import com.cloud.agent.api.ModifyStoragePoolAnswer;
|
||||
import com.cloud.agent.api.ModifyStoragePoolCommand;
|
||||
import com.cloud.agent.api.to.StorageFilerTO;
|
||||
import com.cloud.hypervisor.xenserver.resource.CitrixHelper;
|
||||
import com.cloud.hypervisor.xenserver.resource.CitrixResourceBase;
|
||||
import com.cloud.resource.CommandWrapper;
|
||||
import com.cloud.resource.ResourceWrapper;
|
||||
|
|
@ -49,7 +50,10 @@ public final class CitrixModifyStoragePoolCommandWrapper extends CommandWrapper<
|
|||
final boolean add = command.getAdd();
|
||||
if (add) {
|
||||
try {
|
||||
final String srName = command.getStoragePath() != null ? command.getStoragePath() : pool.getUuid();
|
||||
String srName = command.getStoragePath();
|
||||
if (srName == null) {
|
||||
srName = CitrixHelper.getSRNameLabel(pool.getUuid(), pool.getType(), pool.getPath());
|
||||
}
|
||||
final SR sr = citrixResourceBase.getStorageRepository(conn, srName);
|
||||
citrixResourceBase.setupHeartbeatSr(conn, sr, false);
|
||||
final long capacity = sr.getPhysicalSize(conn);
|
||||
|
|
@ -75,7 +79,8 @@ public final class CitrixModifyStoragePoolCommandWrapper extends CommandWrapper<
|
|||
}
|
||||
} else {
|
||||
try {
|
||||
final SR sr = citrixResourceBase.getStorageRepository(conn, pool.getUuid());
|
||||
final SR sr = citrixResourceBase.getStorageRepository(conn,
|
||||
CitrixHelper.getSRNameLabel(pool.getUuid(), pool.getType(), pool.getPath()));
|
||||
final String srUuid = sr.getUuid(conn);
|
||||
final String result = citrixResourceBase.callHostPluginPremium(conn, "setup_heartbeat_file", "host", citrixResourceBase.getHost().getUuid(), "sr", srUuid, "add",
|
||||
"false");
|
||||
|
|
|
|||
|
|
@ -58,17 +58,18 @@ import com.cloud.exception.AgentUnavailableException;
|
|||
import com.cloud.exception.OperationTimedoutException;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.storage.dao.SnapshotDao;
|
||||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.hypervisor.xenserver.resource.CitrixHelper;
|
||||
import com.cloud.storage.Snapshot;
|
||||
import com.cloud.storage.SnapshotVO;
|
||||
import com.cloud.storage.VolumeVO;
|
||||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.storage.VolumeDetailVO;
|
||||
import com.cloud.storage.VolumeVO;
|
||||
import com.cloud.storage.dao.SnapshotDao;
|
||||
import com.cloud.storage.dao.VolumeDao;
|
||||
import com.cloud.storage.dao.VolumeDetailsDao;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.StringUtils;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.vm.VMInstanceVO;
|
||||
import com.cloud.vm.dao.VMInstanceDao;
|
||||
|
||||
|
|
@ -326,7 +327,9 @@ public class XenServerStorageMotionStrategy implements DataMotionStrategy {
|
|||
volumeToStorageUuid.add(new Pair<>(volumeTo, iqn));
|
||||
}
|
||||
else {
|
||||
volumeToStorageUuid.add(new Pair<>(volumeTo, ((StoragePool)entry.getValue()).getUuid()));
|
||||
StoragePool pool = (StoragePool)entry.getValue();
|
||||
String srNameLabel = CitrixHelper.getSRNameLabel(pool.getUuid(), pool.getPoolType(), pool.getPath());
|
||||
volumeToStorageUuid.add(new Pair<>(volumeTo, srNameLabel));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue