воскресенье, 11 января 2015 г.

Как включить буфер обмена в VMware vSphere Client?

http://fadmin.ru/vopros/kak-vklyuchit-bufer-obmena-v-vmware-vsphere-client

Всегда удивляло, что в клиенте VMware vSphere не работает буфер обмена. Как оказалось, буфер обмена был отключен в целях безопасности. В KB1026437 (Clipboard Copy and Paste does not work in vSphere Client 4.1 and later) написано, как включить копирование и вставку в буфер обмена в VMware vSphere Client.
Функционирование Copy и Paste можно разрешить добавив две строчки в настройки (Options > Advanced >General > Configuration Parameters) каждой виртуальной машины.
  • isolation.tools.copy.disable – false
  • isolation.tools.paste.disable – false
либо на каждом хосте внести изменения в файл /etc/vmware/config.
  • isolation.tools.copy.disable="FALSE"
  • isolation.tools.paste.disable="FALSE"
Каждый из этих вариантов имеет свои преимущества и недостатки. С одной стороны, вносить изменения в каждую виртуальную машину долго и нудно, с другой стороны, при апгрейде или вводе нового хоста нужно не забыть дописать эти строчки.
На помощь приходит PowerCLI. С помощью простого скрипта можно внести изменения сразу во все виртуальные машины. Этот скрипт можно запускать повторно, по мере создания новых гостей, лишние строчки в конфигурационные файлы гостевых машин добавляться не будут.
# Опции которые нужно добавить в конфиги виртуальных машин
# Это удобный способ записи опций, который будет далее преобразован в VirtualMachineConfigSpec
$NewExtraOptions = @{
 "isolation.tools.copy.disable"="false";
 "isolation.tools.paste.disable"="false";
}

# Создаем VirtualMachineConfigSpec в который добавим опции определенные выше.
$VMConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
foreach ($Option in $NewExtraOptions.GetEnumerator()) {
    $OptionValue = New-Object VMware.Vim.OptionValue
    $OptionValue.Key = $Option.Key
    $OptionValue.Value = $Option.Value
    $VMConfigSpec.ExtraConfig += $OptionValue
}

# Получим все виртуальные машины, кроме шаблонов, названия которых удовлетворяют маске.
# Если необходимо внести изменения для всех машин, то можно убрать фрагмент '| where {$_.name -like "*"}'
$VMs = Get-View -ViewType VirtualMachine -Property Name -Filter @{"Config.Template"="false"} | where {$_.name -like "*"}

# Внесем изменения в конфигурационные файлы виртуальных машин
foreach($VM in $VMs){
 $VM.ReconfigVM_Task($VMConfigSpec)
}
К сожалению, изменения будут применены только после vMotion или выключения/включения виртуальной машины.

понедельник, 5 января 2015 г.

vSphere. How to Connect your vSphere Client Externally

How to Connect your vSphere Client Externally
I had a situation today where I had to connect my VMware vSphere client over the internet directly to one of my ESXi hosts to gain remote access to a new bank of VM’s and thought I’d post here how to do it. I couldn’t find an article exactly outlining the procedure, so here’s mine…
There’s some definite disadvantages to directly connecting like this, but it certainly helped solve my issue. My home internet connection isn’t allowing my VPN to come up and the new VM’s I built do not have remote access turned on which means no RDP connectivity. The icing on the cake is there’s no server or workstation on the current LAN which I can connect to that will let me install the vSphere client.
The solution!?!? Externally connecting my vSphere client directly to my host, opening VM console sessions from the vSphere client and turning on remote access from there. There wasn’t much info on this on the interwebs so here’s my quick fix solution for those times when you need to do the same…
I’m going to assume you already have your vSphere client installed on your local PC, so let’s skip everything required there. So first up you’ll want to configrue your firewall. You’ll need two ports here, ports 443 and 902. Official documentation says 903 as well, but I haven’t found a need for that port yet.
All that was required on my firewall was port forwards (virtual hosts, PAT, VIPs…whatever terminology your firewall/router appliance uses) to both of those service ports. I already had a server listening on port 443 so I did PAT from port 58654 to 443 for a little more security. DISCLAIMER: Yes that is a fake port and not the actual one I used.
So my first port forward listended externally on port 58654 and translated to port 443 internally which points to my ESXi host. The second port forward listended externally on port 902 and translated directly to port 902 internally which also points to my ESXi host.
Port 443 is required for the vSphere client external connection and 902 & 903 is a documented requirement for the virtual machine console connections. In my experience I only needed port 902 and the console connections to my VM’s worked fine.
How to Connect your vSphere Client Externally