Tag Archives: virtual machine

Dummy Virtual Machine For Dummies: How To Create Hundreds of Them with Several Lines of Scripts

As I introduced in the article on vim-cmd commands, you can use a very simple command as follows to create a new virtual machine. Alternatively, you can ignore the path after the datastore and provide only datastore name (The [ and ] are still needed).

# vim-cmd vmsvc/createdummyvm testVM “[datastore1] testVM/testVM.vmx"

Other than the name and configuration file path in data store, there is no additional information provided such as the size of the disk, memory capacity, etc. Normally, you have to go through a wizard of several pages to create a new virtual machine.

Posted in Virtualization | Also tagged , , | Leave a comment

Building Linux Virtual Machine Templates: Tips and Checklist

While preparing for my home lab, I have created several virtual machine templates. Here are a few tips I found useful to smoothen the process and make your virtual machine templates easy to be deployed than otherwise.

Install VMware Tools
As you may have known, VMware Tools brings many features to the table, for example,

Significantly faster graphics performance and Windows Aero on operating systems that support Aero
Copying and pasting text, graphics, and files between the virtual machine and the host or client desktop
Improved mouse performance
Synchronization of the clock in the virtual machine with the clock on the host or client desktop
Scripting that helps automate guest operating system operations

Wait, it does not even mention APIs. For Guest APIs in vSphere 5.0 and later to work, you must have VMware Tools installed in your virtual machines.

Posted in Cloud Computing, Virtualization | Also tagged , , , | 2 Responses

Agent VM, ESX Agent Manager API, and vijava Support

To understand the ESX Agent Manager API, we have to first explain the Agent, which is essentially Agent Virtual Machine. The agent virtual machine can be hardware drivers for your ESXi server, or simply software, i.e, virus scan, that should be deployed on each ESXi. They could have been designed and installed directly on ESXi via VIB, but it would increase the risk of destablizing ESXi due to access to lower level APIs of ESXi. To lower the risk, the driver VM idea came up – if the driver VM crashes the ESXi is still solid even though some service may be affected.

Posted in vSphere API | Also tagged , , | 2 Responses

Rethink Virtual Machine Template: It’s Not What It Is

In the virtualization world, virtual machine template (as know as virtual machine image) is a big feature. It allows users to quickly deploy a new virtual machine without the steps to install a new operating system and other software. Because of this feature, we start to have a new problem with too many (unused or useless) virtual machines. But this is a separate topic that deserves its own discussion.

Posted in Virtualization | Also tagged , , | 3 Responses

Uncover KVM and Virtual Machines in OpenStack

After installing OpenStack and posting a few articles, I started to dig down a bit more on the KVM hypervisor used in OpenStack. For that, I wrote about the libvirt API and how to remotely manage KVM with it.

In this article, I will introduce how KVM is used in Openstack and what a virtual machine is made of.

How A Virtual Machine Instance Comes to Life?

Posted in Cloud Computing, Virtualization | Also tagged , | 4 Responses

Configure Static IP Address on Linux VM in VMware Player

If you run VMware Player, you would have 3 networking options for virtual machines running there: Bridged, NAT, Host-Only. In the latest 5.0.1, I also found a new one: LAN Segment. This blog has a nice explanation on these three settings if you want to get more details.

In most of cases, I use NAT for networking because the virtual machine can have Internet access which allows me to install additional software as needed. By default, VMware Player uses DHCP to dynamically assign IP address while using NAT. So you cannot guarantee to get same IP address after each rebooting.

Posted in Virtualization | Also tagged , , | 22 Responses

vSphere vs. Hyper-V: Difference of Virtual Machine States

While reading articles about Microsoft Hyper-V, I found that Hyper-V seemed to have different states for virtual machines from VMware vSphere. The virtual machine in Hyper-V is represented by the Msvm_ComputerSystem class. If you are familiar with VMware vSphere, you know the equivalent in vSphere is VirtualMachine. At first sight, the Hyper-V APIs may not look straight-forward. The Hyper-V APIs is actually based on Windows Management Instrumentation (WMI), which is essentially CIM from DMTF.

Posted in Virtualization | Also tagged , , , | 8 Responses

Review Board Virtual Machine for Code Review: The Missing Manual

Code review is important for the quality of a software product. It used to be a meeting activity where a small group of engineers walk through changes and provide the author feedbacks. This is highly effective but not flexible enough, especially when there are frequent code changes.

Posted in Software Development | Also tagged , | 1 Response

Best Tool to Compress Virtual Machines

While working in virtualized environments, we need to pass around virtual machines (a.k.a. virtual appliances) from time to time. Most of the virtual machines I’ve seen for downloading are compressed to save storage and network bandwidth.

Not all the compression algorithms are created equal in terms of compression ratio, compressing speed, and decompressing speed. In most cases, it doesn’t really matter that much with documents and small programs. But it matters a lot with virtual machines whose virtual disk files are much larger than normal files. Any small percentage improvement can result in significant saving on storage and bandwidth.

Posted in Software Development, Virtualization | Also tagged , | 11 Responses

Hypervisor is Containership

There are a few metaphors that help explain what virtualization is. Some suggested virtualization is like people (virtual machines) sharing a bus (physical machine) for efficiency and consolidation.

While the bus sample well explains the benefit of consolidation. It does not explain well isolation. Here I make up a new one: a hypervisor is like a containership, and a virtual machine is like a container that is stacked on the ship.

Posted in Virtualization | Also tagged | 4 Responses

Virtualization Matters Except When It Doesn’t

In my previous post “Physical is New Virtual,” I mentioned that I would talk about when you will need virtualization and when you don’t. This topic could be a little controversial as we at virtualization community all assume that virtualization is the way to go, which is true in general.

There are however use cases in which virtualization doesn’t make much sense. In the following, I will detail some of these use cases and explain why it doesn’t make much sense to use virtualization. Like everything else, virtualization doesn’t fit all.

Posted in Virtualization | Also tagged , , | Leave a comment

Uniqueness of MOIDs

A question was recently posted at the open source VI Java API forum regarding the uniqueness of MOIDs. The developer who raised the question wanted to build a caching on the client side so as to avoid getting back to the server for the name of a virtual machine with its MOID. If MOID doesn’t resonate with you, you may want to read this post before reading on.

Posted in vSphere API | Also tagged | 8 Responses

Why Virtual Machine Not Found?

I saw a new bug (Intermittent ManagedObjectNotFound on VirtualMachine.getConf) filed in the open source VI Java API project today:

It looks like sometimes VirtualMachine.getConfig() returns null, but other times it throws:
Caused by: java.lang.RuntimeException: com.vmware.vim25.ManagedObjectNotFound
at com.vmware.vim25.mo.ManagedObject.retrieveObjectProperties(ManagedObject.java:158)
at com.vmware.vim25.mo.ManagedObject.getCurrentProperty(ManagedObject.java:179)
at com.vmware.vim25.mo.VirtualMachine.getConfig(VirtualMachine.java:55)

As the vSphere API reference points out,

Posted in vSphere API | Also tagged , | 2 Responses

Moving Virtual Machine Back From Distributed Virtual Switch

After blogging about moving virtual machines from a standard virtual switch to a distributed virtual switch, I saw a new question in VI Java API forum on how to roll it back. Technically, I don’t see any reason why one should switch back because using distributed virtual switch gives you a lot of benefits. But the decision is not mine but yours. Whatever you want to do, we help do it easily.

The method involved is

Posted in vSphere API | Also tagged , , | 4 Responses

Moving Virtual Machine to Distributed Virtual Switch

The distributed virtual switch introduced in vSphere 4 has many benefits over the traditional switch. For one thing, you no longer have possible glitches with live migrating virtual machines from one host to another using traditional switches, and all your port settings go with your virtual machines.

If you have virtual machines using traditional switches, you can easily move them to new distributed virtual switches. The rest of this article explains how to achieve this.

