📜 ⬆️ ⬇️

vSphereTools: How we created an open source automation tool for vSphere



In our blog on Habré, we talk a lot about the implementation of DevOps approaches and the tools for automating development and testing that we developed. Today we will talk about how we solved the problem of interaction with VMware vSphere.

A bit of history


All our virtual machines run in vSphere, both build and test servers.
')
A couple of years ago, before the advent of our own Continuous Integration system, most of our builds were moved to the TeamCity tool. At that time, we didn’t have test and deployment configurations, but the need for their development was becoming increasingly apparent.

In mid-2014, we knew two solutions for automating virtual machines: using our own VMware API for working with vSphere (the VIX API library) and using the pysphere library. Each of these tools had flaws.

The VIX API was too high for us to enter:


The pysphere library in general was actually undocumented and with a number of problems:


However, if you compare pysphere with the VIX API, then the first one also had its advantages:


Therefore, it was decided to use this library and create its own solution based on it.

VSphereTools project


Before starting to program, we made up the requirements for a set of automation tools.


The conceptual model of the interaction of vSphereTools with the Sphere itself is presented below:



Everything is quite simple: the initiator, which can be a user or a script, sends commands received via the command line to the vSphereTools tool, which forwards the data to the pysphere library. Then the request goes to the vSphere, where it is processed and sent to the virtual machine, which gives us what we need ("steits", attributes, etc.)

The environmental requirements for vSphereTools were minimal:


Full documentation with examples is available in the open community DevOpsHQ . As a result, vSphereTools scripts implement many functions from starting and stopping virtual machines to copying a local file into the desired virtual machine or running a specific program on it.

Currently, vSphereTools metranners and scripts are used in the development and testing of practically all major Positive Technologies products — for example, MaxPatrol SIEM , PT Application Firewall and Application Inspector, and in many other projects.

Restrictions and possible improvements


Like any tool, our vSphereTools product has its limitations:


Therefore, we are planning a number of improvements. For example, we want to rewrite vSphereTools on the VMware vCloud Suite SDK for Python for vSphere 6.0. The documentation for this tool is already available, there are also python-api for it - the pyvmomi library.

PS The story about the vSphereTools project was presented within the DevOps-mitap, which took place in the fall in Moscow.

Video:



Slides



The link presents presentations of 16 reports presented during the event. All presentations and video presentations will be added to the table at the end of this topic-announcement .

Author : Timur Gilmullin

PPS We remind you that very soon, with the support of Positive Technologies, Moscow will take a course on asyncio + aiohttp from Core developer Python Andrei Svetlov.

We want to offer one free ticket to the seminar to the author of the best question for Andrei - the question he chooses himself and will answer it during the course. Send your questions to: asyncio2016@ptsecurity.com .

Source: https://habr.com/ru/post/317072/


All Articles