'Create a new server.
Server creation consists multiple steps depending on the type of the
image used.
1. Installation CD:
1. Create a server and attach installation cd
2. Start a server
2. Pre-installed image:
1. Clone provided library drive so we can use it
2. Resize cloned drive to the desired size
3. Create a server and attach cloned drive
4. Start a server
:param ex_metadata: Key / value pairs to associate with the
created node. (optional)
:type ex_metadata: ``dict``
:param ex_vnc_password: Password to use for VNC access. If not
provided, random password is generated.
:type ex_vnc_password: ``str``
:param ex_avoid: A list of server UUIDs to avoid when starting this
node. (optional)
:type ex_avoid: ``list``
:param ex_vlan: Optional UUID of a VLAN network to use. If specified,
server will have two nics assigned - 1 with a public ip
and 1 with the provided VLAN.
:type ex_vlan: ``str``'

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 = get_secure_random_string(size=12)
    drive_name = ('%s-drive' % name)
    drive_size = (((size.disk * 1024) * 1024) * 1024)
    if (not is_installation_cd):
        drive = self.ex_clone_drive(drive=image, name=drive_name)
        drive = self._wait_for_drive_state_transition(drive=drive, state='unmounted')
        if (drive_size > drive.size):
            drive = self.ex_resize_drive(drive=drive, size=drive_size)
        drive = self._wait_for_drive_state_transition(drive=drive, state='unmounted')
    else:
        drive = image
    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
    nic = {'boot_order': None, 'ip_v4_conf': {'conf': 'dhcp'}, 'ip_v6_conf': None}
    nics = [nic]
    if ex_vlan:
        nic = {'boot_order': None, 'ip_v4_conf': None, 'ip_v6_conf': None, 'vlan': ex_vlan}
        nics.append(nic)
    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])
    self.ex_start_node(node=node, ex_avoid=ex_avoid)
    return node
