GetDefaultDataDisk() 공개 정적인 메소드

Gets a virtual disk located in blob storage and sets a default size to the disk of 30 GB and a logical unit no. of 0 (drive e:)
public static GetDefaultDataDisk ( string storageAccountName, int size = 30, int logicalUnitNumber, string diskName = null, string diskLabel = null ) : DataVirtualHardDisk
storageAccountName string The path to blob storage for the disk
size int the size of the disk in GB - can be up to 1TB
logicalUnitNumber int number between 0 and 15 which is the logical unit of the drive
diskName string the name of the disk
diskLabel string the label of the disk
리턴 DataVirtualHardDisk
예제 #1
0
        /// <summary>
        /// Used to direct the user to the image for the default Sql Server 2012 image
        /// </summary>
        /// <returns>A persistent VM Role containing the data to execute the image</returns>
        public static PersistentVMRole GetDefaultSqlServer2012VMRole(VmSize vmSize, string storageAccount)
        {
            // build the default endpoints
            var inputEndpoints = new InputEndpoints();

            inputEndpoints.AddEndpoint(InputEndpoint.GetDefaultRemoteDesktopSettings());
            inputEndpoints.AddEndpoint(InputEndpoint.GetDefaultSqlServerSettings());
            // add the endpoints collections to a network configuration set
            var network = new NetworkConfigurationSet
            {
                InputEndpoints = inputEndpoints
            };
            // build the windows configuration set
            var windows = new WindowsConfigurationSet
            {
                AdminPassword             = "******",
                ResetPasswordOnFirstLogon = true
            };
            OSVirtualHardDisk   osDisk   = OSVirtualHardDisk.GetSqlServerOSImage(storageAccount);
            DataVirtualHardDisk dataDisk = DataVirtualHardDisk.GetDefaultDataDisk(storageAccount);
            var disks = new DataVirtualHardDisks();

            disks.HardDiskCollection.Add(dataDisk);
            return(new PersistentVMRole
            {
                NetworkConfigurationSet = network,
                OperatingSystemConfigurationSet = windows,
                RoleSize = vmSize,
                RoleName = "Elastarole",
                HardDisks = disks,
                OSHardDisk = osDisk
            });
        }
예제 #2
0
        public static PersistentVMRole GetAdHocTemplate(VirtualMachineProperties properties, ConfigurationSet operatingSystemConfigurationSet)
        {
            // build the default endpoints
            var inputEndpoints = new InputEndpoints();

            if (properties.PublicEndpoints == null)
            {
                properties.PublicEndpoints = new List <InputEndpoint>();
            }
            // add all of the endpoints
            foreach (var endpoint in properties.PublicEndpoints)
            {
                inputEndpoints.AddEndpoint(endpoint);
            }

            if (operatingSystemConfigurationSet.ConfigurationSetType == ConfigurationSetType.WindowsProvisioningConfiguration)
            {
                if (properties.PublicEndpoints.All(endpoint => endpoint.Port != 3389))
                {
                    inputEndpoints.AddEndpoint(InputEndpoint.GetDefaultRemoteDesktopSettings());
                }
            }

            // add the endpoints collections to a network configuration set
            var network = new NetworkConfigurationSet
            {
                InputEndpoints = inputEndpoints
            };

            if (properties.EndpointAclRules != null)
            {
                network.EndpointAcl = new EndpointAcl(new EndpointAclRules(properties.EndpointAclRules));
            }

            if (properties.VirtualNetwork != null)
            {
                network.SubnetName = properties.VirtualNetwork.SubnetName;
            }

            OSVirtualHardDisk osDisk = OSVirtualHardDisk.GetOSImageFromTemplate(properties);
            var disks = new DataVirtualHardDisks();

            if (properties.DataDisks != null)
            {
                for (int i = 0; i < properties.DataDisks.Count; i++)
                {
                    var label = properties.DataDisks[i].DiskLabel ?? "DataDisk" + i;
                    var name  = properties.DataDisks[i].DiskName ?? "DataDisk" + i;
                    var size  = properties.DataDisks[i].LogicalDiskSizeInGB < 30
                                   ? 30
                                   : properties.DataDisks[i].LogicalDiskSizeInGB;
                    var disk = DataVirtualHardDisk.GetDefaultDataDisk(properties.StorageAccountName, size, i, name, label);
                    disks.HardDiskCollection.Add(disk);
                }
            }
            var pvm = new PersistentVMRole
            {
                NetworkConfigurationSet         = network,
                OperatingSystemConfigurationSet = operatingSystemConfigurationSet,
                RoleSize   = properties.VmSize,
                RoleName   = properties.RoleName,
                HardDisks  = disks,
                OSHardDisk = osDisk
            };

            if (properties.AvailabilitySet != null)
            {
                pvm.AvailabilityNameSet = properties.AvailabilitySet;
            }

            return(pvm);
        }