CA-225015: XenCenter Allows VM migration to MemorySR

- We shouldn't include the hidden SRs in the list of available SRs in the Migration wizard
- Updated the SR.SupportsVdiCreate function to return false for the Memory SR; this fixes other places where the Memory SR might be visible (e.g. all places where SrPicker is used)
- Also fixed the same issue in the  Attach disk dialog

Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
This commit is contained in:
Mihaela Stoica 2016-10-12 15:47:24 +01:00
parent a8c7aba673
commit 47665f5323
3 changed files with 10 additions and 2 deletions

View File

@ -302,7 +302,11 @@ namespace XenAdmin.Dialogs
Host affinity = TheVM.Connection.Resolve<Host>(TheVM.affinity);
Host activeHost = TheVM.Connection.Resolve<Host>(TheVM.resident_on);
if (TheSR.content_type != SR.Content_Type_ISO && !((affinity != null && !TheSR.CanBeSeenFrom(affinity)) || (activeHost != null && TheVM.power_state == vm_power_state.Running && !TheSR.CanBeSeenFrom(activeHost)) || TheSR.IsBroken(false) || TheSR.PBDs.Count < 1))
if (!TheSR.Show(Properties.Settings.Default.ShowHiddenVMs))
{
Show = false;
}
else if (TheSR.content_type != SR.Content_Type_ISO && !((affinity != null && !TheSR.CanBeSeenFrom(affinity)) || (activeHost != null && TheVM.power_state == vm_power_state.Running && !TheSR.CanBeSeenFrom(activeHost)) || TheSR.IsBroken(false) || TheSR.PBDs.Count < 1))
{
Description = "";
Enabled = true;

View File

@ -429,7 +429,7 @@ namespace XenAdmin.Wizards.GenericPages
continue;
var sr = TargetConnection.Resolve(pbd.SR);
if (sr == null || sr.IsDetached)
if (sr == null || sr.IsDetached || !sr.Show(XenAdminConfigManager.Provider.ShowHiddenVMs))
continue;
if ((sr.content_type.ToLower() == "iso" || sr.type.ToLower() == "iso") && !resource.SRTypeInvalid)

View File

@ -513,6 +513,10 @@ namespace XenAPI
if (content_type == SR.Content_Type_ISO)
return false;
// Memory SRs should not support VDI create in the GUI
if (GetSRType(false) == SR.SRTypes.tmpfs)
return false;
Host master = Helpers.GetMaster(Connection);
if (master == null)
return false;