Skip to content

How to run a managed object reference function? #3224

Answered by dougm
SomniVertix asked this question in Q&A
Discussion options

You must be logged in to vote

You can't use HostNetworkSystem with ContainerView

type - An optional list of managed entity types

Where managed entity is VirtualMachine, HostSystem, etc.

HostNetworkSystem is a property of HostConfigManager, which is a property of HostSystem. And HostSystem is managed entity.

The generated mo.HostNetworkSystem does have methods attached to it (likewise for other mo types), but you can use the object package to simplify fetching of the properties you need and invoking the method:

	simulator.Run(func(ctx context.Context, c *vim25.Client) error {
		m := view.NewManager(c)
		kind := []string{"HostSystem"}

		v, err := m.CreateContainerView(ctx, c.ServiceContent.RootFolder, []string{"HostS…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by SomniVertix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants