CA-300760: Allow intra-pool move of halted VMs through the wizard, even if the storage migration is not allowed

Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
This commit is contained in:
Mihaela Stoica 2018-11-22 11:28:24 +00:00 committed by Konstantina Chremmou
parent 88ec36ae5f
commit 8ab3ea2837
2 changed files with 22 additions and 12 deletions

View File

@ -57,9 +57,16 @@ namespace XenAdmin.Wizards.CrossPoolMigrateWizard
return true;
}
protected override bool SrIsSuitable(SR sr)
protected override bool SrsAreSuitable(SR sourceSr, SR targetSr)
{
return sr != null && !sr.HBALunPerVDI() && sr.SupportsStorageMigration();
if (sourceSr == null || targetSr == null || sourceSr.HBALunPerVDI() || targetSr.HBALunPerVDI())
return false;
// intra-pool move of halted VMs does not require the SRs to support migration because we use VMMoveAction (vdi copy & destroy)
if (wizardMode == WizardMode.Move && sourceSr.Connection == targetSr.Connection)
return true;
return sourceSr.SupportsStorageMigration() && targetSr.SupportsStorageMigration();
}
protected override bool IsExtraSpaceNeeded(SR sourceSr, SR targetSr)

View File

@ -190,7 +190,7 @@ namespace XenAdmin.Wizards.GenericPages
set { targetConnection = value; }
}
protected virtual bool SrIsSuitable(SR sr)
protected virtual bool SrsAreSuitable(SR sourceSr, SR targetSr)
{
return true;
}
@ -298,10 +298,15 @@ namespace XenAdmin.Wizards.GenericPages
if (IsExtraSpaceNeeded(resourceData.SR, toStringWrapper.item))
{
requiredSpace += resourceData.RequiredDiskCapacity;
if (!SrIsSuitable(resourceData.SR) || !SrIsSuitable(toStringWrapper.item))
isSuitableForAll=false;
if (!SrsAreSuitable(resourceData.SR, toStringWrapper.item))
{
isSuitableForAll = false;
break;
}
}
}
if (!isSuitableForAll)
break;
}
if (isSuitableForAll)
listToAdd.Add(new EnableableSrComboboxItem(toStringWrapper, requiredSpace));
@ -452,8 +457,6 @@ namespace XenAdmin.Wizards.GenericPages
{
var cb = new DataGridViewComboBoxCell { FlatStyle = FlatStyle.Flat };
var sourceSrIsSuitable = SrIsSuitable(resource.SR);
foreach (var pbd in TargetConnection.Cache.PBDs)
{
if (pbd.SR == null)
@ -470,7 +473,7 @@ namespace XenAdmin.Wizards.GenericPages
bool srOnHost = pbd.host != null && pbd.host.Equals(xenRef);
if ((sr.shared || srOnHost) && (!IsExtraSpaceNeeded(resource.SR, sr) || (ulong)sr.FreeSpace() > resource.RequiredDiskCapacity && sourceSrIsSuitable && SrIsSuitable(sr)))
if ((sr.shared || srOnHost) && (!IsExtraSpaceNeeded(resource.SR, sr) || (ulong)sr.FreeSpace() > resource.RequiredDiskCapacity && SrsAreSuitable(resource.SR, sr)))
{
var count = (from ToStringWrapper<SR> existingItem in cb.Items
where existingItem.item.opaque_ref == sr.opaque_ref