/// <summary> /// Whether the underlying SR backend supports SR_TRIM /// </summary> public bool SupportsTrim() { System.Diagnostics.Trace.Assert(Connection != null, "Connection must not be null"); SM sm = SM.GetByType(Connection, type); return(sm != null && sm.features != null && sm.features.ContainsKey("SR_TRIM")); }
/// <summary> /// Whether the underlying SR backend supports storage migration. Will return true even if the SR is full. /// </summary> /// <returns></returns> public virtual bool SupportsStorageMigration() { // ISO and Memory SRs should not support migration if (content_type == SR.Content_Type_ISO || GetSRType(false) == SR.SRTypes.tmpfs) { return(false); } SM sm = SM.GetByType(Connection, type); return(sm != null && Array.IndexOf(sm.capabilities, "VDI_MIRROR") != -1 && Array.IndexOf(sm.capabilities, "VDI_SNAPSHOT") != -1); }
/// <summary> /// Whether the underlying SR backend supports storage migration. Will return true even if the SR is full. /// </summary> /// <returns></returns> public virtual bool SupportsStorageMigration() { // ISO and Memory SRs should not support migration if (content_type == SR.Content_Type_ISO || GetSRType(false) == SR.SRTypes.tmpfs) { return(false); } SM sm = SM.GetByType(Connection, type); // check if the SM has VDI_SNAPSHOT and VDI_MIRROR capabilities; the VDI_MIRROR capability has only been added in Ely (API Version 2.6) return(sm != null && Array.IndexOf(sm.capabilities, "VDI_SNAPSHOT") != -1 && (Array.IndexOf(sm.capabilities, "VDI_MIRROR") != -1 || !Helpers.ElyOrGreater(Connection))); }
/// <summary> /// Whether the underlying SR backend supports read caching. /// </summary> /// <returns></returns> public bool SupportsReadCaching() { // for Stockholm or greater versions, check if the SM has the VDI_READ_CACHING capability if (Helpers.StockholmOrGreater(Connection)) { var sm = SM.GetByType(Connection, type); return(sm?.features != null && sm.features.ContainsKey("VDI_READ_CACHING")); } // for older versions, use the SR type; read caching is available for NFS, EXT3 and SMB/CIFS SR types var srType = GetSRType(false); return(srType == SRTypes.nfs || srType == SRTypes.ext || srType == SRTypes.smb); }
public string FriendlyTypeName() { var srType = GetSRType(false); if (srType == SRTypes.unknown) { var sm = SM.GetByType(Connection, type); if (sm != null && Version.TryParse(sm.required_api_version, out var smapiVersion) && smapiVersion.CompareTo(new Version(3, 0)) >= 0) { return(!string.IsNullOrEmpty(sm.name_label) ? sm.name_label : type); } } return(GetFriendlyTypeName(srType)); }
/// <summary> /// Whether the underlying SR backend supports VDI_CREATE. Will return true even if the SR is full. /// </summary> public virtual bool SupportsVdiCreate() { // ISO SRs are deemed not to support VDI create in the GUI, even though the back end // knows that they do. See CA-40119. 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); } SM sm = SM.GetByType(Connection, type); return(sm != null && -1 != Array.IndexOf(sm.capabilities, "VDI_CREATE")); }
/// <summary> /// Whether the underlying SR backend supports VDI_CREATE. Will return true even if the SR is full. /// </summary> /// <param name="connection"></param> /// <returns></returns> public virtual bool SupportsVdiCreate() { // ISO SRs are deemed not to support VDI create in the GUI, even though the back end // knows that they do. See CA-40119. if (content_type == SR.Content_Type_ISO) { return(false); } Host master = Helpers.GetMaster(Connection); if (master == null) { return(false); } SM sm = SM.GetByType(Connection, type); return(sm != null && -1 != Array.IndexOf(sm.capabilities, "VDI_CREATE")); }
public SM GetSM() { return(SM.GetByType(Connection, GetSRType(true).ToString())); }