/// <summary>
        /// Initializes a new instance of the <see cref="ServerArgument"/> class
        /// with the specified values.
        /// </summary>
        /// <param name="flavorId">The ID of the flavor to use when creating new servers. See <see cref="Flavor.Id"/>.</param>
        /// <param name="imageId">The ID of the image to use when creating new servers. See <see cref="SimpleServerImage.Id"/>.</param>
        /// <param name="name">The prefix to use when assigning names to new servers.</param>
        /// <param name="diskConfiguration">The disk configuration to use for new servers.</param>
        /// <param name="networks">A collection of <see cref="ServerNetworkArgument"/> objects describing the networks to initially connect newly created servers to.</param>
        /// <param name="personality">A collection of <see cref="Personality"/> objects describing the personality for new server instances.</param>
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="flavorId"/> is <see langword="null"/>.
        /// <para>-or-</para>
        /// <para>If <paramref name="imageId"/> is <see langword="null"/>.</para>
        /// </exception>
        /// <exception cref="ArgumentException">
        /// If <paramref name="networks"/> contains any <see langword="null"/> values.
        /// <para>-or-</para>
        /// <para>If <paramref name="personality"/> contains any <see langword="null"/> values.</para>
        /// </exception>
        public ServerArgument(FlavorId flavorId, ImageId imageId, string name, DiskConfiguration diskConfiguration, IEnumerable <ServerNetworkArgument> networks, IEnumerable <Personality> personality)
        {
            if (flavorId == null)
            {
                throw new ArgumentNullException("flavorId");
            }
            if (imageId == null)
            {
                throw new ArgumentNullException("imageId");
            }

            _flavorId          = flavorId;
            _imageId           = imageId;
            _name              = name;
            _diskConfiguration = diskConfiguration;

            if (networks != null)
            {
                _networks = networks.ToArray();
                if (_networks.Contains(null))
                {
                    throw new ArgumentException("networks cannot contain any null values", "networks");
                }
            }

            if (personality != null)
            {
                _personality = personality.ToArray();
                if (_personality.Contains(null))
                {
                    throw new ArgumentException("personality cannot contain any null values", "personality");
                }
            }
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ServerArgument"/> class
        /// with the specified values.
        /// </summary>
        /// <param name="flavorId">The ID of the flavor to use when creating new servers. See <see cref="Flavor.Id"/>.</param>
        /// <param name="imageId">The ID of the image to use when creating new servers. See <see cref="SimpleServerImage.Id"/>.</param>
        /// <param name="name">The prefix to use when assigning names to new servers.</param>
        /// <param name="diskConfiguration">The disk configuration to use for new servers.</param>
        /// <param name="networks">A collection of <see cref="ServerNetworkArgument"/> objects describing the networks to initially connect newly created servers to.</param>
        /// <param name="personality">A collection of <see cref="Personality"/> objects describing the personality for new server instances.</param>
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="flavorId"/> is <see langword="null"/>.
        /// <para>-or-</para>
        /// <para>If <paramref name="imageId"/> is <see langword="null"/>.</para>
        /// </exception>
        /// <exception cref="ArgumentException">
        /// If <paramref name="networks"/> contains any <see langword="null"/> values.
        /// <para>-or-</para>
        /// <para>If <paramref name="personality"/> contains any <see langword="null"/> values.</para>
        /// </exception>
        public ServerArgument(FlavorId flavorId, ImageId imageId, string name, DiskConfiguration diskConfiguration, IEnumerable<ServerNetworkArgument> networks, IEnumerable<Personality> personality)
        {
            if (flavorId == null)
                throw new ArgumentNullException("flavorId");
            if (imageId == null)
                throw new ArgumentNullException("imageId");

            _flavorId = flavorId;
            _imageId = imageId;
            _name = name;
            _diskConfiguration = diskConfiguration;

            if (networks != null)
            {
                _networks = networks.ToArray();
                if (_networks.Contains(null))
                    throw new ArgumentException("networks cannot contain any null values", "networks");
            }

            if (personality != null)
            {
                _personality = personality.ToArray();
                if (_personality.Contains(null))
                    throw new ArgumentException("personality cannot contain any null values", "personality");
            }
        }
        public void ResizeServerTest_Resize_2Times()
        {
            var          osm = new OpenStackMember(UserName, Password, TenantName, TenantId);
            SimpleServer ss  = osm.ListServers().FirstOrDefault(s => s.GetDetails().Status == ServerState.ShutOff);

            if (ss != null)
            {
                Server s = osm.GetServer(ss.Id);
                IEnumerable <Flavor> flavors = osm.ListFlavors();
                if (s.Status != ServerState.VerifyResize)
                {
                    Flavor flavor4g = flavors.Where <Flavor>(x => x.Name == "4g").First <Flavor>();
                    osm.ResizeServer(s.Id, flavor4g.Id, DiskConfiguration.FromName("AUTO"));
                    Trace.WriteLine(String.Format("server requested a resizing : {0}", DateTime.Now));
                    Trace.WriteLine(String.Format("FlavorId : {0}", s.Flavor.Id));
                    // wait for request
                    s = osm.ServersProvider.WaitForServerState(s.Id, ServerState.VerifyResize, new[] { ServerState.Error, ServerState.Unknown, ServerState.Suspended });
                    Trace.WriteLine(String.Format("server status changed to {0} : {1}", s.Status, DateTime.Now));
                }
                Flavor flavor1g = flavors.Where <Flavor>(x => x.Name == "g-1gb").First <Flavor>();
                Flavor flavor2g = flavors.Where <Flavor>(x => x.Name == "g-2gb").First <Flavor>();

                // expect ServiceConflictException
                bool b = osm.ResizeServer(s.Id, (s.Flavor.Id == flavor1g.Id ? flavor2g.Id : flavor1g.Id), DiskConfiguration.FromName("AUTO"));
            }
        }
        /// <inheritdoc/>
        public NewServer CreateServer(string cloudServerName, string imageId, string flavor, string adminPass, string keyname = null, string nametag = null, string[] securityGroupNames = null, string[] attachVolumeIds = null, DiskConfiguration diskConfig = null, Metadata metadata = null, Personality[] personality = null, bool attachToServiceNetwork = false, bool attachToPublicNetwork = false, IEnumerable<string> networks = null)
        {
            if (metadata == null) { metadata = new Metadata(); }

            metadata.Add("instance_name_tag", nametag ?? string.Empty);

            return ServersProvider.CreateServer(cloudServerName, imageId, flavor, adminPass, keyname, securityGroupNames, attachVolumeIds, diskConfig, metadata, personality, attachToServiceNetwork, attachToPublicNetwork, networks, this.DefaultRegion, this.Identity);
        }
示例#5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ServerResizeDetails"/> class with the specified details.
        /// </summary>
        /// <param name="flavor">The new flavor. This is obtained from <see cref="Flavor.Id">Flavor.Id</see>.</param>
        /// <param name="diskConfig">The disk configuration. If the value is <see langword="null"/>, the default configuration for the specified image is used.</param>
        /// <exception cref="ArgumentNullException">
        /// <para>If <paramref name="flavor"/> is <see langword="null"/>.</para>
        /// </exception>
        /// <exception cref="ArgumentException">
        /// <para>If <paramref name="flavor"/> is empty.</para>
        /// </exception>
        public ServerResizeDetails(string flavor, DiskConfiguration diskConfig)
        {
            if (flavor == null)
                throw new ArgumentNullException("flavor");
            if (string.IsNullOrEmpty(flavor))
                throw new ArgumentException("flavor cannot be empty");

            Flavor = flavor;
            DiskConfig = diskConfig;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="CreateServerDetails"/> class
 /// with the specified details.
 /// </summary>
 /// <param name="name">Name of the new server.</param>
 /// <param name="imageName">The image to use for the new server instance. This is
 /// specified as an image ID (see <see cref="SimpleServerImage.Id"/>) or a full URL.</param>
 /// <param name="flavor">The flavor to use for the new server instance. This
 /// is specified as a flavor ID (see <see cref="net.openstack.Core.Domain.Flavor.Id"/>) or a full URL.</param>
 /// <param name="diskConfig">The disk configuration. If the value is <see langword="null"/>, the default configuration for the specified image is used.</param>
 /// <param name="metadata">The metadata to associate with the server.</param>
 /// <param name="personality">A collection of <see cref="Personality"/> objects describing the paths and contents of files to inject in the target file system during the creation process. If the value is <see langword="null"/>, no files are injected.</param>
 /// <param name="accessIPv4">The behavior of this value is unspecified. Do not use.</param>
 /// <param name="accessIPv6">The behavior of this value is unspecified. Do not use.</param>
 /// <param name="networks">A collection of identifiers for networks to initially connect to the server. These are obtained from <see cref="CloudNetwork.Id">CloudNetwork.Id</see></param>
 public CreateServerDetails(string name, string imageName, string flavor, DiskConfiguration diskConfig, Dictionary <string, string> metadata, string accessIPv4, string accessIPv6, IEnumerable <string> networks, IEnumerable <Personality> personality)
 {
     Name        = name;
     ImageName   = imageName;
     Flavor      = flavor;
     DiskConfig  = diskConfig;
     Metadata    = metadata;
     AccessIPv4  = accessIPv4;
     AccessIPv6  = accessIPv6;
     Networks    = networks.Select(i => new NewServerNetwork(i)).ToArray();
     Personality = personality != null?personality.ToArray() : null;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ServerRebuildDetails"/> class with the specified details.
        /// </summary>
        /// <param name="name">The new name for the server. If the value is <see langword="null"/>, the server name is not changed.</param>
        /// <param name="imageName">The image to rebuild the server from. This is specified as an image ID (see <see cref="SimpleServerImage.Id"/>) or a full URL.</param>
        /// <param name="flavor">The new flavor for server. This is obtained from <see cref="net.openstack.Core.Domain.Flavor.Id"/>.</param>
        /// <param name="adminPassword">The new admin password for the server.</param>
        /// <param name="accessIPv4">The new IP v4 address for the server. If the value is <see langword="null"/>, the server's IP v4 address is not updated.</param>
        /// <param name="accessIPv6">The new IP v6 address for the server. If the value is <see langword="null"/>, the server's IP v6 address is not updated.</param>
        /// <param name="metadata">The list of metadata to associate with the server. If the value is <see langword="null"/>, the metadata associated with the server is not changed during the rebuild operation.</param>
        /// <param name="diskConfig">The disk configuration. If the value is <see langword="null"/>, the default configuration for the specified image is used.</param>
        /// <param name="personality">The path and contents of a file to inject in the target file system during the rebuild operation. If the value is <see langword="null"/>, no file is injected.</param>
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="imageName"/> is <see langword="null"/>.
        /// <para>-or-</para>
        /// <para>If <paramref name="flavor"/> is <see langword="null"/>.</para>
        /// <para>-or-</para>
        /// <para>If <paramref name="adminPassword"/> is <see langword="null"/>.</para>
        /// </exception>
        /// <exception cref="ArgumentException">
        /// If <paramref name="imageName"/> is empty.
        /// <para>-or-</para>
        /// <para>If <paramref name="flavor"/> is empty.</para>
        /// <para>-or-</para>
        /// <para>If <paramref name="adminPassword"/> is empty.</para>
        /// <para>-or-</para>
        /// <para>If the <see cref="AddressFamily"/> of <paramref name="accessIPv4"/> is not <see cref="AddressFamily.InterNetwork"/></para>
        /// <para>-or-</para>
        /// <para>If the <see cref="AddressFamily"/> of <paramref name="accessIPv6"/> is not <see cref="AddressFamily.InterNetworkV6"/></para>
        /// </exception>
        public ServerRebuildDetails(string name, string imageName, string flavor, string adminPassword, IPAddress accessIPv4, IPAddress accessIPv6, Metadata metadata, DiskConfiguration diskConfig, Personality personality)
        {
            if (imageName == null)
            {
                throw new ArgumentNullException("imageName");
            }
            if (flavor == null)
            {
                throw new ArgumentNullException("flavor");
            }
            if (adminPassword == null)
            {
                throw new ArgumentNullException("adminPassword");
            }
            if (string.IsNullOrEmpty(imageName))
            {
                throw new ArgumentException("imageName cannot be empty");
            }
            if (string.IsNullOrEmpty(flavor))
            {
                throw new ArgumentException("flavor cannot be empty");
            }
            if (string.IsNullOrEmpty(adminPassword))
            {
                throw new ArgumentException("adminPassword cannot be empty");
            }
            if (accessIPv4 != null && accessIPv4.AddressFamily != AddressFamily.InterNetwork)
            {
                throw new ArgumentException("The specified value for accessIPv4 is not an IP v4 address.", "accessIPv4");
            }
            if (accessIPv6 != null && accessIPv6.AddressFamily != AddressFamily.InterNetworkV6)
            {
                throw new ArgumentException("The specified value for accessIPv6 is not an IP v6 address.", "accessIPv6");
            }

            Name          = name;
            ImageName     = imageName;
            Flavor        = flavor;
            AdminPassword = adminPassword;
            AccessIPv4    = accessIPv4;
            AccessIPv6    = accessIPv6;
            Metadata      = metadata;
            DiskConfig    = diskConfig;
            Personality   = personality;
        }
        public void ResizeServerTest_same_flavorid()
        {
            var          osm = new OpenStackMember(UserName, Password, TenantName, TenantId);
            SimpleServer ss  = osm.ListServers().FirstOrDefault(s => s.GetDetails().Status == ServerState.ShutOff);

            if (ss != null)
            {
                Server s = osm.GetServer(ss.Id);
                if (s.Status == ServerState.VerifyResize)
                {
                    osm.RevertResizeServer(s.Id);
                    Trace.WriteLine(String.Format("server reverted a resizing : {0}", DateTime.Now));
                    // wait for activate
                    s = osm.ServersProvider.WaitForServerActive(s.Id);
                    Trace.WriteLine(String.Format("server activated : {0}", DateTime.Now));
                }

                // expect BadServiceRequestException
                bool b = osm.ResizeServer(s.Id, s.Flavor.Id, DiskConfiguration.FromName("AUTO"));
                Assert.IsTrue(b);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ServerResizeDetails"/> class with the specified details.
        /// </summary>
        /// <param name="name">The new name for the resized server.</param>
        /// <param name="flavor">The new flavor. This is obtained from <see cref="net.openstack.Core.Domain.Flavor.Id">Flavor.Id</see>.</param>
        /// <param name="diskConfig">The disk configuration. If the value is <see langword="null"/>, the default configuration for the specified image is used.</param>
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="name"/> is <see langword="null"/>.
        /// <para>-or-</para>
        /// <para>If <paramref name="flavor"/> is <see langword="null"/>.</para>
        /// </exception>
        /// <exception cref="ArgumentException">
        /// If <paramref name="name"/> is empty.
        /// <para>-or-</para>
        /// <para>If <paramref name="flavor"/> is empty.</para>
        /// </exception>
        public ServerResizeDetails(string name, string flavor, DiskConfiguration diskConfig)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (flavor == null)
            {
                throw new ArgumentNullException("flavor");
            }
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException("serverName cannot be empty");
            }
            if (string.IsNullOrEmpty(flavor))
            {
                throw new ArgumentException("flavor cannot be empty");
            }

            Name       = name;
            Flavor     = flavor;
            DiskConfig = diskConfig;
        }
示例#10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CreateServerDetails"/> class
 /// with the specified details.
 /// </summary>
 /// <param name="name">Name of the new server.</param>
 /// <param name="imageName">The image to use for the new server instance. This is
 /// specified as an image ID (see <see cref="SimpleServerImage.Id"/>) or a full URL.</param>
 /// <param name="flavor">The flavor to use for the new server instance. This
 /// is specified as a flavor ID (see <see cref="net.openstack.Core.Domain.Flavor.Id"/>) or a full URL.</param>
 /// <param name="diskConfig">The disk configuration. If the value is <c>null</c>, the default configuration for the specified image is used.</param>
 /// <param name="metadata">The metadata to associate with the server.</param>
 /// <param name="personality">A collection of <see cref="Personality"/> objects describing the paths and contents of files to inject in the target file system during the creation process. If the value is <c>null</c>, no files are injected.</param>
 /// <param name="accessIPv4">The behavior of this value is unspecified. Do not use.</param>
 /// <param name="accessIPv6">The behavior of this value is unspecified. Do not use.</param>
 /// <param name="networks">A collection of identifiers for networks to initially connect to the server. These are obtained from <see cref="CloudNetwork.Id">CloudNetwork.Id</see></param>
 public CreateServerDetails(string name, string imageName, string flavor, DiskConfiguration diskConfig, Dictionary<string, string> metadata, string accessIPv4, string accessIPv6, IEnumerable<string> networks, IEnumerable<Personality> personality)
 {
     Name = name;
     ImageName = imageName;
     Flavor = flavor;
     DiskConfig = diskConfig;
     Metadata = metadata;
     AccessIPv4 = accessIPv4;
     AccessIPv6 = accessIPv6;
     Networks = networks.Select(i => new NewServerNetwork(i)).ToArray();
     Personality = personality != null ? personality.ToArray() : null;
 }
        public void ResizeServerTest()
        {
            var          osm    = new OpenStackMember(UserName, Password, TenantName, TenantId);
            SimpleServer ss     = osm.ListServers().FirstOrDefault(s => s.GetDetails().Status == ServerState.ShutOff);
            Server       server = osm.GetServer(ss.Id);

            if (server != null)
            {
                if (server.Status == ServerState.VerifyResize)
                {
                    osm.RevertResizeServer(server.Id);
                    Trace.WriteLine(String.Format("server reverted a resizing : {0}", DateTime.Now));
                    // wait for activate
                    server = osm.ServersProvider.WaitForServerActive(server.Id);
                    Trace.WriteLine(String.Format("server activated : {0}", DateTime.Now));
                }
                IEnumerable <Flavor> flavors = osm.ListFlavors();
                Flavor flavor1g = flavors.Where <Flavor>(x => x.Name == "g-1gb").First <Flavor>();
                Flavor flavor2g = flavors.Where <Flavor>(x => x.Name == "g-2gb").First <Flavor>();
                bool   b;
                try
                {
                    b = osm.ResizeServer(server.Id, (server.Flavor.Id == flavor1g.Id ? flavor2g.Id : flavor1g.Id), DiskConfiguration.FromName("AUTO"));
                    Assert.IsTrue(b);

                    Trace.WriteLine(String.Format("server requested a resizing : {0}", DateTime.Now));
                    Trace.WriteLine(String.Format("FlavorId : {0}", server.Flavor.Id));

                    // wait for request
                    server = osm.ServersProvider.WaitForServerState(server.Id, ServerState.VerifyResize, new[] { ServerState.Error, ServerState.Unknown, ServerState.Suspended });
                    Trace.WriteLine(String.Format("server status changed to {0} : {1}", server.Status, DateTime.Now));
                }
                catch (ServiceConflictException sce)
                {
                    // throwing ServiceConflictException when server is locked is designed.
                    Assert.IsTrue(sce.Message.Contains("locked"));
                }
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="CreateServerRequest"/> class
 /// with the specified details.
 /// </summary>
 /// <param name="name">Name of the new server.</param>
 /// <param name="imageName">The image to use for the new server instance. This is
 /// specified as an image ID (see <see cref="SimpleServerImage.Id"/>) or a full URL.</param>
 /// <param name="flavor">The flavor to use for the new server instance. This
 /// is specified as a flavor ID (see <see cref="Flavor.Id"/>) or a full URL.</param>
 /// <param name="diskConfig">The disk configuration. If the value is <see langword="null"/>, the default configuration for the specified image is used.</param>
 /// <param name="metadata">The metadata to associate with the server.</param>
 /// <param name="personality">A collection of <see cref="Personality"/> objects describing the paths and contents of files to inject in the target file system during the creation process. If the value is <see langword="null"/>, no files are injected.</param>
 /// <param name="accessIPv4">The behavior of this value is unspecified. Do not use.</param>
 /// <param name="accessIPv6">The behavior of this value is unspecified. Do not use.</param>
 /// <param name="networks">A collection of identifiers for networks to initially connect to the server. These are obtained from <see cref="CloudNetwork.Id">CloudNetwork.Id</see></param>
 public CreateServerRequest(string name, string imageName, string flavor, DiskConfiguration diskConfig, Dictionary <string, string> metadata, string accessIPv4, string accessIPv6, IEnumerable <string> networks, IEnumerable <Personality> personality)
 {
     Details = new CreateServerDetails(name, imageName, flavor, diskConfig, metadata, accessIPv4, accessIPv6, networks, personality);
 }
示例#13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CreateServerDetails"/> class
 /// with the specified details.
 /// </summary>
 /// <param name="name">Name of the new server.</param>
 /// <param name="imageName">The image to use for the new server instance. This is
 /// specified as an image ID (see <see cref="SimpleServerImage.Id"/>) or a full URL.</param>
 /// <param name="flavorId">The flavor to use for the new server instance. This
 /// is specified as a flavor ID (see <see cref="Flavor.Id"/>) or a full URL.</param>
 /// <param name="adminPass">The root Password </param>
 /// <param name="keyName">the ssh keyname to add to server</param>
 /// <param name="securityGroupNames">A collection of openstack security group name</param>
 /// <param name="attachVolumeIds">A collection of voiume ids which will be attached to the instance.</param>
 /// <param name="diskConfig">The disk configuration. If the value is <see langword="null"/>, the default configuration for the specified image is used.</param>
 /// <param name="metadata">The metadata to associate with the server.</param>
 /// <param name="personality">A collection of <see cref="Personality"/> objects describing the paths and contents of files to inject in the target file system during the creation process. If the value is <see langword="null"/>, no files are injected.</param>
 /// <param name="accessIPv4">The behavior of this value is unspecified. Do not use.</param>
 /// <param name="accessIPv6">The behavior of this value is unspecified. Do not use.</param>
 /// <param name="networks">A collection of identifiers for networks to initially connect to the server. These are obtained from <see cref="CloudNetwork.Id">CloudNetwork.Id</see></param>
 public CreateServerDetails(string name, string imageName, string flavorId, string adminPass, string keyName, string[] securityGroupNames, string[] attachVolumeIds, DiskConfiguration diskConfig, Dictionary<string, string> metadata, string accessIPv4, string accessIPv6, IEnumerable<string> networks, IEnumerable<Personality> personality)
 {
     Name = name;
     ImageId = imageName;
     FlavorId = flavorId;
     DiskConfig = diskConfig;
     Metadata = metadata;
     AccessIPv4 = accessIPv4;
     AccessIPv6 = accessIPv6;
     Networks = (networks == null ? null : networks.Select(i => new NewServerNetwork(i)).ToArray());
     Personality = personality != null ? personality.ToArray() : null;
     KeyName = keyName;
     SecurityGroupNames = SecurityGroupName.GetGroupNamesFromStrings(securityGroupNames).ToArray<SecurityGroupName>();
     BlockDeviceMappings = VolumeIds.GetVolumeIdsFromStrings(attachVolumeIds).ToArray<VolumeIds>();
     AdminPass = adminPass;
 }
示例#14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CreateServerRequest"/> class
 /// with the specified details.
 /// </summary>
 /// <param name="name">Name of the new server.</param>
 /// <param name="imageId">The image to use for the new server instance. This is
 /// specified as an image ID (see <see cref="SimpleServerImage.Id"/>) or a full URL.</param>
 /// <param name="flavorId">The flavor to use for the new server instance. This
 /// is specified as a flavor ID (see <see cref="Flavor.Id"/>) or a full URL.</param>
 /// <param name="adminPass">The root Password </param>
 /// <param name="keyName">The ssh key name</param>
 /// <param name="securityGroupNames">A collection of openstack security group name</param>
 /// <param name="attachVolumeIds">A collection of voiume ids which will be attached to the instance.</param>
 /// <param name="diskConfig">The disk configuration. If the value is <see langword="null"/>, the default configuration for the specified image is used.</param>
 /// <param name="metadata">The metadata to associate with the server.</param>
 /// <param name="personality">A collection of <see cref="Personality"/> objects describing the paths and contents of files to inject in the target file system during the creation process. If the value is <see langword="null"/>, no files are injected.</param>
 /// <param name="accessIPv4">The behavior of this value is unspecified. Do not use.</param>
 /// <param name="accessIPv6">The behavior of this value is unspecified. Do not use.</param>
 ///<param name="networks">A collection of identifiers for networks to initially connect to the server. These are obtained from <see cref="CloudNetwork.Id">CloudNetwork.Id</see></param>
 public CreateServerRequest(string name, string imageId, string flavorId, string adminPass, string keyName, string[] securityGroupNames, string[] attachVolumeIds, DiskConfiguration diskConfig, Dictionary<string, string> metadata, string accessIPv4, string accessIPv6, IEnumerable<string> networks, IEnumerable<Personality> personality)
 {
     Details = new CreateServerDetails(name, imageId, flavorId, adminPass, keyName, securityGroupNames, attachVolumeIds, diskConfig, metadata, accessIPv4, accessIPv6, networks, personality);
 }
示例#15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CreateServerRequest"/> class
 /// with the specified details.
 /// </summary>
 /// <param name="name">Name of the new server.</param>
 /// <param name="imageName">The image to use for the new server instance. This is
 /// specified as an image ID (see <see cref="SimpleServerImage.Id"/>) or a full URL.</param>
 /// <param name="flavor">The flavor to use for the new server instance. This
 /// is specified as a flavor ID (see <see cref="Flavor.Id"/>) or a full URL.</param>
 /// <param name="diskConfig">The disk configuration. If the value is <c>null</c>, the default configuration for the specified image is used.</param>
 /// <param name="metadata">The metadata to associate with the server.</param>
 /// <param name="personality">A collection of <see cref="Personality"/> objects describing the paths and contents of files to inject in the target file system during the creation process. If the value is <c>null</c>, no files are injected.</param>
 /// <param name="accessIPv4">The behavior of this value is unspecified. Do not use.</param>
 /// <param name="accessIPv6">The behavior of this value is unspecified. Do not use.</param>
 /// <param name="networks">A collection of identifiers for networks to initially connect to the server. These are obtained from <see cref="CloudNetwork.Id">CloudNetwork.Id</see></param>
 public CreateServerRequest(string name, string imageName, string flavor, DiskConfiguration diskConfig, Dictionary<string, string> metadata, string accessIPv4, string accessIPv6, IEnumerable<string> networks, IEnumerable<Personality> personality)
 {
     Details = new CreateServerDetails(name, imageName, flavor, diskConfig, metadata, accessIPv4, accessIPv6, networks, personality);
 }
 public static IServiceCollection AddDiskFileSystem(this IServiceCollection services, DiskConfiguration config)
 {
     return(services.AddTransient <IFileSystem, DiskFileSystem>(
                (services) => new DiskFileSystem(config)
                ));
 }
 /// <inheritdoc/>
 public bool ResizeServer(string serverId, string flavorid, DiskConfiguration diskconfig)
 {
     return(ServersProvider.ResizeServer(serverId, flavorid, diskconfig, this.DefaultRegion, this.Identity));
 }
        /// <inheritdoc/>
        public NewServer CreateServer(string cloudServerName, string imageId, string flavor, string adminPass, string keyname = null, string nametag = null, string[] securityGroupNames = null, string[] attachVolumeIds = null, DiskConfiguration diskConfig = null, Metadata metadata = null, Personality[] personality = null, bool attachToServiceNetwork = false, bool attachToPublicNetwork = false, IEnumerable <string> networks = null)
        {
            if (metadata == null)
            {
                metadata = new Metadata();
            }

            metadata.Add("instance_name_tag", nametag ?? string.Empty);

            return(ServersProvider.CreateServer(cloudServerName, imageId, flavor, adminPass, keyname, securityGroupNames, attachVolumeIds, diskConfig, metadata, personality, attachToServiceNetwork, attachToPublicNetwork, networks, this.DefaultRegion, this.Identity));
        }
 /// <inheritdoc/>
 public bool ResizeServer(string serverId, string flavorid, DiskConfiguration diskconfig)
 {
     return ServersProvider.ResizeServer(serverId, flavorid, diskconfig, this.DefaultRegion, this.Identity);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ServerRebuildDetails"/> class with the specified details.
        /// </summary>
        /// <param name="name">The new name for the server. If the value is <c>null</c>, the server name is not changed.</param>
        /// <param name="imageName">The image to rebuild the server from. This is specified as an image ID (see <see cref="SimpleServerImage.Id"/>) or a full URL.</param>
        /// <param name="flavor">The new flavor for server. This is obtained from <see cref="net.openstack.Core.Domain.Flavor.Id"/>.</param>
        /// <param name="adminPassword">The new admin password for the server.</param>
        /// <param name="accessIPv4">The new IP v4 address for the server. If the value is <c>null</c>, the server's IP v4 address is not updated.</param>
        /// <param name="accessIPv6">The new IP v6 address for the server. If the value is <c>null</c>, the server's IP v6 address is not updated.</param>
        /// <param name="metadata">The list of metadata to associate with the server. If the value is <c>null</c>, the metadata associated with the server is not changed during the rebuild operation.</param>
        /// <param name="diskConfig">The disk configuration. If the value is <c>null</c>, the default configuration for the specified image is used.</param>
        /// <param name="personality">The path and contents of a file to inject in the target file system during the rebuild operation. If the value is <c>null</c>, no file is injected.</param>
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="imageName"/> is <c>null</c>.
        /// <para>-or-</para>
        /// <para>If <paramref name="flavor"/> is <c>null</c>.</para>
        /// <para>-or-</para>
        /// <para>If <paramref name="adminPassword"/> is <c>null</c>.</para>
        /// </exception>
        /// <exception cref="ArgumentException">
        /// If <paramref name="imageName"/> is empty.
        /// <para>-or-</para>
        /// <para>If <paramref name="flavor"/> is empty.</para>
        /// <para>-or-</para>
        /// <para>If <paramref name="adminPassword"/> is empty.</para>
        /// <para>-or-</para>
        /// <para>If the <see cref="AddressFamily"/> of <paramref name="accessIPv4"/> is not <see cref="AddressFamily.InterNetwork"/></para>
        /// <para>-or-</para>
        /// <para>If the <see cref="AddressFamily"/> of <paramref name="accessIPv6"/> is not <see cref="AddressFamily.InterNetworkV6"/></para>
        /// </exception>
        public ServerRebuildDetails(string name, string imageName, string flavor, string adminPassword, IPAddress accessIPv4, IPAddress accessIPv6, Metadata metadata, DiskConfiguration diskConfig, Personality personality)
        {
            if (imageName == null)
                throw new ArgumentNullException("imageName");
            if (flavor == null)
                throw new ArgumentNullException("flavor");
            if (adminPassword == null)
                throw new ArgumentNullException("adminPassword");
            if (string.IsNullOrEmpty(imageName))
                throw new ArgumentException("imageName cannot be empty");
            if (string.IsNullOrEmpty(flavor))
                throw new ArgumentException("flavor cannot be empty");
            if (string.IsNullOrEmpty(adminPassword))
                throw new ArgumentException("adminPassword cannot be empty");
            if (accessIPv4 != null && accessIPv4.AddressFamily != AddressFamily.InterNetwork)
                throw new ArgumentException("The specified value for accessIPv4 is not an IP v4 address.", "accessIPv4");
            if (accessIPv6 != null && accessIPv6.AddressFamily != AddressFamily.InterNetworkV6)
                throw new ArgumentException("The specified value for accessIPv6 is not an IP v6 address.", "accessIPv6");

            Name = name;
            ImageName = imageName;
            Flavor = flavor;
            AdminPassword = adminPassword;
            AccessIPv4 = accessIPv4;
            AccessIPv6 = accessIPv6;
            Metadata = metadata;
            DiskConfig = diskConfig;
            Personality = personality;
        }
示例#21
0
 public SetupDiskComponent()
 {
     Name = "Microsoft-Windows-Setup";
     DiskConfiguration      = new DiskConfiguration();
     DiskConfiguration.Disk = new Disk();
 }