TritonDataCenter / TritonDataCenter/sdc-cloudapi

GetNic Will return "not found" wrongly

Open
#32 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
8
Forks
22
Avg merge
3d 9h
Merged PRs (30d)
1

Description

While Extending https://github.com/terraform-providers/terraform-provider-triton to accept NetworkObjects I discovered some intermittent behavior here. I created the following test to demonstrate what was occuring.

The following test demonstrates:
A NIC is added to a newly created running Instance.
We begin polling for a state of "running"
We find the NIC that we added with the state of "provisioning" for awhile
The NIC is no longer found for awhile
We find the NIC that we added with the state of "running"

Test:

        inst, _ := c.Instances().Create(context.Background(), &compute.CreateInstanceInput{
                Name:    "Nic-test-5",
                Image:   "3dbbdcca-2eab-11e8-b925-23bf77789921",
                Package: "sample-2G",
        })

        for {
                running, _ := c.Instances().Get(context.Background(), &compute.GetInstanceInput{
                        ID: inst.ID,
                })

                if running.State == "running" {
                        break
                }

                time.Sleep(2 * time.Second)
        }

        nic, err := c.Instances().AddNIC(context.Background(), &compute.AddNICInput{
                InstanceID: inst.ID,
                NetworkObject: compute.NetworkObject{
                        IPv4UUID: "0a63f067-d721-435e-941a-724776d69c91",
                        //IPv4IPs:  []string{"10.1.1.58"},
                },
                //Network: "71a1abac-f003-4b51-ac63-28d37f2ef0af",
        })

        fmt.Println(nic, err)

        for {
                nicrunning, err := c.Instances().GetNIC(context.Background(), &compute.GetNICInput{
                        InstanceID: inst.ID,
                        MAC:        nic.MAC,
                })

                fmt.Println(nicrunning, err)

                if err == nil {
                        if nicrunning.State == "running" {
                                goto X
                                break
                        }
                }

                time.Sleep(1 * time.Second)
        }
X:
}

Result:

arch@archlinux ~/g/s/g/test ❯❯❯ go run main.go                                                                                        ✘ 1
&{10.1.1.91 90:b8:d0:81:68:21 false 255.255.255.0 10.1.1.1 provisioning 0a63f067-d721-435e-941a-724776d69c91} <nil>
&{10.1.1.91 90:b8:d0:81:68:21 false 255.255.255.0 10.1.1.1 provisioning 0a63f067-d721-435e-941a-724776d69c91} <nil>
&{10.1.1.91 90:b8:d0:81:68:21 false 255.255.255.0 10.1.1.1 provisioning 0a63f067-d721-435e-941a-724776d69c91} <nil>
&{10.1.1.91 90:b8:d0:81:68:21 false 255.255.255.0 10.1.1.1 provisioning 0a63f067-d721-435e-941a-724776d69c91} <nil>
&{10.1.1.91 90:b8:d0:81:68:21 false 255.255.255.0 10.1.1.1 provisioning 0a63f067-d721-435e-941a-724776d69c91} <nil>
&{10.1.1.91 90:b8:d0:81:68:21 false 255.255.255.0 10.1.1.1 provisioning 0a63f067-d721-435e-941a-724776d69c91} <nil>
&{10.1.1.91 90:b8:d0:81:68:21 false 255.255.255.0 10.1.1.1 provisioning 0a63f067-d721-435e-941a-724776d69c91} <nil>
&{10.1.1.91 90:b8:d0:81:68:21 false 255.255.255.0 10.1.1.1 provisioning 0a63f067-d721-435e-941a-724776d69c91} <nil>
&{10.1.1.91 90:b8:d0:81:68:21 false 255.255.255.0 10.1.1.1 provisioning 0a63f067-d721-435e-941a-724776d69c91} <nil>
&{10.1.1.91 90:b8:d0:81:68:21 false 255.255.255.0 10.1.1.1 provisioning 0a63f067-d721-435e-941a-724776d69c91} <nil>
&{10.1.1.91 90:b8:d0:81:68:21 false 255.255.255.0 10.1.1.1 provisioning 0a63f067-d721-435e-941a-724776d69c91} <nil>
&{10.1.1.91 90:b8:d0:81:68:21 false 255.255.255.0 10.1.1.1 provisioning 0a63f067-d721-435e-941a-724776d69c91} <nil>
&{10.1.1.91 90:b8:d0:81:68:21 false 255.255.255.0 10.1.1.1 provisioning 0a63f067-d721-435e-941a-724776d69c91} <nil>
&{10.1.1.91 90:b8:d0:81:68:21 false 255.255.255.0 10.1.1.1 provisioning 0a63f067-d721-435e-941a-724776d69c91} <nil>
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
<nil> unable to get machine NIC: ResourceNotFound: nic not found
&{10.1.1.91 90:b8:d0:81:68:21 false 255.255.255.0 10.1.1.1 running 0a63f067-d721-435e-941a-724776d69c91} <nil>

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the GetNIC entry point exercised by the supplied Go reproduction, alongside AddNIC and the polling sequence shown in the issue. Reproduce the provisioning transition and trace the temporary ResourceNotFound response; done means GetNIC no longer reports a misleading not-found result while the NIC is provisioning and the demonstrated test passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, javascript
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.