示例#1
0
        /// <summary>
        /// Used to create a deployment and add any persistent vm role to the deployment
        /// </summary>
        /// <param name="properties"></param>
        /// <param name="roles">The PersistentVMRole</param>
        /// <returns>The Deployment that is being used</returns>
        private static Deployment AddPersistentVMRole(VirtualMachineProperties properties, IEnumerable <PersistentVMRole> roles)
        {
            var namer      = new RandomAccountName();
            var deployment = new Deployment
            {
                // use the first deployment property if it's not the same then fluent doesn't supporting deployment splitting at this level!
                Name = properties.DeploymentName,
//                                     Label = Convert.ToBase64String(Encoding.UTF8.GetBytes(cloudServiceName))
                Label = properties.DeploymentName
            };

            if (properties.VirtualNetwork != null)
            {
                deployment.VirtualNetworkName = properties.VirtualNetwork.VirtualNetworkName;
            }
            var roleList = new RoleList();

            foreach (var role in roles)
            {
                role.RoleName = role.RoleName ?? namer.GetPureRandomValue();
                roleList.Roles.Add(role);
            }

            deployment.RoleList = roleList;
            return(deployment);
        }
示例#2
0
        /// <summary>
        /// Used to create a deployment and add any persistent vm role to the deployment
        /// </summary>
        /// <param name="role">The PersistentVMRole</param>
        /// <param name="cloudServiceName">The Name of the cloud service which the role is present in</param>
        /// <returns>The Deployment that is being used</returns>
        private static Deployment AddPersistentVMRole(string cloudServiceName, PersistentVMRole role)
        {
            var namer      = new RandomAccountName();
            var deployment = new Deployment
            {
                Name = cloudServiceName,
//                                     Label = Convert.ToBase64String(Encoding.UTF8.GetBytes(cloudServiceName))
                Label = cloudServiceName
            };

            role.RoleName = namer.GetPureRandomValue();
            var roleList = new RoleList();

            roleList.Roles.Add(role);
            deployment.RoleList = roleList;
            return(deployment);
        }
示例#3
0
        /// <summary>
        /// Gets the Xml tree for the custom serialiser
        /// </summary>
        /// <returns>An XElement </returns>
        public XElement GetXmlTree()
        {
            var namer = new RandomAccountName();

            // if the timezone is set to null then set it GMT
            TimeZone = TimeZone ?? "GMT Standard Time";
            var element = new XElement(Namespaces.NsWindowsAzure + "ConfigurationSet",
                                       new XElement(Namespaces.NsWindowsAzure + "ConfigurationSetType", ConfigurationSetType.ToString()),
                                       new XElement(Namespaces.NsWindowsAzure + "ComputerName", namer.GetPureRandomValue().ToUpper()),
                                       new XElement(Namespaces.NsWindowsAzure + "AdminPassword", AdminPassword),
                                       new XElement(Namespaces.NsWindowsAzure + "ResetPasswordOnFirstLogon", ResetPasswordOnFirstLogon.ToString(CultureInfo.InvariantCulture).ToLower()),
                                       new XElement(Namespaces.NsWindowsAzure + "EnableAutomaticUpdates", EnableAutomaticUpdate.ToString(CultureInfo.InvariantCulture).ToLower()),
                                       new XElement(Namespaces.NsWindowsAzure + "TimeZone", TimeZone));

            //if (ComputerName != null)
            //    element.Add(new XElement(Namespaces.NsWindowsAzure + "ComputerName",
            //                             ComputerName.ToString(CultureInfo.InvariantCulture)));
            return(element);
        }