/// <summary> /// Creates a new virtual disk at the specified path. /// </summary> /// <param name="fileLocator">The object used to locate / create the component files.</param> /// <param name="path">The name of the VMDK to create.</param> /// <param name="parameters">The desired parameters for the new disk.</param> /// <returns>The newly created disk image</returns> internal static DiskImageFile Initialize(FileLocator fileLocator, string path, DiskParameters parameters) { if (parameters.Capacity <= 0) { throw new ArgumentException("Capacity must be greater than zero", "parameters"); } Geometry geometry = parameters.Geometry ?? DefaultGeometry(parameters.Capacity); Geometry biosGeometry; if (parameters.BiosGeometry != null) { biosGeometry = parameters.BiosGeometry; } else { biosGeometry = Geometry.MakeBiosSafe(geometry, parameters.Capacity); } DiskAdapterType adapterType = (parameters.AdapterType == DiskAdapterType.None) ? DiskAdapterType.LsiLogicScsi : parameters.AdapterType; DiskCreateType createType = (parameters.CreateType == DiskCreateType.None) ? DiskCreateType.MonolithicSparse : parameters.CreateType; DescriptorFile baseDescriptor = CreateSimpleDiskDescriptor(geometry, biosGeometry, createType, adapterType); return(DoInitialize(fileLocator, path, parameters.Capacity, createType, baseDescriptor)); }
/// <summary> /// Creates a new virtual disk at the specified path. /// </summary> /// <param name="fileSystem">The file system to create the VMDK on.</param> /// <param name="path">The name of the VMDK to create.</param> /// <param name="capacity">The desired capacity of the new disk.</param> /// <param name="createType">The type of virtual disk to create.</param> /// <param name="adapterType">The type of disk adapter used with the disk.</param> /// <returns>The newly created disk image.</returns> public static DiskImageFile Initialize(DiscFileSystem fileSystem, string path, long capacity, DiskCreateType createType, DiskAdapterType adapterType) { DiskParameters diskParams = new DiskParameters(); diskParams.Capacity = capacity; diskParams.CreateType = createType; diskParams.AdapterType = adapterType; return(Initialize(fileSystem, path, diskParams)); }
/// <summary> /// Creates a new virtual disk at the specified path. /// </summary> /// <param name="path">The name of the VMDK to create.</param> /// <param name="capacity">The desired capacity of the new disk.</param> /// <param name="geometry">The desired geometry of the new disk, or <c>null</c> for default.</param> /// <param name="createType">The type of virtual disk to create.</param> /// <param name="adapterType">The type of disk adapter used with the disk.</param> /// <returns>The newly created disk image.</returns> public static DiskImageFile Initialize(string path, long capacity, Geometry geometry, DiskCreateType createType, DiskAdapterType adapterType) { DiskParameters diskParams = new DiskParameters(); diskParams.Capacity = capacity; diskParams.Geometry = geometry; diskParams.CreateType = createType; diskParams.AdapterType = adapterType; return(Initialize(path, diskParams)); }
private static string FormatAdapterType(DiskAdapterType value) { switch (value) { case DiskAdapterType.Ide: return("ide"); case DiskAdapterType.BusLogicScsi: return("buslogic"); case DiskAdapterType.LsiLogicScsi: return("lsilogic"); case DiskAdapterType.LegacyEsx: return("legacyESX"); default: throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Unknown type: {0}", value), "value"); } }
/// <summary> /// Creates a new virtual disk at the specified path. /// </summary> /// <param name="path">The name of the VMDK to create.</param> /// <param name="capacity">The desired capacity of the new disk</param> /// <param name="type">The type of virtual disk to create</param> /// <param name="adapterType">The type of virtual disk adapter</param> /// <returns>The newly created disk image</returns> public static Disk Initialize(string path, long capacity, DiskCreateType type, DiskAdapterType adapterType) { return(Initialize(path, capacity, null, type, adapterType)); }
internal static DescriptorFile CreateSimpleDiskDescriptor(Geometry geometry, Geometry biosGeometery, DiskCreateType createType, DiskAdapterType adapterType) { DescriptorFile baseDescriptor = new DescriptorFile(); baseDescriptor.DiskGeometry = geometry; baseDescriptor.BiosGeometry = biosGeometery; baseDescriptor.ContentId = (uint)_rng.Next(); baseDescriptor.CreateType = createType; baseDescriptor.UniqueId = Guid.NewGuid(); baseDescriptor.HardwareVersion = "4"; baseDescriptor.AdapterType = adapterType; return baseDescriptor; }
/// <summary> /// Creates a new virtual disk at the specified path. /// </summary> /// <param name="fileSystem">The file system to create the VMDK on</param> /// <param name="path">The name of the VMDK to create.</param> /// <param name="capacity">The desired capacity of the new disk</param> /// <param name="createType">The type of virtual disk to create</param> /// <param name="adapterType">The type of disk adapter used with the disk</param> /// <returns>The newly created disk image</returns> public static DiskImageFile Initialize(DiscFileSystem fileSystem, string path, long capacity, DiskCreateType createType, DiskAdapterType adapterType) { DiskParameters diskParams = new DiskParameters(); diskParams.Capacity = capacity; diskParams.CreateType = createType; diskParams.AdapterType = adapterType; return Initialize(fileSystem, path, diskParams); }
/// <summary> /// Creates a new virtual disk at the specified path. /// </summary> /// <param name="path">The name of the VMDK to create.</param> /// <param name="capacity">The desired capacity of the new disk</param> /// <param name="geometry">The desired geometry of the new disk, or <c>null</c> for default</param> /// <param name="createType">The type of virtual disk to create</param> /// <param name="adapterType">The type of disk adapter used with the disk</param> /// <returns>The newly created disk image</returns> public static DiskImageFile Initialize(string path, long capacity, Geometry geometry, DiskCreateType createType, DiskAdapterType adapterType) { DiskParameters diskParams = new DiskParameters(); diskParams.Capacity = capacity; diskParams.Geometry = geometry; diskParams.CreateType = createType; diskParams.AdapterType = adapterType; return Initialize(path, diskParams); }
private static string FormatAdapterType(DiskAdapterType value) { switch (value) { case DiskAdapterType.Ide: return "ide"; case DiskAdapterType.BusLogicScsi: return "buslogic"; case DiskAdapterType.LsiLogicScsi: return "lsilogic"; case DiskAdapterType.LegacyEsx: return "legacyESX"; default: throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Unknown type: {0}", value), "value"); } }
internal static DescriptorFile CreateSimpleDiskDescriptor(Geometry geometry, Geometry biosGeometery, DiskCreateType createType, DiskAdapterType adapterType) { DescriptorFile baseDescriptor = new DescriptorFile(); baseDescriptor.DiskGeometry = geometry; baseDescriptor.BiosGeometry = biosGeometery; baseDescriptor.ContentId = (uint)_rng.Next(); baseDescriptor.CreateType = createType; baseDescriptor.UniqueId = Guid.NewGuid(); baseDescriptor.HardwareVersion = "4"; baseDescriptor.AdapterType = adapterType; return(baseDescriptor); }
/// <summary> /// Creates a new virtual disk at the specified location on a file system. /// </summary> /// <param name="fileSystem">The file system to contain the disk</param> /// <param name="path">The file system path to the disk</param> /// <param name="capacity">The desired capacity of the new disk</param> /// <param name="type">The type of virtual disk to create</param> /// <param name="adapterType">The type of virtual disk adapter</param> /// <returns>The newly created disk image</returns> public static Disk Initialize(DiscFileSystem fileSystem, string path, long capacity, DiskCreateType type, DiskAdapterType adapterType) { return new Disk(DiskImageFile.Initialize(fileSystem, path, capacity, type, adapterType), Ownership.Dispose); }
/// <summary> /// Creates a new virtual disk at the specified path. /// </summary> /// <param name="path">The name of the VMDK to create.</param> /// <param name="capacity">The desired capacity of the new disk</param> /// <param name="geometry">The desired geometry of the new disk, or <c>null</c> for default</param> /// <param name="type">The type of virtual disk to create</param> /// <param name="adapterType">The type of virtual disk adapter</param> /// <returns>The newly created disk image</returns> public static Disk Initialize(string path, long capacity, Geometry geometry, DiskCreateType type, DiskAdapterType adapterType) { return new Disk(DiskImageFile.Initialize(path, capacity, geometry, type, adapterType), Ownership.Dispose); }
/// <summary> /// Creates a new virtual disk at the specified path. /// </summary> /// <param name="path">The name of the VMDK to create.</param> /// <param name="capacity">The desired capacity of the new disk</param> /// <param name="type">The type of virtual disk to create</param> /// <param name="adapterType">The type of virtual disk adapter</param> /// <returns>The newly created disk image</returns> public static Disk Initialize(string path, long capacity, DiskCreateType type, DiskAdapterType adapterType) { return Initialize(path, capacity, null, type, adapterType); }
/// <summary> /// Initializes a new instance of the DiskBuilder class. /// </summary> public DiskBuilder() { _diskType = DiskCreateType.Vmfs; _adapterType = DiskAdapterType.LsiLogicScsi; }
/// <summary> /// Creates a new virtual disk at the specified path. /// </summary> /// <param name="path">The name of the VMDK to create.</param> /// <param name="capacity">The desired capacity of the new disk</param> /// <param name="geometry">The desired geometry of the new disk, or <c>null</c> for default</param> /// <param name="type">The type of virtual disk to create</param> /// <param name="adapterType">The type of virtual disk adapter</param> /// <returns>The newly created disk image</returns> public static Disk Initialize(string path, long capacity, Geometry geometry, DiskCreateType type, DiskAdapterType adapterType) { return(new Disk(DiskImageFile.Initialize(path, capacity, geometry, type, adapterType), Ownership.Dispose)); }
/// <summary> /// Creates a new virtual disk at the specified location on a file system. /// </summary> /// <param name="fileSystem">The file system to contain the disk</param> /// <param name="path">The file system path to the disk</param> /// <param name="capacity">The desired capacity of the new disk</param> /// <param name="type">The type of virtual disk to create</param> /// <param name="adapterType">The type of virtual disk adapter</param> /// <returns>The newly created disk image</returns> public static Disk Initialize(DiscFileSystem fileSystem, string path, long capacity, DiskCreateType type, DiskAdapterType adapterType) { return(new Disk(DiskImageFile.Initialize(fileSystem, path, capacity, type, adapterType), Ownership.Dispose)); }
/// <summary> /// Initializes a new instance of the DiskBuilder class. /// </summary> public DiskBuilder() { _diskType = DiskCreateType.Vmfs; _adapterType = DiskAdapterType.LsiLogicScsi; }