Ejemplo n.º 1
0
        public override DiskImageBuilder GetImageBuilder(string variant)
        {
            DiskBuilder builder = new DiskBuilder();

            switch (variant)
            {
            case "fixed":
                builder.DiskType = DiskCreateType.MonolithicFlat;
                break;

            case "dynamic":
                builder.DiskType = DiskCreateType.MonolithicSparse;
                break;

            case "vmfsfixed":
                builder.DiskType = DiskCreateType.Vmfs;
                break;

            case "vmfsdynamic":
                builder.DiskType = DiskCreateType.VmfsSparse;
                break;

            default:
                throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Unknown VMDK disk variant '{0}'", variant), "variant");
            }

            return(builder);
        }
Ejemplo n.º 2
0
        public override DiskImageBuilder GetImageBuilder(string variant)
        {
            DiskBuilder builder = new DiskBuilder();

            builder.DiskType = VariantToCreateType(variant);
            return(builder);
        }
        public void BuildDynamic()
        {
            DiskBuilder builder = new DiskBuilder();

            builder.DiskType = DiskCreateType.VmfsSparse;
            builder.Content  = diskContent;


            DiskImageFileSpecification[] fileSpecs = builder.Build("foo");
            Assert.AreEqual(2, fileSpecs.Length);
            Assert.AreEqual("foo.vmdk", fileSpecs[0].Name);


            DiskBuilderFileSystem dbfs = new DiskBuilderFileSystem(fileSpecs);

            using (Disk disk = new Disk(dbfs, "foo.vmdk", FileAccess.Read))
            {
                for (int i = 0; i < 8; i += 1024 * 1024)
                {
                    disk.Content.Position = i;
                    Assert.AreEqual(i, disk.Content.ReadByte());
                }

                disk.Content.Position = 15 * 1024 * 1024;
                Assert.AreEqual(0xFF, disk.Content.ReadByte());
            }
        }
Ejemplo n.º 4
0
        public void BuildFixed()
        {
            DiskBuilder builder = new DiskBuilder();
            builder.DiskType = DiskCreateType.Vmfs;
            builder.Content = diskContent;

            DiskImageFileSpecification[] fileSpecs = builder.Build("foo");
            Assert.AreEqual(2, fileSpecs.Length);
            Assert.AreEqual("foo.vmdk", fileSpecs[0].Name);

            DiskBuilderFileSystem dbfs = new DiskBuilderFileSystem(fileSpecs);

            using (Disk disk = new Disk(dbfs, "foo.vmdk", FileAccess.Read))
            {
                for (int i = 0; i < 8; i += 1024 * 1024)
                {
                    disk.Content.Position = i;
                    Assert.AreEqual(i, disk.Content.ReadByte());
                }

                disk.Content.Position = 15 * 1024 * 1024;
                Assert.AreEqual(0xFF, disk.Content.ReadByte());
            }
        }
Ejemplo n.º 5
0
        public override DiskImageBuilder GetImageBuilder(string variant)
        {
            DiskBuilder builder = new DiskBuilder();

            switch (variant)
            {
                case "fixed":
                    builder.DiskType = DiskCreateType.MonolithicFlat;
                    break;
                case "dynamic":
                    builder.DiskType = DiskCreateType.MonolithicSparse;
                    break;
                case "vmfsfixed":
                    builder.DiskType = DiskCreateType.Vmfs;
                    break;
                case "vmfsdynamic":
                    builder.DiskType = DiskCreateType.VmfsSparse;
                    break;
                default:
                    throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Unknown VMDK disk variant '{0}'", variant), "variant");
            }

            return builder;
        }
Ejemplo n.º 6
0
 public override DiskImageBuilder GetImageBuilder(string variant)
 {
     DiskBuilder builder = new DiskBuilder();
     builder.DiskType = VariantToCreateType(variant);
     return builder;
 }