Investigate API error

Hello,

Is there any debug knob to switch on to get all the details about an API error.

I’am struggling to create a VMware service template with the API.

Either, I get a 400 error when calling the API. The json is not valid. The Service Model is not found.
Either, it succeeds but the service_template is READ ONLY.

Regards
Remi

I’ve narrowed down the issue.

This could be a bug.

I issue a POST with URL https://yyy.xxx.com/api/service_templates

The JSON data is:

{u’config_info’: {u’addr_mode’: [u’dhcp’, u’DHCP’],
u’catalog_id’: 2,
u’cluster_filter’: [None, None],
u’cores_per_socket’: [1, u’1’],
u’cpu_limit’: -1,
u’cpu_reserve’: 0,
u’current_tab_key’: u’environment’,
u’customize_enabled’: [u’enabled’],
u’description’: u’Centos 7_6’,
u’dialog_id’: 3,
u’disk_format’: [u’unchanged’, u’Default’],
u’display’: True,
u’dns_servers’: u’’,
u’dns_suffixes’: u’’,
u’ds_filter’: [None, None],
u’fqname’: u’/Service/Provisioning/StateMachines/ServiceProvision_Template/CatalogItemInitialization’,
u’gateway’: u’’,
u’host_filter’: [None, None],
u’initial_pass’: True,
u’ip_addr’: u’’,
u’ldap_ous’: [None, None],
u’linked_clone’: [None, None],
u’linux_domain_name’: u’yyy.xxx.com’,
u’linux_host_name’: ‘changeme’,
u’long_description’: u’Centos 7.6’,
u’memory_limit’: -1,
u’memory_reserve’: 0,
u’miq_request_dialog_name’: u’miq_provision_vmware_dialogs_template’,
u’name’: u’CENT 7_6’,
u’network_adapters’: [1, u’1’],
u’number_of_sockets’: [1, u’1’],
u’number_of_vms’: [1, u’1’],
u’placement_auto’: [True, 1],
u’provision’: {u’dialog_id’: 3,
u’fqname’: u’/Service/Provisioning/StateMachines/ServiceProvision_Template/CatalogItemInitialization’},
u’provision_type’: [u’vmware’, u’VMware’],
u’purpose_enabled’: [u’disabled’],
u’pxe_server_id’: [None, None],
u’reconfigure_fqname’: u’’,
u’requester_enabled’: [u’disabled’],
u’requester_group’: u’EvmGroup-super_administrator’,
u’retire_fqname’: u’/Service/Retirement/StateMachines/ServiceRetirement/Default’,
u’retirement’: {u’dialog_id’: None,
u’fqname’: u’/Service/Retirement/StateMachines/ServiceRetirement/Default’},
u’retirement_warn’: [604800, u’1 Week’],
u’rp_filter’: [None, None],
u’schedule_type’: [u’immediately’, u’Immediately on Approval’],
u’service_template_request’: True,
u’service_type’: u’atomic’,
u’snapshot’: [None, None],
u’src_ems_id’: [2, ‘vcenterZZZ.yyy.xxx.com’],
u’src_vm_id’: [24, ‘Centos-7-6_v1’],
u’src_vm_lans’: [u’MYVLAN_XXX’],
u’src_vm_nics’: [u’Network adapter 1’],
u’st_prov_type’: u’vmware’,
u’subnet_mask’: u’’,
u’sysprep_auto_logon’: [True, 1],
u’sysprep_auto_logon_count’: [1, u’1’],
u’sysprep_change_sid’: [True, 1],
u’sysprep_custom_spec’: [u’1’, u’set-hostname’],
u’sysprep_delete_accounts’: [False, 0],
u’sysprep_domain_name’: [None, None],
u’sysprep_enabled’: [u’fields’, u’Specification’],
u’sysprep_identification’: [u’domain’, u’Domain’],
u’sysprep_per_server_max_connections’: u’5’,
u’sysprep_server_license_mode’: [u’perServer’, u’Per server’],
u’sysprep_spec_override’: [True, 1],
u’sysprep_timezone’: [None, None],
u’sysprep_workgroup_name’: u’WORKGROUP’,
u’vlan’: [u’dvs_VLAN_XXX’, u’VLAN_XXX’],
u’vm_auto_start’: [False, 0],
u’vm_filter’: [None, None],
u’vm_memory’: [u’2048’, u’2048’],
u’vm_name’: u’changeme’,
u’vm_tags’: ,
u’wins_servers’: u’’},
u’deleted_on’: None,
u’description’: u’Centos 7_6’,
u’display’: True,
u’evm_owner_id’: None,
u’generic_subtype’: None,
u’internal’: False,
u’long_description’: u’Centos 7.6’,
u’miq_group_id’: 2,
u’name’: ‘TOTO’,
u’options’: {},
u’prov_type’: u’vmware’,
u’provision_cost’: None,
u’service_template_catalog_id’: 2,
u’service_template_id’: None,
u’service_type’: u’atomic’,
u’tenant_id’: 1,
u’type’: None,
‘zone_id’: 2}

If the above line u’src_vm_id’: [24, ‘Centos-7-6_v1’] is left, it fails with error:

Code: 400
{u’error’: {u’kind’: u’bad_request’,
u’klass’: u’Api::BadRequestError’,
u’message’: u’Could not create Service Template - Service Model not found’}}

If the above line u’src_vm_id’: [24, ‘Centos-7-6_v1’] is removed, it is successful. But the service_template is read only in the GUI and the 3rd tab (request info) is missing.

So I suspect that the src_vm_id is not visible.

This could be caused by the tenant_id, miq_group_id.
So I created a service template with the GUI and could compare the values used for tenant_id, miq_group_id. These are correct.

I would tend to say this is a bug.

Regards