Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SaveTopology Race Condition #60

Open
afallucc opened this issue Mar 30, 2020 · 3 comments
Open

SaveTopology Race Condition #60

afallucc opened this issue Mar 30, 2020 · 3 comments

Comments

@afallucc
Copy link

When saving topology at the same time among multiple devices, duplicate tasks are created causing the inability to execute those tasks. Is there a good way to be more selective on the save topology call so that the call is at the scope of a device or temp action and not the entire topology?

@hansbogert
Copy link

This would be really beneficial in our case as well. Since this is post from March 30, adding a super gentle nudge 😺 to @cheynearista

@hansbogert
Copy link

hansbogert commented Sep 20, 2021

@cheynearista is there a solution to this issue currently? If not, what would be needed in your opinion? Does CVP itself need to be changed to allow for more finegrained topology saving, or can we do this in this project/repository?

@cheynearista
Copy link
Contributor

cheynearista commented Sep 22, 2021

There are several issues (needing to be addressed) that build on each other:

  1. The solution will require us to modify SaveTopology(). Specifically:
reqResp, err := c.client.Post("/ztp/v2/saveTopology.do", nil, []string{})

Sending an empty list for the data implies executing all current temp actions. We would need to pass the tempAction data for the specific action desired to be executed into SaveTopology() for the above POST.

  1. Since we are not wanting to create the temp action, we must not call addTempAction(data) prior to SaveTopology(). As an example, ApplyConfigletsToDevice() calls addTempAction(data) prior to SaveTopology(). Instead we would need to pass the temp action data (for the specific action) into SaveTopology() (described above).

  2. Another issue is the data that we would now pass to SaveTopology() for a temp action is slightly different from the data currently passed to addTempAction(). Data format for temp action passed to SaveTopology (note: truncated data):

[
    "taskJson": [
          {
			Info: "some info",
			InfoPreview: "",
			Note: "some note",
			Action: "associate",
			NodeType: "configlet",
                        ...
          }
     ]
]

Data format (what we currently send) for temp action passed to addTempAction() for the same action as above (again...truncated data):

{
    "data": [
          {
			Info: "some info",
			InfoPreview: "",
			Note: "some note",
			Action: "associate",
			NodeType: "configlet",
                        ...
          }
    ]
}

There may be addition fields that should be set. I'll need to chase down these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants