What triggers the prompt to ask server? #3343
Replies: 5 comments 1 reply
-
Assuming that each compute had the same custom template imported, there is one major problem. They cannot have the same name across multiple computes. In the current build, I do not believe there is a way to handle what you are looking for. This would require some abstraction and a completely different concept for how templates and their respective images are handled. |
Beta Was this translation helpful? Give feedback.
-
Makes sad ansible templating syncing code sounds @grossmj Any input on this? I was in the middle of writing a ansible script to duplicate templates from the main node to the remotes. Having x*remotes templates for a single template doesn't seem optimal. I'd almost say they aren't worth using with remote servers if that's the only case. Unless I'm thinking about this wrong.. can I use the template thats on the main server do deploy a VM on a remote by changing the compute_id field? I'm looking up the endpoint APIs so i might answer this myself shortly. |
Beta Was this translation helpful? Give feedback.
-
That didn't work, see below. I see this note on the template endpoint API
I tried removing the compute_id from a template a few times and this made GNS3 very angry. I also tried settting compute_id to false. I'll poke around with that and see what happens. This is what happens when I deploy a template located on compute01 with a target compute_id of "compute02". gns3@compute01:~/GNS3/projects$ curl --no-progress-meter 'http://127.0.0.1:3080/v2/computes' | egrep name|compute_id
compute_id: local,
name: compute01,
compute_id: 434e7036-e53e-459f-8349-bc160353b4b9,
name: backup,
compute_id: 7ef6b499-b732-40e4-b283-5b6d158e2ed0,
name: compute02,
gns3@compute01:~/GNS3/projects$
gns3@compute01:~/GNS3/projects$ curl -X POST --no-progress-meter 'http://127.0.0.1:3080/v2/projects/a9e814b9-6572-4d3a-8e84-7fc63cd109d1/templates/c37e1c8d-d7dc-4c41-989e-67b36396f29f' -d '{x: 12, y: 42,compute_id: 7ef6b499-b732-40e4-b283-5b6d158e2ed0}' | egrep compute_id
compute_id: local,
gns3@compute01:~/GNS3/projects$ |
Beta Was this translation helpful? Give feedback.
-
Maybe this should be a bug report? I created a template based on a switch and set compute_id to null (not "null") and then tried to send compute_id. After stop/restart of server and gui i'm now asked which server do I want the template on. After picking a server I get
If I try from curl I get the same error, so i think the but is with the template endpoint API. gns3@compute01:~/.config/GNS3/2.2$ curl -X POST 'http://127.0.0.1:3080/v2/projects/cb65dac2-ad5b-47b0-bc3c-08db2991f1b3/templates/b43f7082-57e2-4363-ae41-6a4714b3509e' -d '{"x": 12, "y": 42, "compute_id": "7ef6b499-b732-40e4-b283-5b6d158e2ed0"}'
{
"message": "Compute ID None doesn't exist",
"status": 404
}
gns3@compute01:~/.config/GNS3/2.2$ Here is the template I created. I'm not showing all the ports, i just figured 7 or so wasn't useful. {
"builtin": false,
"category": "switch",
"compute_id": null,
"console_type": "none",
"default_name_format": "Switch{0}",
"name": "Ethernet switchSpec",
"ports_mapping": [
{
"ethertype": "",
"name": "Ethernet0",
"port_number": 0,
"type": "access",
"vlan": 1
},
],
"symbol": ":/symbols/ethernet_switch.svg",
"template_id": "b43f7082-57e2-4363-ae41-6a4714b3509e",
"template_type": "ethernet_switch"
}, |
Beta Was this translation helpful? Give feedback.
-
Ok, in my continued quest for this I created a pull request. This makes the /v2/project/{project_id}/template/{template_id} api call accept compute_id when passed in a json request to drop a new node. I also updated api template handler to not remove compute_id from an update request to /v2/template/{template_id}. This way I can convert all my custom template compute IDs to null. The GUI is now asking me which server I want to drop any template on. NOTE: This also breaks the fat client's ability to see disk images when configuring a template since all my templates are null. An interesting thing I just found out. If the main server detects the remote server is missing the hard drive image for a given template it will automagically upload it. Who knew! Here is my pull request Here is the ansible role code I used to update all my templates (roles/update-compute-ids-to-null/tasks/main.yml). I'm using auth, if you aren't just comment out the url_password and url_username. - name: Get all templates in json format
uri:
url: 'http://127.0.0.1:3080/v2/templates'
url_password: "{{ gns3_password }}"
url_username: "{{ gns3_username }}"
return_content: yes
body_format: json
force_basic_auth: yes
register: templates
- name: Loop through all none builtin templates and set compute_id to null via merge.
uri:
url: "{{ 'http://127.0.0.1:3080/v2/templates/' + item.template_id }}"
url_password: "{{ gns3_password }}"
url_username: "{{ gns3_username }}"
method: PUT
body: "{{ item }}"
force_basic_auth: yes
body_format: json
loop: "{{ templates.json | json_query('[*].merge(@, {compute_id: null}) | [?builtin == `false` ]') }}" |
Beta Was this translation helpful? Give feedback.
-
I have 3 gns3 boxes setup. I connect to the main and the other 2 are configured as remote servers.
If I drop a builtin deivces (switch or cloud) i'm asked which server do I want this to go on?
For any custom template it simply gets dropped on the main server. What do I need to do to get GNS3 to prompt for the custom devices (mostly qemu if that matters)?
Beta Was this translation helpful? Give feedback.
All reactions