Posted in
Virtual Machine Manager,
Windows Powershell |
1 Comment | 3,222 views | 20/12/2011 21:41
If you have a public Hyper-V Cloud and use SCVMM, your customers can install Linux VM and install Hyper-V LIS v3.1 on it, there is nothing you can do to stop them. If they install it, you will not be able to use SCVMM due to LIS v3.1 bug.
System.ArgumentException: Version string portion was too short or too long.
at System.Version..ctor(String version)
at Microsoft.Carmine.ViridianImplementation.VirVMIntegrationService.PopulateKVPElements()
There are 2 options to prevent this.
1) You can provision all new virtual machines without Data Exchange offer.
2) You can disable Data Exchange offer only from Linux VMs to prevent that kind of problem.
If you have 0 – 50 VMs, it’s easy to deal with. But if you are a large Cloud provider, you can’t do it manually, you need scripting. So if you execute this command on SCVMM Powershell Interface, it’ll disable Data Exchange offer on all Linux VMs and save your SCVMM.
Get-VM * | where {$_.OperatingSystem -notlike "*Windows*"} | Set-VM -EnableDataExchange $false |
Get-VM * | where {$_.OperatingSystem -notlike "*Windows*"} | Set-VM -EnableDataExchange $false
As you see, it just looks for non-Windows machines and disable their Data Exchange offer. Good luck!
Posted in
Linux Server,
Virtual Machine Manager,
Windows Powershell |
No Comment | 3,866 views | 27/07/2011 13:59
Yeni Hyper-V Linux Integration Service v3.1 ile birlikte gelen KVP Exchange desteği sayesinde bir çok bilgiyi çekebilmeniz mümkün. Öncelikle yapmanız gereken Get-HyperVKVP dosyasını indirmek ve bir Hyper-V sunucusunun üzerine kurmak olacaktır.
Download:
Scripti Hyper-V sunucusu üzerinde aşağıdaki gibi çalıştırabilirsiniz.
.\Get-HyperVKVP.ps1 VMName |
.\Get-HyperVKVP.ps1 VMName
Hyper-V üzerindeki CentOS 6 için örnek bir script çıktısı:
PS C:\> .\Get-HyperVKVP.ps1 Centos6
FullyQualifiedDomainName: centos6.yusufozturk.info
IntegrationServicesVersion: 3.1
NetworkAddressIPv4: 192.168.2.2
NetworkAddressIPv6: fe80::215:5dff
OSBuildNumber: 2.6.32-71.el6.x86_64
OSName: CentOS Linux release 6.0 (Final)
OSVersion: 2.6.32-71.el6.x86_64
ProcessorArchitecture: x86_64
Get-HyperVKVP.ps1 dosyasının kaynak kodu:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| $vm = $args[0]
filter Import-CimXml
{
$CimXml = [Xml]$_
$CimObj = New-Object -TypeName System.Object
foreach ($CimProperty in $CimXml.SelectNodes("/INSTANCE/PROPERTY"))
{
if ($CimProperty.Name -eq "Name" -or $CimProperty.Name -eq "Data")
{
$CimObj | Add-Member -MemberType NoteProperty -Name $CimProperty.NAME -Value $CimProperty.VALUE
}
}
$CimObj
}
$VmObj = Get-WmiObject -Namespace root\virtualization -Query "Select * From Msvm_ComputerSystem Where ElementName='$vm'"
$KvpObj = Get-WmiObject -Namespace root\virtualization -Query "Associators of {$VmObj} Where AssocClass=Msvm_SystemDevice ResultClass=Msvm_KvpExchangeComponent"
$KvpObj.GuestIntrinsicExchangeItems | Import-CimXml |
$vm = $args[0]
filter Import-CimXml
{
$CimXml = [Xml]$_
$CimObj = New-Object -TypeName System.Object
foreach ($CimProperty in $CimXml.SelectNodes("/INSTANCE/PROPERTY"))
{
if ($CimProperty.Name -eq "Name" -or $CimProperty.Name -eq "Data")
{
$CimObj | Add-Member -MemberType NoteProperty -Name $CimProperty.NAME -Value $CimProperty.VALUE
}
}
$CimObj
}
$VmObj = Get-WmiObject -Namespace root\virtualization -Query "Select * From Msvm_ComputerSystem Where ElementName='$vm'"
$KvpObj = Get-WmiObject -Namespace root\virtualization -Query "Associators of {$VmObj} Where AssocClass=Msvm_SystemDevice ResultClass=Msvm_KvpExchangeComponent"
$KvpObj.GuestIntrinsicExchangeItems | Import-CimXml
Bilgileri WMI üzerinden çektiği için bu scripti SCVMM üzerinde kullanamazsınız.
Fakat SCVMM üzerinden Hyper-V’ye bir WMI bağlantısı açarak bu işlemi yapmanız da mümkün tabiki.