-
Notifications
You must be signed in to change notification settings - Fork 913
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dougm
force-pushed
the
library-sync
branch
5 times, most recently
from
January 9, 2020 04:53
2dd96c2
to
9644b23
Compare
- 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
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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