You can use the

Posted in vSphere API | Also tagged , , | 3 Responses

Virtual Machine Roaming in the Cloud

If you have a mobile phone and travel to other areas or countries, you can still use it to make and receive a call. Your phone number does not change. This is called roaming in the wireless telecommunications.

In the cloud environment, your virtual machine can “travel” around as well, maybe from one datacenter to another, from your enterprise to one of your service providers or the other way around, or from one service provider to another.

It’s relatively easy for a virtual machine

Posted in Cloud Computing, Virtualization | Also tagged , , | Leave a comment

How to Enable or Disable Copy and Paste to Remote VM Console?

In my previous post, I introduced how to change a virtual machine’s vmx file programmatically and promised to post a full sample in my presentation at VMware Parter Exchange 2011. Now that the conference is over, it’s time to post it.

The sample is based on guideline VMX03 in vSphere security hardening guide: disable copy/paste to remote console. To me, allowing copy and paste to remote console like vSphere Client is a nice feature which can save you a lot of time. When security is a concern, however, you may want to disable it.

I will not discuss when you should disable/enable it because it really depends on your requirements. In most cases, security and convenience contradict with each other. I leave it for you to decide the right balance, but show you how you can check the setting and change it here.

Like most samples I write,

Posted in vSphere API | Also tagged , , | 1 Response

How to Change VMX Programmatically?

As most of you may have known, the vmx file is the most important file at the back of a virtual machine. It defines the configurations of a virtual machine for example virtual hardware version, devices, disk files, etc. That is why it owns the virtual machine icon when you look at all the files behind a virtual machine with either datastore browser in vSphere Client or VMware Workstation/Fusion.

Given the importance of the vmx file, we don’t recommend anyone to manually modify it given that messing it up may corrupt a virtual machine. You can change the content indirectly from GUI and APIs. If you can change the virtual devices of a virtual machine, its vmx file is changed accordingly.

Beyond basic configuration entries, the vmx file can be extended to hold key/value pairs. A vmx file is really a text file with many lines of key/value pairs. By extending it, you can add extra lines of key/value pairs at the end of the file. Keep in mind that you should NOT add any key that is duplicated with predefined keys like “virtualHW.version.” As you already noticed, the key has the “.” delimiter as namespace pattern. You can start with your own namespace to avoid possible name clash.

Posted in vSphere API | Also tagged , | 9 Responses

How to Differentiate Folders in vSphere

As we know Folder is a container object in vSphere. It’s used to hold other managed objects in a similar way as directory holding files in an OS. There is an interesting question asking in VI Java API forum on how to tell whether a folder is vmFolder or hostFolder. BTW, you don’t see these two folders displayed in vSphere Client.

The questioner guessed correctly that you can find out by a folder’s childType property. Here is the documentation in API reference on the possible values of the childType property:

Posted in vSphere API | Also tagged , | 4 Responses

How to Delete Virtual Machine With vSphere API?

This question was asked at VI Java API forum recently and has been answered by the community.

There should be a “Destroy_Task()”-Method for each Managed Object, so also Virtual Machines…. Cheers, Joerg

As  Jörg Lew has correctly pointed out the solution, I would like to elaborate a bit more here.

If you are using VI Java API, the method name is destroy_Task(). The code is as simple as:

Posted in vSphere API | Also tagged , | 3 Responses

    My company has created products like vSearch ("Super vCenter"), vijavaNG APIs, EAM APIs, ICE tool. We also help clients with virtualization and cloud computing on customized development, training. Should you, or someone you know, need these products and services, please feel free to contact me: steve __AT__ doublecloud.org.

    Me: Steve Jin, VMware vExpert who authored the VMware VI and vSphere SDK by Prentice Hall, and created the de factor open source vSphere Java API while working at VMware engineering. Companies like Cisco, EMC, NetApp, HP, Dell, VMware, are among the users of the API and other tools I developed for their products, internal IT orchestration, and test automation.