def create_node(self, name, size, image, ex_metadata=None,
                    ex_vnc_password=None, ex_avoid=None, ex_vlan=None):
        is_installation_cd = self._is_installation_cd(image=image)

        if ex_vnc_password:
            vnc_password = ex_vnc_password
        else:
            # VNC password is not provided, generate a random one.
            vnc_password = get_secure_random_string(size=12)

        drive_name = '%s-drive' % (name)

        # size is specified in GB
        drive_size = (size.disk * 1024 * 1024 * 1024)

        if not is_installation_cd:
            # 1. Clone library drive so we can use it
            drive = self.ex_clone_drive(drive=image, name=drive_name)

            # Wait for drive clone to finish
            drive = self._wait_for_drive_state_transition(drive=drive,
                                                          state='unmounted')

            # 2. Resize drive to the desired disk size if the desired disk size
            # is larger than the cloned drive size.
            if drive_size > drive.size:
                drive = self.ex_resize_drive(drive=drive, size=drive_size)

            # Wait for drive resize to finish
            drive = self._wait_for_drive_state_transition(drive=drive,
                                                          state='unmounted')
        else:
            # No need to clone installation CDs
            drive = image

        # 3. Create server and attach cloned drive
        # ide 0:0
        data = {}
        data['name'] = name
        data['cpu'] = size.cpu
        data['mem'] = (size.ram * 1024 * 1024)
        data['vnc_password'] = vnc_password

        if ex_metadata:
            data['meta'] = ex_metadata

        # Assign 1 public interface (DHCP) to the node
        nic = {
            'boot_order': None,
            'ip_v4_conf': {
                'conf': 'dhcp',
            },
            'ip_v6_conf': None
        }

        nics = [nic]

        if ex_vlan:
            # Assign another interface for VLAN
            nic = {
                'boot_order': None,
                'ip_v4_conf': None,
                'ip_v6_conf': None,
                'vlan': ex_vlan
            }
            nics.append(nic)

        # Need to use IDE for installation CDs
        if is_installation_cd:
            device_type = 'ide'
        else:
            device_type = 'virtio'

        drive = {
            'boot_order': 1,
            'dev_channel': '0:0',
            'device': device_type,
            'drive': drive.id
        }

        drives = [drive]

        data['nics'] = nics
        data['drives'] = drives

        action = '/servers/'
        response = self.connection.request(action=action, method='POST',
                                           data=data)
        node = self._to_node(response.object['objects'][0])

        # 4. Start server
        self.ex_start_node(node=node, ex_avoid=ex_avoid)

        return node
Tests that the four possible ways of creating
dataset/ETHPy150Open apache/libcloud/libcloud/compute/drivers/cloudsigma.py/CloudSigma_2_0_NodeDriver.create_node--crossover with--dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/utils/tests/test_rng.py/test_np_rng