顯示具有 VMware 標籤的文章。 顯示所有文章
顯示具有 VMware 標籤的文章。 顯示所有文章

2015年9月3日 星期四

在 Ubuntu 的 VMware 虛擬機器上安裝 VM Tool

一般安裝 VM Tool 的方法,是參考 [1] 的方式,安裝 VMware Tool
不過在部分作業系統上,因為 VMware 已經支援開源版的 VMware Tool:Open VM Tool 的關係 [2]
可以直接利用指令安裝由虛擬機器自行管理的 VM Tool。

apt-get install open-vm-tools

關於 Open VM Tool 的說明,以下節錄 [2] 的描述:
The primary purpose for open-vm-tools is to enable operating system vendors and/or communities and virtual appliance vendors to bundle VMware Tools into their product releases. open-vm-tools is the open source implementation of VMware Tools and consists of a suite of virtualization utilities that improves the functionality, administration, and management of virtual machines within a VMware environment.

參考資料:
  1. (VMesxi 安裝篇-Day10) Install VMware tools for Linux 
  2. VMware support for open-vm-tools (2073803)

2015年8月31日 星期一

使用 Python 整合 VMware vSphere

pyVmomi [1] 是一個由 VMware 官方釋出的 Python API,可以用來存取 vSphere/vCenter 的資源。
另外有一些簡易的使用範例 [2],可以大略參考要如何開始使用 Python 連接 vSphere/vCenter。
這篇是用來記錄初步介接 vSphere/vCenter 的經驗。

2015年8月21日 星期五

使用 pyVmomi 時略過 HTTPS 警告

在使用 pyVmomi 連接 VMware 的 API 時,第一個遇到的問題是程式出現以下的警告:
/usr/lib/python2.6/site-packages/requests-2.7.0-py2.6.egg/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
看起來就是因為連線要使用 HTTPS,但是沒有給予憑證的問題~。
不過簡單地搜尋一下,就看到 [1] 的解法,只要把 requests 這個套件的警告關掉就可以了。
import atexit
import requests
from pyVim import connect

# Disable the checking of certification.
requests.packages.urllib3.disable_warnings()
# Initiate the connection to VMware vSphere.
service_instance = connect.SmartConnect(
        host="192.168.200.200",
        user="administrator@vsphere.local",
        pwd="qwer",
        port=443)
atexit.register(connect.Disconnect, service_instance)

# Get the session ID from the connection.
session_id = service_instance.content.sessionManager.currentSession.key
print("Session ID: %s" % session_id)

程式印出的回覆如下:
Session ID: 521eab6e-7ef1-d7e6-1f67-ba38dd7e2487

參考資料:
  1. Surpress InsecureRequestWarning: Unverified HTTPS request is being made in Python2.6