tempest/services/compute/v3/xml/servers_client.py
def create_server(self, name, image_ref, flavor_ref, **kwargs):
        """
        Creates an instance of a server.
        name (Required): The name of the server.
        image_ref (Required): Reference to the image used to build the server.
        flavor_ref (Required): The flavor used to build the server.
        Following optional keyword arguments are accepted:
        admin_password: Sets the initial root password.
        key_name: Key name of keypair that was created earlier.
        meta: A dictionary of values to be used as metadata.
        security_groups: A list of security group dicts.
        networks: A list of network dicts with UUID and fixed_ip.
        user_data: User data for instance.
        availability_zone: Availability zone in which to launch instance.
        access_ip_v4: The IPv4 access address for the server.
        access_ip_v6: The IPv6 access address for the server.
        min_count: Count of minimum number of instances to launch.
        max_count: Count of maximum number of instances to launch.
        disk_config: Determines if user or admin controls disk configuration.
        return_reservation_id: Enable/Disable the return of reservation id.
        """
        server = Element("server",
                         xmlns=XMLNS_V3,
                         flavor_ref=flavor_ref,
                         image_ref=image_ref,
                         name=name)
        attrs = ["admin_password", "key_name",
                 ('os-access-ips:access_ip_v4',
                  'access_ip_v4',
                  'xmlns:os-access-ips',
                  "http://docs.openstack.org/compute/ext/"
                  "os-access-ips/api/v3"),
                 ('os-access-ips:access_ip_v6',
                  'access_ip_v6',
                  'xmlns:os-access-ips',
                  "http://docs.openstack.org/compute/ext/"
                  "os-access-ips/api/v3"),
                 ("os-user-data:user_data",
                  'user_data',
                  'xmlns:os-user-data',
                  "http://docs.openstack.org/compute/ext/userdata/api/v3"),
                 ("os-availability-zone:availability_zone",
                  'availability_zone',
                  'xmlns:os-availability-zone',
                  "http://docs.openstack.org/compute/ext/"
                  "availabilityzone/api/v3"),
                 ("os-multiple-create:min_count",
                  'min_count',
                  'xmlns:os-multiple-create',
                  "http://docs.openstack.org/compute/ext/"
                  "multiplecreate/api/v3"),
                 ("os-multiple-create:max_count",
                  'max_count',
                  'xmlns:os-multiple-create',
                  "http://docs.openstack.org/compute/ext/"
                  "multiplecreate/api/v3"),
                 ("os-multiple-create:return_reservation_id",
                  "return_reservation_id",
                  'xmlns:os-multiple-create',
                  "http://docs.openstack.org/compute/ext/"
                  "multiplecreate/api/v3"),
                 ("os-disk-config:disk_config",
                  "disk_config",
                  "xmlns:os-disk-config",
                  "http://docs.openstack.org/"
                  "compute/ext/disk_config/api/v3")]

        for attr in attrs:
            if isinstance(attr, tuple):
                post_param = attr[0]
                key = attr[1]
                value = kwargs.get(key)
                if value is not None:
                    server.add_attr(attr[2], attr[3])
                    server.add_attr(post_param, value)
            else:
                post_param = attr
                key = attr
                value = kwargs.get(key)
                if value is not None:
                    server.add_attr(post_param, value)

        if 'security_groups' in kwargs:
            server.add_attr("xmlns:os-security-groups",
                            "http://docs.openstack.org/compute/ext/"
                            "securitygroups/api/v3")
            secgroups = Element("os-security-groups:security_groups")
            server.append(secgroups)
            for secgroup in kwargs['security_groups']:
                s = Element("security_group", name=secgroup['name'])
                secgroups.append(s)

        if 'networks' in kwargs:
            networks = Element("networks")
            server.append(networks)
            for network in kwargs['networks']:
                s = Element("network", uuid=network['uuid'],
                            fixed_ip=network['fixed_ip'])
                networks.append(s)

        if 'meta' in kwargs:
            metadata = Element("metadata")
            server.append(metadata)
            for k, v in kwargs['meta'].items():
                meta = Element("meta", key=k)
                meta.append(Text(v))
                metadata.append(meta)

        resp, body = self.post('servers', str(Document(server)), self.headers)
        server = self._parse_server(etree.fromstring(body))
        return resp, server

        Creates an instance of a server.
        name (Required): The name of the server.
        image_ref (Required): Reference to the image used to build the server.
        flavor_ref (Required): The flavor used to build the server.
        Following optional keyword arguments are accepted:
        admin_password: Sets the initial root password.
        key_name: Key name of keypair that was created earlier.
        meta: A dictionary of values to be used as metadata.
        security_groups: A list of security group dicts.
        networks: A list of network dicts with UUID and fixed_ip.
        user_data: User data for instance.
        availability_zone: Availability zone in which to launch instance.
        access_ip_v4: The IPv4 access address for the server.
        access_ip_v6: The IPv6 access address for the server.
        min_count: Count of minimum number of instances to launch.
        max_count: Count of maximum number of instances to launch.
        disk_config: Determines if user or admin controls disk configuration.
        return_reservation_id: Enable/Disable the return of reservation id.
        
