Coder Social home page Coder Social logo

vcdriver's Introduction

image

image

image

image

About

Vcdriver is a wrapper around pyvmomi that lets you manage virtual machines on your Vsphere in an easy way.

  • Create, find or destroy virtual machines.
  • Power on/off, shutdown, reboot and reset them.
  • Snapshot management.
  • Remote management:
    • SSH protocol for remote commands (Requires the SSH service).
    • SFTP protocol for file transfers (Requires the SSH service).
    • WinRM protocol for remote commands and file transfer on Windows machines (Requires the WinRM service).

How does it work underneath?

  • Vsphere is driven using its official python API, pyvmomi.
  • The virtual machines are manipulated with Fabric3 and pywinrm.
  • It currently supports Python 2.7, 3.4, 3.5 and 3.6.
  • It works with latest versions of Vsphere, 6.0 and 6.5.

Why would I use vcdriver instead of using pyvmomi directly?

Pyvmomi is powerful but its learning curve is overkill for most of the tasks you might want to execute programmatically with Vsphere. All the complexity has been abstracted out so you can do in 5 lines of vcdriver code what you would do in 50 lines of pyvmomi code. That makes your testing and automation scripts way easier to read and maintain.

Installation

pip install vcdriver

Documentation

Documentation and examples can be found on the wiki.

Testing

Prepare your python environment: pip install -e . && pip install pytest pytest-cov mock.

Unit tests

  1. Run pytest -v --cov=vcdriver --cov-fail-under 100 test/unit.

Integration tests

As you might expect, the unit tests can only test the logic of the driver, as all the vcenter components have to be mocked out. You can run some integration tests to check it works fine for your Vsphere instance. To do so:

  1. You need the following Vsphere resources:
    • An empty folder which will serve as a sandbox environment for the tests.
    • A Unix virtual machine template with the SSH service allowing remote username/password SSH/SFTP connections.
    • A Windows Server virtual machine template with the WinRM service allowing remote username/password WinRM connections. The ansible people have done a great job about this, and you can set it up with their script: ConfigureRemotingForAnsible.ps1.
  2. Read through the setup section and create your configuration file.
  3. Provide the following extra environment variables:
    • vcdriver_test_config_file: The path to your file config.
    • vcdriver_test_unix_template: The name of the UNIX virtual machine template that will be cloned for the tests.
    • vcdriver_test_windows_template: The name of the Windows Server virtual machine template that will be cloned for the tests.
    • vcdriver_test_folder: An empty vm folder to perform the tests in it.
  4. Run pytest -v -s test/integration.

vcdriver's People

Contributors

edsharp avatar foolswood avatar gmaxera avatar graingert avatar lantero avatar markredman avatar porousmoose avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.