'Defines the node before to create.
In Abiquo, you first need to \'register\' or \'define\' the node in
the API before to create it into the target hypervisor.'

def _define_create_node_node(self, group, **kwargs):

    vm = ET.Element('virtualMachine')
    if ('name' in kwargs):
        vmname = ET.SubElement(vm, 'label')
        vmname.text = kwargs['name']
    attrib = {'type': self.VMTPL_MIME_TYPE, 'rel': 'virtualmachinetemplate', 'href': kwargs['image'].extra['url']}
    ET.SubElement(vm, 'link', attrib=attrib)
    headers = {'Accept': self.NODE_MIME_TYPE, 'Content-type': self.NODE_MIME_TYPE}
    if ('size' in kwargs):
        ram = ET.SubElement(vm, 'ram')
        ram.text = str(kwargs['size'].ram)
    nodes_link = (group.uri + '/virtualmachines')
    vm = self.connection.request(nodes_link, data=tostring(vm), headers=headers, method='POST').object
    edit_vm = get_href(vm, 'edit')
    headers = {'Accept': self.NODE_MIME_TYPE}
    return self.connection.request(edit_vm, headers=headers).object