Creates an instance of a server.
name (Required): The name of the server.
image_ref (Required): Reference to the image used to build the server.
flavor_ref (Required): The flavor used to build the server.
Following optional keyword arguments are accepted:
admin_password: Sets the initial root password.
key_name: Key name of keypair that was created earlier.
meta: A dictionary of values to be used as metadata.
security_groups: A list of security group dicts.
networks: A list of network dicts with UUID and fixed_ip.
user_data: User data for instance.
availability_zone: Availability zone in which to launch instance.
access_ip_v4: The IPv4 access address for the server.
access_ip_v6: The IPv6 access address for the server.
min_count: Count of minimum number of instances to launch.
max_count: Count of maximum number of instances to launch.
disk_config: Determines if user or admin controls disk configuration.
return_reservation_id: Enable/Disable the return of reservation id.
Creates an instance of a server . name ( Required ) : The name of the server . image_ref ( Required ) : Reference to the image used to build the server . flavor_ref ( Required ) : The flavor used to build the server . Following optional keyword arguments are accepted : admin_password : Sets the initial root password . key_name : Key name of keypair that was created earlier . meta : A dictionary of values to be used as metadata . security_groups : A list of security group dicts . networks : A list of network dicts with UUID and fixed_ip . user_data : User data for instance . availability_zone : Availability zone in which to launch instance . access_ip_v4 : The IPv4 access address for the server . access_ip_v6 : The IPv6 access address for the server . min_count : Count of minimum number of instances to launch . max_count : Count of maximum number of instances to launch . disk_config : Determines if user or admin controls disk configuration . return_reservation_id : Enable / Disable the return of reservation id .
def create_server(self, name, image_ref, flavor_ref, **kwargs):
        server = Element("server",
                         xmlns=XMLNS_V3,
                         flavor_ref=flavor_ref,
                         image_ref=image_ref,
                         name=name)
        attrs = ["admin_password", "key_name",
                 ('os-access-ips:access_ip_v4',
                  'access_ip_v4',
                  'xmlns:os-access-ips',
                  "http://docs.openstack.org/compute/ext/"
                  "os-access-ips/api/v3"),
                 ('os-access-ips:access_ip_v6',
                  'access_ip_v6',
                  'xmlns:os-access-ips',
                  "http://docs.openstack.org/compute/ext/"
                  "os-access-ips/api/v3"),
                 ("os-user-data:user_data",
                  'user_data',
                  'xmlns:os-user-data',
                  "http://docs.openstack.org/compute/ext/userdata/api/v3"),
                 ("os-availability-zone:availability_zone",
                  'availability_zone',
                  'xmlns:os-availability-zone',
                  "http://docs.openstack.org/compute/ext/"
                  "availabilityzone/api/v3"),
                 ("os-multiple-create:min_count",
                  'min_count',
                  'xmlns:os-multiple-create',
                  "http://docs.openstack.org/compute/ext/"
                  "multiplecreate/api/v3"),
                 ("os-multiple-create:max_count",
                  'max_count',
                  'xmlns:os-multiple-create',
                  "http://docs.openstack.org/compute/ext/"
                  "multiplecreate/api/v3"),
                 ("os-multiple-create:return_reservation_id",
                  "return_reservation_id",
                  'xmlns:os-multiple-create',
                  "http://docs.openstack.org/compute/ext/"
                  "multiplecreate/api/v3"),
                 ("os-disk-config:disk_config",
                  "disk_config",
                  "xmlns:os-disk-config",
                  "http://docs.openstack.org/"
                  "compute/ext/disk_config/api/v3")]
        for attr in attrs:
            if isinstance(attr, tuple):
                post_param = attr[0]
                key = attr[1]
                value = kwargs.get(key)
                if value is not None:
                    server.add_attr(attr[2], attr[3])
                    server.add_attr(post_param, value)
            else:
                post_param = attr
                key = attr
                value = kwargs.get(key)
                if value is not None:
                    server.add_attr(post_param, value)
        if 'security_groups' in kwargs:
            server.add_attr("xmlns:os-security-groups",
                            "http://docs.openstack.org/compute/ext/"
                            "securitygroups/api/v3")
            secgroups = Element("os-security-groups:security_groups")
            server.append(secgroups)
            for secgroup in kwargs['security_groups']:
                s = Element("security_group", name=secgroup['name'])
                secgroups.append(s)
        if 'networks' in kwargs:
            networks = Element("networks")
            server.append(networks)
            for network in kwargs['networks']:
                s = Element("network", uuid=network['uuid'],
                            fixed_ip=network['fixed_ip'])
                networks.append(s)
        if 'meta' in kwargs:
            metadata = Element("metadata")
            server.append(metadata)
            for k, v in kwargs['meta'].items():
                meta = Element("meta", key=k)
                meta.append(Text(v))
                metadata.append(meta)
        resp, body = self.post('servers', str(Document(server)), self.headers)
        server = self._parse_server(etree.fromstring(body))
        return resp, server
