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

Add Content Library synchronization support #1770

Merged
merged 1 commit into from
Jan 10, 2020
Merged

Conversation

dougm
Copy link
Member

@dougm dougm commented Jan 3, 2020

  • vAPI: add sync client APIs

  • vAPI: add helpers to sync subscribed library OVF items to local library VMTX items

  • vcsim: support sync APIs

  • govc: add library.sync command

- vAPI: add sync client APIs

- vAPI: add helpers to sync subscribed library OVF items to local library VMTX items

- vcsim: support sync APIs

- govc: add library.sync command
@dougm dougm merged commit 49f08c0 into vmware:master Jan 10, 2020
@dougm dougm deleted the library-sync branch January 10, 2020 04:27
dekp added a commit to dekp/govmomi that referenced this pull request Sep 12, 2023
Store data sets as a field in `simulator.VirtualMachine`:
Data sets have only a REST API, they do not appear in the VIM API.
However, a data set can be copied during a VM clone or snapshot,
depending on the settings (see `dataset.CreateSpec.OmitFromSnapshotAndClone`).
Clone and snapshot are VIM operations, implemented in `simulator.VirtualMachine`,
so it seems more natural to keep data sets in `simulator.VirtualMachine`
and access them from the code in the vapi simulator.

Extract the simulation code for REST APIs under `/api/vcenter/vm`
into its own sub-simulator:
Data set request paths look like this:
`/api/vcenter/vm/{moid}/data-sets/{id}`
Currently vcsim routes API requests via the standard http.ServeMux.
However, http.ServeMux does not support placeholders
in the middle of the URL path (e.g. VM moid, data set id).
So create a separate sub-simulator for everything under `/api/vcenter/vm`.
Now it contains only delete VM (see vmware#1770)
and the data sets API.
In order to get a lock on a `simulator.VirtualMachine`,
had to create a `simulator.Context` similar to `SpoofContext()`
but using the `simulator.Registry` received during initialization.

Inside the new sub-simulator for `/api/vcenter/vm`,
API requests are routed via analyzing the URL path segment by segment:
As mentioned above, http.ServeMux cannot handle placeholders.
Here I have done routing in code.
An alternative would be to use a third-party library for request routing
like `go-chi` or even a home-grown regex table or a radix tree.
Potentially the main vapi simulator could allow sub-simulators
to register for paths with placeholders.
See also
https://github.com/vmware/govmomi/blob/e7aac6ad473846f6a1f5bf10c524ac5a8f93022d/vapi/simulator/simulator.go#L2084

Closes: vmware#3050
@dekp dekp mentioned this pull request Sep 12, 2023
14 tasks
dekp added a commit to dekp/govmomi that referenced this pull request Sep 12, 2023
Store data sets as a field in `simulator.VirtualMachine`, because a data set
can be copied during a VM clone or snapshot
(see dataset.CreateSpec.OmitFromSnapshotAndClone).
Clone and snapshot are implemented in simulator.VirtualMachine, so it seems
more natural to keep data sets in simulator.VirtualMachine and access them from
the code in the vapi simulator.

Extract the simulation code for REST APIs under `/api/vcenter/vm` into its own
sub-simulator:
Data set request paths look like this:
`/api/vcenter/vm/{moid}/data-sets/{id}`
Currently vcsim routes API requests via the standard http.ServeMux.
However, http.ServeMux does not support placeholders in the middle of the URL
path (e.g. VM moid, data set id).
So create a separate sub-simulator for everything under `/api/vcenter/vm`.
At the moment it contains only delete VM
(see vmware#1770)
and the data sets API.

Inside the new sub-simulator for `/api/vcenter/vm`, API requests are routed via
analyzing the URL path segment by segment:
As mentioned above, http.ServeMux cannot handle placeholders.
Here I have done routing in code.
An alternative would be to use a third-party library for request routing like
`go-chi` or even a home-grown regex table or a radix tree.
Potentially the main vapi simulator could allow sub-simulators to register for
paths with placeholders.
See also notes at:
https://github.com/vmware/govmomi/blob/e7aac6ad473846f6a1f5bf10c524ac5a8f93022d/vapi/simulator/simulator.go#L2084

In order to get a lock on a `simulator.VirtualMachine`,
had to create a `simulator.Context` similar to `SpoofContext()`
but using the `simulator.Registry` received during initialization.

Closes: vmware#3050
dekp added a commit to dekp/govmomi that referenced this pull request Sep 15, 2023
Store data sets as a field in `simulator.VirtualMachine`, because a data set
can be copied during a VM clone or snapshot
(see dataset.CreateSpec.OmitFromSnapshotAndClone).
Clone and snapshot are implemented in simulator.VirtualMachine, so it seems
more natural to keep data sets in simulator.VirtualMachine and access them from
the code in the vapi simulator.

Extract the simulation code for REST APIs under `/api/vcenter/vm` into its own
sub-simulator:
Data set request paths look like this:
`/api/vcenter/vm/{moid}/data-sets/{id}`
Currently vcsim routes API requests via the standard http.ServeMux.
However, http.ServeMux does not support placeholders in the middle of the URL
path (e.g. VM moid, data set id).
So create a separate sub-simulator for everything under `/api/vcenter/vm`.
At the moment it contains only delete VM
(see vmware#1770)
and the data sets API.

Inside the new sub-simulator for `/api/vcenter/vm`, API requests are routed via
analyzing the URL path segment by segment:
As mentioned above, http.ServeMux cannot handle placeholders.
Here I have done routing in code.
An alternative would be to use a third-party library for request routing like
`go-chi` or even a home-grown regex table or a radix tree.
Potentially the main vapi simulator could allow sub-simulators to register for
paths with placeholders.
See also notes at:
https://github.com/vmware/govmomi/blob/e7aac6ad473846f6a1f5bf10c524ac5a8f93022d/vapi/simulator/simulator.go#L2084

In order to get a lock on a `simulator.VirtualMachine`,
had to create a `simulator.Context` similar to `SpoofContext()`
but using the `simulator.Registry` received during initialization.

Closes: vmware#3050
priyanka19-98 pushed a commit to priyanka19-98/govmomi that referenced this pull request Jan 17, 2024
Store data sets as a field in `simulator.VirtualMachine`, because a data set
can be copied during a VM clone or snapshot
(see dataset.CreateSpec.OmitFromSnapshotAndClone).
Clone and snapshot are implemented in simulator.VirtualMachine, so it seems
more natural to keep data sets in simulator.VirtualMachine and access them from
the code in the vapi simulator.

Extract the simulation code for REST APIs under `/api/vcenter/vm` into its own
sub-simulator:
Data set request paths look like this:
`/api/vcenter/vm/{moid}/data-sets/{id}`
Currently vcsim routes API requests via the standard http.ServeMux.
However, http.ServeMux does not support placeholders in the middle of the URL
path (e.g. VM moid, data set id).
So create a separate sub-simulator for everything under `/api/vcenter/vm`.
At the moment it contains only delete VM
(see vmware#1770)
and the data sets API.

Inside the new sub-simulator for `/api/vcenter/vm`, API requests are routed via
analyzing the URL path segment by segment:
As mentioned above, http.ServeMux cannot handle placeholders.
Here I have done routing in code.
An alternative would be to use a third-party library for request routing like
`go-chi` or even a home-grown regex table or a radix tree.
Potentially the main vapi simulator could allow sub-simulators to register for
paths with placeholders.
See also notes at:
https://github.com/vmware/govmomi/blob/e7aac6ad473846f6a1f5bf10c524ac5a8f93022d/vapi/simulator/simulator.go#L2084

In order to get a lock on a `simulator.VirtualMachine`,
had to create a `simulator.Context` similar to `SpoofContext()`
but using the `simulator.Registry` received during initialization.

Closes: vmware#3050
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants