This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' Copyright (c) 2007, Tony Ivanov | |
All rights reserved. | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
* Redistributions of source code must retain the above copyright | |
notice, this list of conditions and the following disclaimer. | |
* Redistributions in binary form must reproduce the above copyright | |
notice, this list of conditions and the following disclaimer in the | |
documentation and/or other materials provided with the distribution. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# use: headless.sh /full/path/to/VirtualMachine.vmwarevm/VirtualMachine.vmx | |
/Applications/VMware\ Fusion.app/Contents/Library/vmrun -T fusion start $1 nogui |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%if 0%{?fedora} | |
%global _with_python3 1 | |
%endif | |
%if 0%{?rhel} && 0%{?rhel} <= 6 | |
%{!?__python2: %global __python2 /usr/bin/python2} | |
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} | |
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} | |
%endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create the updated device spec | |
VirtualDeviceConfigSpec nicSpec = new VirtualDeviceConfigSpec() | |
nicSpec.device = nic | |
nicSpec.operation = VirtualDeviceConfigSpecOperation.edit | |
// Create the VM update spec | |
VirtualMachineConfigSpec spec = new VirtualMachineConfigSpec() | |
spec.deviceChange = [nicSpec] | |
// Do the update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
si = connect.SmartConnect(host='vcsa', | |
user='my_user', | |
pwd='my_password') | |
atexit.register(connect.Disconnect, si) | |
content = si.RetrieveContent() | |
datacenter_object_view = content.viewManager.CreateContainerView( | |
content.rootFolder, [vim.Datacenter], True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FilterSpec { | |
propSet = [ | |
PropertySpec(type=vim.VirtualMachine, all=False, pathSet=['name' : runtime.powerState] | |
] | |
objectSet = [ | |
ObjectSpec { | |
skip = False | |
selectSet = [ | |
TraversalSpec(type=ContainerView, path='view', skip=False) | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import bz2 | |
import datetime | |
import os | |
import sys | |
import time | |
import urllib2 | |
import warnings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<config> | |
<alert> | |
<log> | |
<enabled>true</enabled> | |
</log> | |
</alert> | |
<level id="CpuFeatures"> | |
<logLevel>info</logLevel> | |
<logName>CpuFeatures</logName> | |
</level> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SuppressWarnings("unchecked") | |
void putVMFiles(String remoteFilePath, String localFilePath) | |
throws Exception { | |
String url = connection.getUrl(); | |
String serviceUrl = url.substring(0, url.lastIndexOf("sdk") - 1); | |
String httpUrl = | |
serviceUrl + "/folder" + remoteFilePath + "?dcPath=" + datacenter | |
+ "&dsName=" + datastore; | |
httpUrl = httpUrl.replaceAll("\\ ", "%20"); | |
System.out.println("Putting VM File " + httpUrl); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void getData(String urlString, String fileName) | |
throws Exception { | |
HttpURLConnection conn = null; | |
URL urlSt = new URL(urlString); | |
conn = (HttpURLConnection) urlSt.openConnection(); | |
conn.setDoInput(true); | |
conn.setDoOutput(true); | |
conn.setAllowUserInteraction(true); | |
// Maintain session | |
List<String> cookies = (List<String>) headers.get("Set-cookie"); |