diff --git a/hyper-v.changes b/hyper-v.changes index d059cfc..0c65cec 100644 --- a/hyper-v.changes +++ b/hyper-v.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Mar 27 08:50:43 CEST 2012 - ohering@suse.de + +- add kvptest.ps1.txt to docs, a PowerShell script to verify KVP + ------------------------------------------------------------------- Mon Mar 26 19:05:48 CEST 2012 - ohering@suse.de diff --git a/hyper-v.kvptest.ps1.txt b/hyper-v.kvptest.ps1.txt new file mode 100644 index 0000000..e058cfe --- /dev/null +++ b/hyper-v.kvptest.ps1.txt @@ -0,0 +1,49 @@ +# Windows PowerShell script to test Key Value Pair functionality +# +# http://blogs.msdn.com/b/virtual_pc_guy/archive/2008/11/18/hyper-v-script-looking-at-kvp-guestintrinsicexchangeitems.aspx +# +# Per default execution of scripts is disabled. +# http://technet.microsoft.com/en-us/library/ee176949.aspx +# The command 'Set-ExecutionPolicy RemoteSigned' will enable it. +# +# Filter for parsing XML data +filter Import-CimXml +{ + # Create new XML object from input + $CimXml = [Xml]$_ + $CimObj = New-Object -TypeName System.Object + + # Iterate over the data and pull out just the value name and data for each entry + foreach ($CimProperty in $CimXml.SelectNodes("/INSTANCE/PROPERTY[@NAME='Name']")) + { + $CimObj | Add-Member -MemberType NoteProperty -Name $CimProperty.NAME -Value $CimProperty.VALUE + } + + foreach ($CimProperty in $CimXml.SelectNodes("/INSTANCE/PROPERTY[@NAME='Data']")) + { + $CimObj | Add-Member -MemberType NoteProperty -Name $CimProperty.NAME -Value $CimProperty.VALUE + } + + # Display output + $CimObj +} + +# Prompt for the Hyper-V Server to use +$HyperVServer = Read-Host "Specify the Hyper-V Server to use (enter '.' for the local computer)" + +# Prompt for the virtual machine to use +$VMName = Read-Host "Specify the name of the virtual machine" + +# Get the virtual machine object +$query = "Select * From Msvm_ComputerSystem Where ElementName='" + $VMName + "'" +$Vm = gwmi -namespace root\virtualization -query $query -computername $HyperVServer + +# Get the KVP Object +$query = "Associators of {$Vm} Where AssocClass=Msvm_SystemDevice ResultClass=Msvm_KvpExchangeComponent" +$Kvp = gwmi -namespace root\virtualization -query $query -computername $HyperVServer + +Write-Host +Write-Host "Guest KVP information for" $VMName + +# Filter the results +$Kvp.GuestIntrinsicExchangeItems | Import-CimXml diff --git a/hyper-v.spec b/hyper-v.spec index 01dcf25..1d10d1c 100644 --- a/hyper-v.spec +++ b/hyper-v.spec @@ -45,6 +45,7 @@ Source1: hyperv_pvdrivers.conf Source2: kmp_filelist Source3: hyper-v.supplements.txt Source4: hyper-v.dummy_ko.c +Source5: hyper-v.kvptest.ps1.txt Source9: hyper-v.include.linux.hyperv.h Source10: hyper-v.tools.hv.hv_kvp_daemon.c Source11: hyper-v.init.sh @@ -81,6 +82,7 @@ This package contains the Microsoft Hyper-V drivers. %prep %setup -Tc +cp -avL %{S:5} kvptest.ps1.txt cp -vL %{S:9} %{hv_kvp_daemon}.h cp -vL %{S:10} %{hv_kvp_daemon}.c sed -i~ '/#include /d' %{hv_kvp_daemon}.c @@ -129,6 +131,7 @@ install -m644 %SOURCE1 $RPM_BUILD_ROOT/etc/modprobe.d/hyperv_pvdrivers.conf %files %defattr (-,root,root) +%doc kvptest.ps1.txt %if !%{with_kmp} %dir /etc/modprobe.d %config /etc/modprobe.d/hyperv_pvdrivers.conf