Giter Club home page Giter Club logo

pyvmgr's Introduction

pyvmgr.py

A python script to manage groups of VMs from vSphere.
It's a wrapper for using pyvmomi

The idea behind it is to be able to take/revert to/delete/list snapshots, poweron and off groups of VMs. This is useful when used in a test environment, not intended for production.

Pre requisites

  • Python 3.4+
  • cmd2
  • pyvmomi

Usage

./pyvmgr.py
READY.
RUN help

Documented commands (type help <topic>):
========================================
_relative_load  help                  py                savegroup
addvm           history               pyscript          set
loadgroup       load                  quit              shell
cmdenvironment  poweron               removevm          shortcuts
connect         printallvms           removesnapshot    show
edit            printcurrentsnapshot  revertcurrent     shutdown
getstate        printgroup            run               takesnapshot
gotosnapshot    printsnapshots        save

RUN

Examples

The same commands used in an interactive session can be passed as parameters:

READY.
Trying to connect to VCENTER SERVER . . .
Connected to VCENTER SERVER !
testVM1
testVM2
╔═════════╗
║ TestVM1 ║
╚═════════╝
  └── [23] Snapshot1
       └── [24] test
            └── [25] test3
                 └── [26] Snapshot2
                      └── [33] AnotherTest2
  └── [34] Clean
       └── [35] Test123
            └── [36] More
       └── [41] test5
            └── You are Here
╔═════════╗
║ TestVM2 ║
╚═════════╝
  └── [1] Clean
       └── [2] More
            └── [3] Test
                 └── [4] Snapshot1
                      └── [5] Test123
                           └── You are Here
       └── [15] Clean2
            └── [16] test3
                 └── [21] test5
RUN

Shutdowns GuestOS of the VMs in the group, then quits

./pyvmgr.py "connect user:[email protected]" "loadgroup test" shutdown quit
READY.
Trying to connect to VCENTER SERVER . . .
Connected to VCENTER SERVER !
Shutting down VM: TestVM1
Shutting down VM: TestVM2

A few commands in the interactive view:

./pyvmgr.py
READY.
RUN connect
Enter vCenter Server name or IP address:vcenter.priv
Enter vCenter Username:username
Enter the password for user username at vCenter server vcenter.priv:
Trying to connect to VCENTER SERVER . . .
Connected to VCENTER SERVER !
RUN loadgroup test
RUN getstate
VM Name: TestVM1
VM Name: TestVM2
RUN poweron
Powering UP VM TestVM1
Powering UP VM TestVM2
RUN

pyvmgr's People

Contributors

svzez 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.