ZAPI-816: vmapi should pre provision nics

Resolution

Fixed: A fix for this issue is checked into the tree and tested.
(Resolution Date: 2017-12-29T17:08:51.795Z)

Fix Versions

2018-01-04 Icicle Inn (Release Date: 2018-01-04)

Related Links

Description

As a part of the RFD-107 work users will be able to pass in a requested IP address into cloudapi.  While testing this logic I discovered that if you pass in an IP that's already allocated then you will get back a 200 from cloudapi but the provision workflow will fail.  This sucks from an end user's point of view.

 

In order to better handle this, the provisioning of the nic(s) needs to happen before the workflow is kicked off.  In the case of fabric networks we need to take a few extra steps.  In chat we decided on the following:
1) Provision the NICs in state "provisioning" before the workflow, with a temporary fake server UUID
2) Launch workflow
3) Talk to DAPI, and determine server_uuid
4) Update cn_uuid field to the new UUID
5) Talk to cn-agent, and do provision
6) Update state to "running{noformat}

Comments

Comment by Michael Zeller
Created at 2017-12-28T18:14:11.192Z
For testing I added some tests to vmapi.  I then ran both vmapi's and cloudapi's test suites to exercise multiple code paths.

 

In addition I ran some sdc-vmapi calls manually with custom json payloads to verify the following:
 

The new cloudapi tests also exercise adding a nic with an ip and creating a machine with a specific IP.

Comment by Michael Zeller
Created at 2017-12-28T18:30:00.147Z
I should also add that I verified fabric nat networks were being created for networks that lacked them.  I verified by logging in that I could also ping across those networks ensuring the cn_uuid fields were populated correctly.

Comment by Jira Bot
Created at 2017-12-29T16:51:23.938Z
sdc-vmapi commit 6cc90e2ccb949bfafd34fb4272acb54ed1e910ff (branch master, by Mike Zeller)

ZAPI-816 vmapi should pre provision nics
ZAPI-765 Adding a fabric NIC to a VM doesn't provision a fabric NAT
Reviewed by: Cody Peter Mello <cody.mello@joyent.com>
Approved by: Cody Peter Mello <cody.mello@joyent.com>