NAPI-348: CreateNic endpoint does not accept fabric NIC due to improper NIC tag validation

Details

Issue Type:Bug
Priority:4 - Normal
Status:Resolved
Created at:2016-03-16T22:29:01.000Z
Updated at:2019-05-02T18:06:43.196Z

People

Created by:angela.fong
Reported by:angela.fong
Assigned to:cody.mello

Resolution

Fixed: A fix for this issue is checked into the tree and tested.
(Resolution Date: 2017-02-08T03:01:47.000Z)

Fix Versions

2017-02-16 JAMAICA DECOY (Release Date: 2017-02-16)

Related Links

Description

This endpoint is used by net-agent when it syncs back missing napi records, as observed in OPS-1638. The nic tag validation logic has to be tweaked for fabric nics, like in the case of ZAPI-711.

Comments

Comment by Brian Bennett
Created at 2016-05-19T20:53:18.000Z
Updated at 2019-05-02T18:06:43.163Z

Work around for this provided by @cody.mello...

If the POST payload includes the network UUID, then the nic_tag can be omitted and the proper nic_tag will be filled in on the back end automatically.

E.g.:

This fails

[bbennett@headnode (us-east-1) ~]$ sdc-napi /nics -X POST -d '{
>   "belongs_to_type": "zone",
>   "belongs_to_uuid": "4ba7197c-3c26-c217-a623-f67912ca1116",
>   "mac": "90:b8:d0:2e:34:d6",
>   "owner_uuid": "21d6ac55-936f-4b12-880f-7b86a659d325",
>   "state": "running",
>   "ip": "192.168.128.10",
>   "gateway": "192.168.128.1",
>   "mtu": 8500,
>   "netmask": "255.255.252.0",
>   "nic_tag": "sdc_overlay/5303027",
>   "resolvers": [
>     "4.2.2.2",
>     "216.52.1.1"
>   ],
>   "vlan_id": 2,
>   "network_uuid": "2ac01850-5d41-4c25-bd1f-5bb0e4c4c5c3",
>   "cn_uuid": "44454c4c-4400-1032-804e-b5c04f383432"
> }
> '
HTTP/1.1 422 Unprocessable Entity
Content-Type: application/json
Content-Length: 151
Date: Thu, 19 May 2016 20:17:25 GMT
Server: SmartDataCenter Networking API
x-request-id: b3c15770-1dfe-11e6-aa59-f720d14ac582
x-response-time: 7
x-server-name: 8dc3ccc8-df38-4bef-9810-3a0b4d30de39
Connection: keep-alive

{
  "code": "InvalidParameters",
  "message": "Invalid parameters",
  "errors": [
    {
      "field": "nic_tag",
      "code": "InvalidParameter",
      "message": "nic tag does not exist"
    }
  ]
}

This succeeds

[bbennett@headnode (us-east-1) ~]$ sdc-napi /nics -X POST -d '{
>   "belongs_to_type": "zone",
>   "belongs_to_uuid": "4ba7197c-3c26-c217-a623-f67912ca1116",
>   "mac": "90:b8:d0:2e:34:d6",
>   "owner_uuid": "21d6ac55-936f-4b12-880f-7b86a659d325",
>   "state": "running",
>   "ip": "192.168.128.10",
>   "gateway": "192.168.128.1",
>   "mtu": 8500,
>   "netmask": "255.255.252.0",
>   "resolvers": [
>     "4.2.2.2",
>     "216.52.1.1"
>   ],
>   "vlan_id": 2,
>   "network_uuid": "2ac01850-5d41-4c25-bd1f-5bb0e4c4c5c3",
>   "cn_uuid": "44454c4c-4400-1032-804e-b5c04f383432"
> }
> '
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 525
Date: Thu, 19 May 2016 20:49:53 GMT
Server: SmartDataCenter Networking API
x-request-id: 3cc9c490-1e03-11e6-aa59-f720d14ac582
x-response-time: 65
x-server-name: 8dc3ccc8-df38-4bef-9810-3a0b4d30de39
Connection: keep-alive

{
  "belongs_to_type": "zone",
  "belongs_to_uuid": "4ba7197c-3c26-c217-a623-f67912ca1116",
  "mac": "90:b8:d0:2e:34:d6",
  "owner_uuid": "21d6ac55-936f-4b12-880f-7b86a659d325",
  "primary": false,
  "state": "running",
  "ip": "192.168.128.10",
  "fabric": true,
  "gateway": "192.168.128.1",
  "gateway_provisioned": true,
  "internet_nat": true,
  "mtu": 8500,
  "netmask": "255.255.252.0",
  "nic_tag": "sdc_overlay/5303027",
  "resolvers": [
    "4.2.2.2",
    "216.52.1.1"
  ],
  "vlan_id": 2,
  "network_uuid": "2ac01850-5d41-4c25-bd1f-5bb0e4c4c5c3",
  "cn_uuid": "44454c4c-4400-1032-804e-b5c04f383432"
}

Comment by jason.schmidt
Created at 2016-11-15T21:08:49.000Z

Hi @angela.fong,

We're talking about putting work-arounds into the migrator script to get around this so we are able to migrate instances off fabric networks and docker containers (I've built a script to handle nat zones using cody's notes which is separate from this). Just wanted to see what the estimated completion is on this bug before I figure out some logic to work around it, code it, test it, etc.....

Let me know. Thanks!

Jay


Comment by cody.mello
Created at 2016-11-15T21:36:15.000Z

@jason.schmidt I believe I have a fix for this, but I haven't fully tested it yet. I hope to have something soon, though.


Comment by jason.schmidt
Created at 2017-02-01T21:29:20.000Z

Hi @cody.mello,

Just wanted to check back and see where things were with this; having this functionality will enable us to migrate instances that are on fabric networks. Right now the rather painful process is to remove the fabric nic, migrate, and then re-add it.

Thanks!

Jay


Comment by bot
Created at 2017-02-08T03:01:36.000Z

sdc-napi commit 1d14fdb (branch master, by Cody Peter Mello)

NAPI-348 CreateNic endpoint does not accept fabric NIC due to improper NIC tag validation
Reviewed by: Alex Wilson <alex.wilson@joyent.com>
Approved by: Alex Wilson <alex.wilson@joyent.com>