Пример #1
0
        public override VirtualDisk CreateDisk(FileLocator locator, string variant, string path, VirtualDiskParameters diskParameters)
        {
            DiskParameters vmdkParams = new DiskParameters(diskParameters);

            vmdkParams.CreateType = VariantToCreateType(variant);
            return(Disk.Initialize(locator, path, vmdkParams));
        }
Пример #2
0
        /// <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>
        /// <returns>The newly created disk image</returns>
        public static DiskImageFile Initialize(DiscFileSystem fileSystem, string path, long capacity, DiskCreateType createType)
        {
            DiskParameters diskParams = new DiskParameters();

            diskParams.Capacity   = capacity;
            diskParams.CreateType = createType;

            return(Initialize(fileSystem, path, diskParams));
        }
Пример #3
0
        /// <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>
        /// <returns>The newly created disk image</returns>
        public static DiskImageFile Initialize(string path, long capacity, DiskCreateType type)
        {
            DiskParameters diskParams = new DiskParameters();

            diskParams.Capacity   = capacity;
            diskParams.CreateType = type;

            return(Initialize(path, diskParams));
        }
Пример #4
0
        /// <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));
        }
Пример #5
0
 internal static Disk Initialize(FileLocator fileLocator, string path, DiskParameters parameters)
 {
     return(new Disk(DiskImageFile.Initialize(fileLocator, path, parameters), Ownership.Dispose));
 }
Пример #6
0
 /// <summary>
 /// Creates a new virtual disk at the specified path.
 /// </summary>
 /// <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>
 public static Disk Initialize(string path, DiskParameters parameters)
 {
     return(new Disk(DiskImageFile.Initialize(path, parameters), Ownership.Dispose));
 }
Пример #7
0
        /// <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));
        }
Пример #8
0
        /// <summary>
        /// Creates a new virtual disk at the specified path.
        /// </summary>
        /// <param name="fileSystem">The file system to create the disk on.</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>
        public static DiskImageFile Initialize(DiscFileSystem fileSystem, string path, DiskParameters parameters)
        {
            FileLocator locator = new DiscFileLocator(fileSystem, Utilities.GetDirectoryFromPath(path));

            return(Initialize(locator, Utilities.GetFileFromPath(path), parameters));
        }
Пример #9
0
        /// <summary>
        /// Creates a new virtual disk at the specified path.
        /// </summary>
        /// <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>
        public static DiskImageFile Initialize(string path, DiskParameters parameters)
        {
            FileLocator locator = new LocalFileLocator(Path.GetDirectoryName(path));

            return(Initialize(locator, Path.GetFileName(path), parameters));
        }