def create_server ( self , name , image_ref , flavor_ref , ** kwargs ) : server = Element ( "server" , xmlns = XMLNS_V3 , flavor_ref = flavor_ref , image_ref = image_ref , name = name ) attrs = [ "admin_password" , "key_name" , ( 'os-access-ips:access_ip_v4' , 'access_ip_v4' , 'xmlns:os-access-ips' , "http://docs.openstack.org/compute/ext/" "os-access-ips/api/v3" ) , ( 'os-access-ips:access_ip_v6' , 'access_ip_v6' , 'xmlns:os-access-ips' , "http://docs.openstack.org/compute/ext/" "os-access-ips/api/v3" ) , ( "os-user-data:user_data" , 'user_data' , 'xmlns:os-user-data' , "http://docs.openstack.org/compute/ext/userdata/api/v3" ) , ( "os-availability-zone:availability_zone" , 'availability_zone' , 'xmlns:os-availability-zone' , "http://docs.openstack.org/compute/ext/" "availabilityzone/api/v3" ) , ( "os-multiple-create:min_count" , 'min_count' , 'xmlns:os-multiple-create' , "http://docs.openstack.org/compute/ext/" "multiplecreate/api/v3" ) , ( "os-multiple-create:max_count" , 'max_count' , 'xmlns:os-multiple-create' , "http://docs.openstack.org/compute/ext/" "multiplecreate/api/v3" ) , ( "os-multiple-create:return_reservation_id" , "return_reservation_id" , 'xmlns:os-multiple-create' , "http://docs.openstack.org/compute/ext/" "multiplecreate/api/v3" ) , ( "os-disk-config:disk_config" , "disk_config" , "xmlns:os-disk-config" , "http://docs.openstack.org/" "compute/ext/disk_config/api/v3" ) ] for attr in attrs : if isinstance ( attr , tuple ) : post_param = attr [ 0 ] key = attr [ 1 ] value = kwargs . get ( key ) if value is not None : server . add_attr ( attr [ 2 ] , attr [ 3 ] ) server . add_attr ( post_param , value ) else : post_param = attr key = attr value = kwargs . get ( key ) if value is not None : server . add_attr ( post_param , value ) if 'security_groups' in kwargs : server . add_attr ( "xmlns:os-security-groups" , "http://docs.openstack.org/compute/ext/" "securitygroups/api/v3" ) secgroups = Element ( "os-security-groups:security_groups" ) server . append ( secgroups ) for secgroup in kwargs [ 'security_groups' ] : s = Element ( "security_group" , name = secgroup [ 'name' ] ) secgroups . append ( s ) if 'networks' in kwargs : networks = Element ( "networks" ) server . append ( networks ) for network in kwargs [ 'networks' ] : s = Element ( "network" , uuid = network [ 'uuid' ] , fixed_ip = network [ 'fixed_ip' ] ) networks . append ( s ) if 'meta' in kwargs : metadata = Element ( "metadata" ) server . append ( metadata ) for k , v in kwargs [ 'meta' ] . items ( ) : meta = Element ( "meta" , key = k ) meta . append ( Text ( v ) ) metadata . append ( meta ) resp , body = self . post ( 'servers' , str ( Document ( server ) ) , self . headers ) server = self . _parse_server ( etree . fromstring ( body ) ) return resp , server
Creates an instance of a server.
Creates an instance of a server .
"""
        Creates an instance of a server.
        name (Required): The name of the server.
        image_ref (Required): Reference to the image used to build the server.
        flavor_ref (Required): The flavor used to build the server.
        Following optional keyword arguments are accepted:
        admin_password: Sets the initial root password.
        key_name: Key name of keypair that was created earlier.
        meta: A dictionary of values to be used as metadata.
        security_groups: A list of security group dicts.
        networks: A list of network dicts with UUID and fixed_ip.
        user_data: User data for instance.
        availability_zone: Availability zone in which to launch instance.
        access_ip_v4: The IPv4 access address for the server.
        access_ip_v6: The IPv6 access address for the server.
        min_count: Count of minimum number of instances to launch.
        max_count: Count of maximum number of instances to launch.
        disk_config: Determines if user or admin controls disk configuration.
        return_reservation_id: Enable/Disable the return of reservation id.
        """
self
name
image_ref
flavor_ref