예제 #1
0
        public void InitializeDifferencingRelPath()
        {
            DiscFileSystem fs = new InMemoryFileSystem();

            DiskImageFile baseFile = DiskImageFile.Initialize(fs, @"\dir\subdir\base.vmdk", 16 * 1024L * 1024 * 1024, DiskCreateType.MonolithicSparse);

            using (Disk disk = Disk.InitializeDifferencing(fs, @"\dir\diff.vmdk", DiskCreateType.MonolithicSparse, @"subdir\base.vmdk"))
            {
                Assert.IsNotNull(disk);
                Assert.That(disk.Geometry.Capacity > 15.8 * 1024L * 1024 * 1024 && disk.Geometry.Capacity < 16 * 1024L * 1024 * 1024);
                Assert.That(disk.Content.Length == 16 * 1024L * 1024 * 1024);
                Assert.AreEqual(2, new List <VirtualDiskLayer>(disk.Layers).Count);
            }
            Assert.Greater(fs.GetFileLength(@"\dir\diff.vmdk"), 2 * 1024 * 1024);
            Assert.Less(fs.GetFileLength(@"\dir\diff.vmdk"), 4 * 1024 * 1024);
        }
예제 #2
0
 internal static Disk Initialize(FileLocator fileLocator, string path, DiskParameters parameters)
 {
     return(new Disk(DiskImageFile.Initialize(fileLocator, path, parameters), Ownership.Dispose));
 }
예제 #3
0
 /// <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));
 }
예제 #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="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));
 }
예제 #5
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));
 }