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

[WIP] Add notes running vmware simulator #532

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions providers/vmware_simulator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# installing vmware simulator
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need an introduction of some sort.

Suggested change
# installing vmware simulator
# VMware Simulator
This guide explains general usage of the VMware simulator, `vcsim`. This simulator can be used when developing the VMware provider.
## Installing VMware Simulator

Copy link
Member

@Fryguy Fryguy Dec 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note the title case change at the end too.


```bash
cd ~/go/
git clone https://github.com/kbrock/govmomi
cd govmomi
git remote add upstream https://github.com/vmware/govmomi
git checkout miq_counters_kb
Comment on lines +5 to +8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be linking a personal fork/branch in the guides? Is this a missing feature on upstream?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed. we can now use master now that this is all merged

# client
pushd govc ; make clean && make && make install ; popd
# server
pushd vcsim ; make clean && make && make install ; popd
ln -s ~/go/bin/vcsim ~/bin # or /usr/local/bin
ln -s ~/go/bin/govc ~/bin # or /usr/local/bin
Comment on lines +13 to +14
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personal preference, so not required for merge, but this format always messes with my head cause it makes me think the entire bin dir is going to be pointing to the target. I like it more explicit...something like:

Suggested change
ln -s ~/go/bin/vcsim ~/bin # or /usr/local/bin
ln -s ~/go/bin/govc ~/bin # or /usr/local/bin
ln -s ~/go/bin/vcsim ~/bin/vcsim # or /usr/local/bin/vcsim
ln -s ~/go/bin/govc ~/bin/govc # or /usr/local/bin/govc

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it make more sense to either change your GOPATH or add ~/go/bin/ to your PATH?

```

# creating simulator provider
Copy link
Member

@Fryguy Fryguy Dec 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# creating simulator provider
## Generating data for a simulated provider


```bash
echo "127.0.0.1 vc91" > /etc/hosts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? You can just use localhost or 127.0.0.1 when adding the provider

(I know you were trying to avoid hostname collisions with >1 vcsim but that's also more advanced than the typical UI dev will need)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the end of the day, vc91 (even if in /etc/hosts) was freaking out, so I just use localhost.


# run temporary simulator
vcsim -username root -password vmware -app 2 -cluster 2 -dc 1 -ds 2 -folder 2 \
-host 2 -nsx 2 -pg 2 -pg-nsx 2 -pod 2 -pool 1 -standalone-host 2 -vm 2 \
-l vc91:9191 &
Comment on lines +23 to +25
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why run in the backround? Seems much simpler to leave it running in the foreground and let people ctrl-c to exit than telling them to do kill %1 later

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's run in the background so it can be dumped to a directory in the next step. Then it can be reused in future runs of the simulator.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made a few comments around this to beef up the comments/titles, which would make that clearer.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right but that's only necessary so that you can hack in historical metrics, for normal vcsim running it isn't needed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is all moot now. vcsim out of the box properly creates those entries

Comment on lines +23 to +25
Copy link
Member

@Fryguy Fryguy Dec 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not required, but I tend to find guides more readable if they are one param per line (at least for very long sets of options). It also allows easier modification for things like removing lines.

Suggested change
vcsim -username root -password vmware -app 2 -cluster 2 -dc 1 -ds 2 -folder 2 \
-host 2 -nsx 2 -pg 2 -pg-nsx 2 -pod 2 -pool 1 -standalone-host 2 -vm 2 \
-l vc91:9191 &
vcsim \
-username root \
-password vmware \
-app 2 \
-cluster 2 \
-dc 1 \
-ds 2 \
-folder 2 \
-host 2 \
-nsx 2 \
-pg 2 \
-pg-nsx 2 \
-pod 2 \
-pool 1 \
-standalone-host 2 \
-vm 2 \
-l vc91:9191 &


export GOVC_URL=https://root:vmware@vc91:9191/sdk GOVC_INSECURE=true
govc object.save -d my-vcenter
Comment on lines +27 to +28
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export GOVC_URL=https://root:vmware@vc91:9191/sdk GOVC_INSECURE=true
govc object.save -d my-vcenter
# dump simulator contents to a directory for later reuse
export GOVC_URL=https://root:vmware@vc91:9191/sdk GOVC_INSECURE=true
govc object.save -d my-vcenter

# stop stop temporary simulator
Copy link
Member

@Fryguy Fryguy Dec 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# stop stop temporary simulator
# stop temporary simulator

kill %1 # or fg ; control-c
```

# adding historicals
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking this should be another level deep under the "Running a simulator"

Suggested change
# adding historicals
### Including historical metrics data


```xml
<!--
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<!--
<!--

edit my-vcenter/0009-PerformanceManager-PerfMgr.xml
find nistoricalInterval
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
find nistoricalInterval
find historicalInterval

-->
<propSet>
<name>historicalInterval</name>
<val xmlns:XMLSchema-instance="http://www.w3.org/2001/XMLSchema-instance" XMLSchema-instance:type="ArrayOfPerfInterval">
<PerfInterval>
<key>1</key>,
<samplingPeriod>300</samplingPeriod>
<length>86400</length>
<name>Past Day</name>
<level>1</level>
<enabled>true</enabled>
</PerfInterval>
<PerfInterval>
<key>2</key>
<samplingPeriod>1800</samplingPeriod>
<length>604800</length>
<name>Past Week</name>
<level>1</level>
<enabled>true</enabled>
</PerfInterval>
<PerfInterval>
<key>3</key>
<samplingPeriod>7200</samplingPeriod>
<length>2592000</length>
<name>Past Month</name>
<level>1</level>
<enabled>true</enabled>
</PerfInterval>
<PerfInterval>
<key>4</key>
<samplingPeriod>86400</samplingPeriod>
<length>31536000</length>
<name>Past Year</name>
<level>1</level>
<enabled>true</enabled>
</PerfInterval>
</val>
</propSet>
```
# better editing of historicals
Copy link
Member

@Fryguy Fryguy Dec 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what this title means - feels like this is part of the previous section, so thinking it should just be removed. The TODO also make it clear of the intentions.

Suggested change
# better editing of historicals


TODO: please figure out a way to add historicals without editing the files.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
TODO: please figure out a way to add historicals without editing the files.
TODO: Figure out a way to add historicals without editing the files.

That way we can just use the vmware simulator container

```bash
govc object.collect -s -dump PerformanceManager:PerfMgr historicalInterval
govc metric.interval.info

govc metric.interval.change

# this one has a default (not sure if related or not)
govc object.collect -s -dump PerformanceManager:PerfMgr perfCounter
```

# run
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# run
## Running the simulated provider from the generated data


```bash
# I dumped to a local directory to add historical capture support
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's try to make the doc less of a brain dump and more of a guide to others. I'm not sure what this is supposed to me as an outside reader.

vcsim -username root -password vmware -load my-vcenter -l vc91:9191
```