27 Nov

Gathering Event Data from vCloud Director 10

Facebooktwitterredditlinkedinmail

Service Providers have long used the vCloud Director notification system to receive events from the system. These can be used to perform actions or to build an integration with a back-office billing system. The events are published on a RabbitMQ instance and can be consumed in any language that can bind with the message bus. One of the main issues with using this method for integration with the billing system is how to recover from missed notifications.

A new API was created in vCloud Director 10.0 to allow access to the events stream without needing to integrate with RabbitMQ and to allow for looking back at the event stream in the case of missing an event notification. The new API, auditTrail, lives in the vCloud Director cloudapi space. The documentation can be found here or by accessing the API Explorer within vCloud Director:

Direct Link: https://{VCD_URL}/api-explorer/provider#/auditTrail/queryAuditTrail

To access the data, do a GET call to: https://{{vcdAddress}}/cloudapi/1.0.0/auditTrail?page=1&pageSize=25

Headers:

  • accept: application/json;version=33.0
  • Authorization: Bearer {YOUR_TOKEN}

Note that page and pageSize are required to limit the returned data size.

The return will be in the format of:

{
"resultTotal": 1000,
"pageCount": 50,
"page": 1,
"pageSize": 25,
"associations": null,
"values": [{},]
}

You can then use the resultTotal and pageCount to walk through / process the entire data set.

In order to select a specific data set, the option parameters of filter, sortAsc and sortDesc can be added to the query.

The filter parameter accepts a FIQL format. Currently our timestamp filter is very strict and has to include all parts:

{date}T{time}{timezone-offset}

Example: 2019-10-01T06:23:00.836+00:00

Remember to URL encode the + to %2b

To retrieve all the events that happened in October 2019 I would use the filter:

filter=(timestamp=gt=2019-10-01T00:00:00.000%2b00:00;timestamp=lt=2019-11-01T00:00:00.000%2b00:00)

Full API call would look like:
https://{{vcdAddress}}/cloudapi/1.0.0/auditTrail?page=1&pageSize=25&sortAsc=timestamp&filter=(timestamp=gt=2019-10-01T00:00:00.000%2b00:00;timestamp=lt=2019-11-01T00:00:00.000%2b00:00)

Examples of Operators accepted:

Basic Operator Description
== Equal To
!= Not Equal To
=gt= Greater Than
=ge= Greater Or Equal To
=lt= Less Than
=le= Less Or Equal To

Besides timestamp you can also filter on a few other aspects of the data:

To filter out the completed events, I could add:

eventType!=com/vmware/vcloud/event/task/complete

The operatingOrg, user, and eventEntity are complex data types, but can be filtered based on the nested ID, but not Name.

"operatingOrg": {
"name": "acme",
"id": "urn:vcloud:org:742c7a82-d217-4b57-a316-49128c5c08a8"
},
"user": {
"name": "jdwyer",
"id": "urn:vcloud:user:dee585c6-8553-4913-bcd7-4555b678de65"
},
"eventEntity": {
"name": "attguy",
"id": "urn:vcloud:user:839a3af1-d23f-4371-842a-e8f5fbe9b7e4"
},

To filter based on only events for the “acme” organization I could do:

operatingOrg.id==urn:vcloud:org:742c7a82-d217-4b57-a316-49128c5c08a8

To filter out all the events by user “jdwyer”:

user.id!=urn:vcloud:user:dee585c6-8553-4913-bcd7-4555b678de65

Facebooktwitterredditlinkedinmail
11 Feb

What’s new for Virtual SAN 6.2?

Facebooktwitterredditlinkedinmail

What’s new for Virtual SAN 6.2?

What’s new for Virtual SAN 6.2?

Yes, finally… the Virtual SAN 6.2 release has just been announced. Needless to say, but I am very excited about this release. This is the release that I have personally been waiting for. Why? Well I think the list of new functionality will make that obvious. There are a couple of clear themes in this […] ” What’s new for Virtual SAN 6.2? ” originally appeared on Yellow-Bricks.com . Follow me on twitter – @DuncanYB.


VMware AdvocacyFacebooktwitterredditlinkedinmail

29 Apr

Nested ESXi in vCloud Air-Routed Edition

FacebooktwitterredditlinkedinmailOver the past 3 years I have spent a lot of time building and refining nested ESXi as part of my day job.  I worked for a large service provider at the time, and we developed our own portal on top of both the vSphere API as well as the vCloud Director API.  Nesting VMware products to enable multiple developers to build against the different API’s was a perfect use case for nested virtualization.  We really didn’t care about the lack of performance, we really only cared about having an API to build stuff (mostly just empty shell VMs, but sometimes small linux boxes to test networking).

I have recently been working on building a nested lab in vCloud Air. There was one well documented limitation of using vCloud Air, the fact that Promiscuous Mode & Forge Transmits was not enabled. Just recently there was an excellent article posted that described how to setup nested ESXi on vCloud Air, which included some great diagrams explaining why these settings are needed.  The article explains how to use a 1:1 mapping of nested VM MAC address to virtual ESXi MAC addresses. This is a great option for running one VM on a nested host, but he also hit on something I hadn’t thought of…running a router to give multiple VMs outbound network access. This was something I had to explore.

