mirror of https://github.com/apache/cloudstack.git
bug 14298: fix migrate vm during vm migration
status 14298: resolved fixed
This commit is contained in:
parent
6bbe006138
commit
89fa5f0f67
|
|
@ -2557,7 +2557,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements
|
|||
String path = isoPath.substring(0, index);
|
||||
String name = isoPath.substring(index + 1);
|
||||
KVMStoragePool secondaryPool = _storagePoolMgr
|
||||
.getStoragePoolByURI(path);
|
||||
.getStoragePoolByURI(path, UUID.nameUUIDFromBytes(isoPath.getBytes()).toString());
|
||||
KVMPhysicalDisk isoVol = secondaryPool.getPhysicalDisk(name);
|
||||
return isoVol.getPath();
|
||||
} else {
|
||||
|
|
@ -2806,7 +2806,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements
|
|||
String path = isoPath.substring(0, index);
|
||||
String name = isoPath.substring(index + 1);
|
||||
KVMStoragePool secondaryPool = _storagePoolMgr
|
||||
.getStoragePoolByURI(path);
|
||||
.getStoragePoolByURI(path, UUID.nameUUIDFromBytes(isoPath.getBytes()).toString());
|
||||
KVMPhysicalDisk isoVol = secondaryPool.getPhysicalDisk(name);
|
||||
isoPath = isoVol.getPath();
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,10 @@ public class KVMStoragePoolManager {
|
|||
public KVMStoragePool getStoragePoolByURI(String uri) {
|
||||
return this._storageAdaptor.getStoragePoolByUri(uri);
|
||||
}
|
||||
|
||||
public KVMStoragePool getStoragePoolByURI(String uri, String uuid) {
|
||||
return this._storageAdaptor.getStoragePoolByUri(uri, uuid);
|
||||
}
|
||||
|
||||
public KVMStoragePool createStoragePool(String name, String host,
|
||||
String path, StoragePoolType type) {
|
||||
|
|
|
|||
|
|
@ -656,27 +656,7 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
|
|||
|
||||
@Override
|
||||
public KVMStoragePool getStoragePoolByUri(String uri) {
|
||||
URI storageUri = null;
|
||||
|
||||
try {
|
||||
storageUri = new URI(uri);
|
||||
} catch (URISyntaxException e) {
|
||||
throw new CloudRuntimeException(e.toString());
|
||||
}
|
||||
|
||||
String sourcePath = null;
|
||||
String uuid = null;
|
||||
String sourceHost = "";
|
||||
StoragePoolType protocal = null;
|
||||
if (storageUri.getScheme().equalsIgnoreCase("nfs")) {
|
||||
sourcePath = storageUri.getPath();
|
||||
sourcePath = sourcePath.replace("//", "/");
|
||||
sourceHost = storageUri.getHost();
|
||||
uuid = UUID.randomUUID().toString();
|
||||
protocal = StoragePoolType.NetworkFilesystem;
|
||||
}
|
||||
|
||||
return createStoragePool(uuid, sourceHost, sourcePath, protocal);
|
||||
return this.getStoragePoolByUri(uri, UUID.randomUUID().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -718,4 +698,27 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KVMStoragePool getStoragePoolByUri(String uri, String name) {
|
||||
URI storageUri = null;
|
||||
|
||||
try {
|
||||
storageUri = new URI(uri);
|
||||
} catch (URISyntaxException e) {
|
||||
throw new CloudRuntimeException(e.toString());
|
||||
}
|
||||
|
||||
String sourcePath = null;
|
||||
String sourceHost = "";
|
||||
StoragePoolType protocal = null;
|
||||
if (storageUri.getScheme().equalsIgnoreCase("nfs")) {
|
||||
sourcePath = storageUri.getPath();
|
||||
sourcePath = sourcePath.replace("//", "/");
|
||||
sourceHost = storageUri.getHost();
|
||||
protocal = StoragePoolType.NetworkFilesystem;
|
||||
}
|
||||
|
||||
return createStoragePool(name, sourceHost, sourcePath, protocal);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ public interface StorageAdaptor {
|
|||
String snapshotName, String name, KVMStoragePool destPool);
|
||||
|
||||
public KVMStoragePool getStoragePoolByUri(String uri);
|
||||
public KVMStoragePool getStoragePoolByUri(String uri, String name);
|
||||
|
||||
public KVMPhysicalDisk getPhysicalDiskFromURI(String uri);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue