getting started vmware apps

30
www.virtualizeplanet Author: Ricky El-Qasem: 20 Virtualize Planet Getting Started, writing VMware APPs for novice programmers Sponsored by

Upload: rickyelqasem

Post on 29-Nov-2014

5.857 views

Category:

Technology


0 download

DESCRIPTION

Getting started writing vmware apps from VMUG

TRANSCRIPT

Page 1: Getting started vmware apps

www.virtualizeplanet.com

Author: Ricky El-Qasem: 2011

Virtualize Planet

Getting Started, writing VMware APPs for novice programmers

Sponsored by

Page 2: Getting started vmware apps

04/09/2023 2

Breaking the magicians code

Page 3: Getting started vmware apps

04/09/2023www.virtualizeplanet.com 3

No Programmers Allowed

I’m not a programmer

I do not speak in Fortran or C++

The point of this session is that its for novices like me

Page 4: Getting started vmware apps

04/09/2023www.virtualizeplanet.com 4

A word from the sponsors

All apps mentioned in this presentation are not the products of Canopy Cloud. Ricky developed these apps before joining Canopy.

Canopy Private Cloud

Canopy Appstor

e

Solutions Catalogue: Vertical & Horizontal Workloads

Management & Orchestration vCloud Director - vSphere

Canopy Cloud InfrastructureVblock - Best-of-Breed

Page 5: Getting started vmware apps

04/09/2023www.virtualizeplanet.com 5

My Apps

VPsnapper = where it all started Resource Pool Scheduler vDisk Waste Finder vSphere Plug-in Wizard = Best Free Tools

VMworld 2011 vDisk Informer

Page 6: Getting started vmware apps

04/09/2023www.virtualizeplanet.com 6

Different APIs

COM API Web server API =

SDK PowerCLI Etc etc

Page 7: Getting started vmware apps

04/09/2023www.virtualizeplanet.com 7

What you need before you begin .Net IDE = Visual Studio .Netor Java IDE = Netbeans

Page 8: Getting started vmware apps

04/09/2023www.virtualizeplanet.com 8

So how did I do it?

VPsnapper

I needed a way to revert the default snapshots on all my VMs with one click

+ COM API Document

Page 9: Getting started vmware apps

04/09/2023www.virtualizeplanet.com 9

VPSnapper

Page 10: Getting started vmware apps

04/09/2023www.virtualizeplanet.com 10

The SDK is the future Resource Pool

Scheduler•Student gave me an idea. I needed to be able to shift resource allocation from pool to pool• Once again I used the book and the SDK programmers guide but failed at stage 1• Stage 1 was to list all VMs running• I posted my failure on VMTN = VMware Communities• Few days later VMware sent me a fixed version of my test app.• This was a huge springboard

Page 11: Getting started vmware apps

04/09/2023www.virtualizeplanet.com 11

Another Useful Book

Samples are in JAVA

However I found I could easily copy from JAVA to C# .NET

Page 12: Getting started vmware apps

04/09/2023www.virtualizeplanet.com 12

The SDK Tree

ExtensibleManagedObject

ManagedEntity

ResourcePool

ComputeResource

Hostsystem

Datacenter Folder VirtualMachine

ClusterComputeResource

Page 13: Getting started vmware apps

04/09/2023www.virtualizeplanet.com 13

MOB = Managed Object Browser

https://yourserver/mob

Page 14: Getting started vmware apps

04/09/2023www.virtualizeplanet.com 14

How to work with the SDK

Make a connection Filter only what you need – Proprerty Spec Which hierarchy objects to search -

Traversal Spec

Page 15: Getting started vmware apps

04/09/2023www.virtualizeplanet.com 15

VIMAPI in .net

2 x Dlls – import in to your code

Using Statement:

Page 16: Getting started vmware apps

04/09/2023www.virtualizeplanet.com 16

MOREF Managed Object Reference You do not manipulate the VMware

objects like VMs, Folders, Hosts and Datastores directly

You work with a representation of those objects known as a Managed Object Reference aka MOREF

Its all about the MOREF!

Page 17: Getting started vmware apps

04/09/2023www.virtualizeplanet.com 17

Data model

Managed Object Types = objects that have properties and methods

MOREF = local representation Data Object = just pure data and no

actions

Page 18: Getting started vmware apps

04/09/2023www.virtualizeplanet.com 18

vSphere Plug-in Wizard

Finalist in Best Free vSphere Tools VMworld 2011

Plugs in Website of your choice into vSphere Client

Page 19: Getting started vmware apps

04/09/2023www.virtualizeplanet.com 19

vSphere Plug-in Wizard

Page 20: Getting started vmware apps

04/09/2023www.virtualizeplanet.com 20

vDisk Informer

Helps you find wasted vDisk space

Helps you find misaligned vDisks

Use Gparted to fix

Page 21: Getting started vmware apps

04/09/2023www.virtualizeplanet.com 21

vDisk Waste Finder

Previous version of vDisk Informer

VMUG can have copy of code.

Demo

Page 22: Getting started vmware apps

04/09/2023www.virtualizeplanet.com 22

Extreme GUI Makeover

Before After

Page 23: Getting started vmware apps

04/09/2023www.virtualizeplanet.com 23

Tips on creating a sexy GUI

Page 24: Getting started vmware apps

04/09/2023www.virtualizeplanet.com 24

Tips on creating a sexy GUI

Page 25: Getting started vmware apps

04/09/2023www.virtualizeplanet.com 25

Tips on creating a sexy GUI

Page 26: Getting started vmware apps

04/09/2023www.virtualizeplanet.com 26

Page 27: Getting started vmware apps

04/09/2023www.virtualizeplanet.com 27

Writing Config

Page 28: Getting started vmware apps

04/09/2023www.virtualizeplanet.com 28

Performing an action

ManagedObjectReference moref_task = _service.PowerOffVM (moref_VM, moref_Host);

Page 29: Getting started vmware apps

04/09/2023www.virtualizeplanet.com 29

My best tip as a novice

Take an existing example and hack it to death with trial and error until you get it working for your needs

If something doesn’t work post it on VMware's Community forum

After today code for vDisk Waste Finder will be available from my blog www.virtualizeplanet.com

Page 30: Getting started vmware apps

04/09/2023 30

Disclaimer:

Virtualize Planet will not be held liable for any actions you perform in your environment. Anything you learn from this material should be used at your own discretion and be warned actions you perform can be damaging. Always consult a professional.

www.virtualizeplanet.com