The Setup

vCloud Air SetupI wanted to make this as simple of an example as I could while trying to build out the above diagram from the VMware blog article. To do this I am just using an ESXi host and not a full vCenter setup.  This will come in another blog article.

One thing that was interesting was the use of a second port group on the vSwitch, I can see using this to keep things organized but the second port group isn’t really necessary.

I started in vCloud Air by build two VMs, an ESXi host and a windows box. I will use the windows VM to configure the network and test connectivity. Nested inside of my ESXi host I will create three VMs: a router and two Linux boxes.

From my Windows VM I download and setup the vSphere Client so I can configure the VMs I need directly on the ESXi host.

VyOS Setup (http://vyos.net/)

Build a shell Linux box:

  • 1 CPU
  • 512 MB RM
  • 2 GB Disk
  • Guest OS –  Other Linux 32Bit

Install VyOS:
Screen Shot 2015-04-29 at 5.30.44 PM
Boot from the disk (I downloaded the Virtual 32-bit version), it is a live CD, but we will install from here.

Default Login:

  • U: vyos
  • P: vyos

To Install:

From here I just accepted the defaults, finished the install and shutdown the VM.

Linux Test VMs

Screen Shot 2015-04-29 at 10.05.29 PMInstead of using another version of Linux to build my other two test VMs I ended up just making two more copies of the VyOS VM.  Now is a great time to point out that after the install VyOS was less then 225MB on disk. If you don’t turn on any of the networking features, its a nice small Linux box that I may use more often for a nested guest OS.

All three of these VMs are on the same default “VM Network” port group. We will add a second NIC to the VyOS-Router VM to act as the backend or inside network. To really show the example of how the routing will work I decided to use 10.10.10.0/24 for my inside network.  LinBox01 and LinBox02 have been configured with IP addresses on this network.

 

Configure VyOS-Router VM and Network

First we need to find the MAC address of our virtual ESXi host.

GetMac

Next we edit the MAC of the VyOS-Router VM to be the same MAC as the virtual ESXi host as well as add a second NIC on the same port group.

SetMAC_addNIC

Once the VM has been powered back on it is time to configure the network:

Login into the VM and execute:

Now we need to identify the interfaces:

showInterfaces
In my case the interface that I set the MAC on came up with eth2 so this will be my outside interface and eth1 will be my inside interface.

To configure the outside interface you execute:

And for my inside:

Now we commit our changes and save:

To check our work we run “show interfaces” again:

show interfaces

 Diagram Break

Now that we have completed the initial setup lets look at where we are:

NestedESXi-withRouter

It is important to note that all the NICs that are running on the nested VMs are connected to the same port group.

Who can talk to Who?

  • Inside of the nested ESXi host: LinBox01, LinBox02 and the VyOS-Router on the 10.10.10.0/24 network can ping.
  • Outside of the host: ESXi VM and WinBox can ping on the 192.168.2.0/24 network.
  • The WinBox can also ping the VyOS-Router box on 192.168.2.103 because we setup the correct MAC.

What is left is getting LinBox01 and LinBox02 to be able to pin WinBox. To do this we need to create a source NAT rule on the VyOS-Router box to allow pings to leave the 10.10.10.0/24 network.

From the VyOS-Router terminal:

Once this is in place LinBox01(10.10.10.11) and LinBox02(10.10.10.12) can ping the WinBox(192.168.2.102)

 

This is a very basic example, but gives quite a bit to build off.  I used this as a building block to build a full vSphere environment, and much more. Stay tuned for more info.Facebooktwitterredditlinkedinmail

01 Aug

More Minimal VM options

FacebooktwitterredditlinkedinmailHere are a few more great options for small test VMs:

  • https://coreos.com/ (http://www.virtuallyghetto.com/2014/07/how-to-quickly-deploy-coreos-on-esxi.html)
  • http://www.chromium.org/chromium-os
  • https://launchpad.net/cirros

Facebooktwitterredditlinkedinmail

20 Mar

vCenter Server Appliance(vCSA) as TFTP Server

FacebooktwitterredditlinkedinmailOne way to minimize the configuration of servers needed for the Auto Deploy infrastructure is to use the vCenter Server Appliance (vCSA) as the TFTP server.  Since Auto Deploy is built into the vCSA it has all the building blocks you need.

  1. Deploy your new vCSA
  2. Login and make sure all services are stopped (https://x.x.x.x:5480):
    vcsa-tftp-stop-services
  3. SSH into the vCSA:
  4. Start the TFTP service:
  5. Set chkconfig:
  6. Verify Changes:
  7. Your TFTP directory is located at /tftpboot/
    tftp-dir
  8. The directory already contains the necessary files for Auto Deploy( tramp file, undionly.kpxe.vmw-hardwired, etc) with the exception of the deploy-tftp.zip.   This needs to be downloaded from you vCenter Server and scp’d to here.

 

 Facebooktwitterredditlinkedinmail