Steps to Join Hyper V VMM to Manageiq

No response, seems Manageiq do not have capability to ADD SVCMM. If yes then why ManageIq gives statement that it can manage Hyper V also.

@chandrahasa01 Where did you see that it said we supported HyperV directly? Just curious because as far as I know we only support HyperV through SCVMM, so maybe the documentation is wrong.

In the past we supported HyperV directly (albeit very limited), but we found that in an enterprise installation, SCVMM was always used. Supporting HyperV would not be unlike supporting ESX directly…it’s possible, but seems pretty rare someone would have it without vSphere.

@chandrahasa01

  1. Can you please paste into this thread any errors you find in the evm.log file, I expect you will find some.
  2. Can you log onto the SCVMM server as the same user you are using to add the SCVMM provider to ManageIQ, then run this cmdlet in a Powershell ISE, then share the results:

import-module virtualmachinemanager
Get-SCVirtualMachine -VMMServer “localhost”

  1. What version of SCVMM are you using?
    4)What version of Powershell Are you using? (Check by running this in a Powershell window: $PSVersionTable.PSVersion)

@chandrahasa01
Did you have a chance to gather the above information?

thanks

  1. Can you please paste into this thread any errors you find in the evm.log file, I expect you will find some.

I will share the EVM.log file error soon if any .

  1. Can you log onto the SCVMM server as the same user you are using to add the SCVMM provider to ManageIQ, then run this cmdlet in a Powershell ISE, then share the results:

import-module virtualmachinemanager
Get-SCVirtualMachine -VMMServer “localhost”

Above command lists all virtual machines that are running on SCVMM servers . Please let me know what information is needed exactly.

  1. What version of SCVMM are you using?

I am using SCVMM 2012R2

4)What version of Powershell Are you using? (Check by running this in a Powershell window: $PSVersionTable.PSVersion)
Please find version as below
Major Minor Build Revision


4 0 -1 -1

@chandrahasa01

Usually the ExecutionPolicy or the WinRM Settings are wrong, or the version of Powershell or SCVMM are unsupported but it sounds like your environment is configured correctly. At this point we need the evm.log and scvmm.log files. However, in an effort to expedite a resolution to your problem you can run the following ruby script in your test environment, example usage is below, and send me the results:

PS_SCRIPT = <<-PS_SCRIPT
import-module virtualmachinemanager
$result = @{
  "date"     = Get-Date;
  "vms" = Get-SCVirtualMachine
}
$result
PS_SCRIPT

require 'trollop'
opts = Trollop.options do
  banner "Sample Ruby/WinRM stript.\n\nUsage: rails runner #{$PROGRAM_NAME} [-- options]\n\nOptions:\n\t"
  opt :username,  "User Name",            :type => :string
  opt :ipaddress, "IP Address",           :type => :string
  opt :port,      "Port (default 5985)",  :default => 5985
end

Trollop.die "username must be passed"  unless opts[:username_given]
Trollop.die "ipaddress must be passed" unless opts[:ipaddress_given]

url = "http://#{opts[:ipaddress]}:#{opts[:port]}/wsman"

require 'io/console' if RUBY_VERSION < "2"
STDOUT.write("Password: ")
password = STDIN.noecho(&:gets).chomp

puts

puts "Connecting..."

require 'active_support/core_ext'
silence_warnings { require 'winrm' }


winrm   = WinRM::WinRMWebService.new(url, :ssl, :user => opts[:username], :pass => password, :disable_sspi => true)
results = winrm.run_powershell_script(PS_SCRIPT)

errors  = results[:data].collect { |d| d[:stderr] }.join
puts errors
data    = results[:data].collect { |d| d[:stdout] }.join
puts data

Example usage:
ruby ruby_filename.rb --username “DOMAIN\VMMUSER” --ipaddress 1.2.3.4

You can also checkout my earlier post on the subject:

Hi All,

I have the same problem. In my scvmm.log is following error message:

MIQ(Class#log_dos_error_results) ‘uname’ is not recognized as an internal or external command,
operable program or batch file.

Thanks for reply.

HI bronaghs,

Can you please help in running with mention ruby script, not sure from where and how to run this script.

Chandrahasa

  1. Copy script to ManageIQ instance (for example to /tmp). Best choice in Windows world is WinSCP.
  2. Connect to ManageIQ console (for example via PuTTy - root / smartvm)
  3. Run script

@chandrahasa01 -
You can paste the above ruby code into a file (e.g. miq_winrm_sample.rb) and run it as follows from the ManageIQ appliance replacing the sample username and IP of a test environment below with real values:

ruby miq_winrm_sample.rb --username “DOMAIN\VMMUSER” --ipaddress 1.2.3.4

@ksvoboda -
i) Are you able to run the sample script and see virtual machine data returned?
ii) Can you clarify exactly how far you are getting adding the SCVMM provider. Please share any log errors you see in evm.log and scvmm.log (in addition to the “‘uname’ is not recognized as an internal or external command” error)
iii) Have you made any changes the the source code?

i)

  • SCVMM version: 2012R2
  • Sample script output:
[root@localhost tmp]# ruby scvmm.rb --username "XXX\XXX" --ipaddress x.x.x.x
Password:
Connecting...
#< CLIXML
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><Obj S="progress" RefId="0"><TN RefId="0"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj><Obj S="progress" RefId="1"><TNRef RefId="0" /><MS><I64 N="SourceId">2</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj></Objs>

Name                           Value
----                           -----
vms                            {WV420247, WV420225, WV420122, sc420004...}
date                           10/13/2014 9:32:07 AM

ii)
evm log errors after refresh provider:

[----] E, [2014-10-13T09:03:12.811716 #2054:ffd00c] ERROR -- : MIQ(MiqQueue.deliver)    Message id: [667843], Error: [un
defined method `[]' for nil:NilClass]
[----] E, [2014-10-13T09:03:12.818557 #2054:ffd00c] ERROR -- : [NoMethodError]: undefined method `[]' for nil:NilClass  
Method:[rescue in deliver]
[----] E, [2014-10-13T09:03:12.818636 #2054:ffd00c] ERROR -- : /var/www/miq/vmdb/app/models/ems_refresh/parsers/scvmm.rb
:475:in `block in identify_primary_ip'
/var/www/miq/vmdb/app/models/ems_refresh/parsers/scvmm.rb:473:in `each'
/var/www/miq/vmdb/app/models/ems_refresh/parsers/scvmm.rb:473:in `identify_primary_ip'
/var/www/miq/vmdb/app/models/ems_refresh/parsers/scvmm.rb:111:in `parse_host'
/var/www/miq/vmdb/app/models/ems_refresh/parsers/scvmm.rb:49:in `block in get_hosts'
/var/www/miq/vmdb/app/models/ems_refresh/parsers/scvmm.rb:529:in `block in process_collection'
/var/www/miq/vmdb/app/models/ems_refresh/parsers/scvmm.rb:528:in `each'
/var/www/miq/vmdb/app/models/ems_refresh/parsers/scvmm.rb:528:in `process_collection'
/var/www/miq/vmdb/app/models/ems_refresh/parsers/scvmm.rb:49:in `get_hosts'
/var/www/miq/vmdb/app/models/ems_refresh/parsers/scvmm.rb:26:in `ems_inv_to_hashes'
/var/www/miq/vmdb/app/models/ems_refresh/parsers/scvmm.rb:8:in `ems_inv_to_hashes'
/var/www/miq/vmdb/app/models/ems_refresh/refreshers/scvmm_refresher.rb:23:in `block in refresh'
/var/www/miq/vmdb/app/models/ems_refresh/refreshers/scvmm_refresher.rb:12:in `each'
/var/www/miq/vmdb/app/models/ems_refresh/refreshers/scvmm_refresher.rb:12:in `refresh'
/var/www/miq/vmdb/app/models/ems_refresh/refreshers/base_refresher.rb:8:in `refresh'
/var/www/miq/vmdb/app/models/ems_refresh.rb:76:in `block in refresh'
/var/www/miq/vmdb/app/models/ems_refresh.rb:75:in `each'
/var/www/miq/vmdb/app/models/ems_refresh.rb:75:in `refresh'
/var/www/miq/vmdb/app/models/miq_queue.rb:361:in `block in deliver'
/opt/rh/ruby193/root/usr/share/ruby/timeout.rb:69:in `timeout'
/var/www/miq/vmdb/app/models/miq_queue.rb:357:in `deliver'
/var/www/miq/vmdb/lib/workers/queue_worker_base.rb:107:in `deliver_queue_message'
/var/www/miq/vmdb/lib/workers/queue_worker_base.rb:135:in `deliver_message'
/var/www/miq/vmdb/lib/workers/queue_worker_base.rb:152:in `block in do_work'
/var/www/miq/vmdb/lib/workers/queue_worker_base.rb:146:in `loop'
/var/www/miq/vmdb/lib/workers/queue_worker_base.rb:146:in `do_work'
/var/www/miq/vmdb/lib/workers/worker_base.rb:317:in `block in do_work_loop'
/var/www/miq/vmdb/lib/workers/worker_base.rb:314:in `loop'
/var/www/miq/vmdb/lib/workers/worker_base.rb:314:in `do_work_loop'
/var/www/miq/vmdb/lib/workers/worker_base.rb:135:in `run'
/var/www/miq/vmdb/lib/workers/worker_base.rb:123:in `start'
/var/www/miq/vmdb/lib/workers/worker_base.rb:23:in `start_worker'
/var/www/miq/vmdb/lib/workers/bin/worker.rb:5:in `<top (required)>'
/opt/rh/ruby193/root/usr/local/share/gems/bundler/gems/rails-f9749c2ef83b/railties/lib/rails/commands/runner.rb:52:in `e
val'
/opt/rh/ruby193/root/usr/local/share/gems/bundler/gems/rails-f9749c2ef83b/railties/lib/rails/commands/runner.rb:52:in `<
top (required)>'
/opt/rh/ruby193/root/usr/local/share/gems/bundler/gems/rails-f9749c2ef83b/railties/lib/rails/commands.rb:64:in `require'
/opt/rh/ruby193/root/usr/local/share/gems/bundler/gems/rails-f9749c2ef83b/railties/lib/rails/commands.rb:64:in `<top (re
quired)>'
script/rails:6:in `require'
script/rails:6:in `<main>'
[----] I, [2014-10-13T09:03:12.818868 #2054:ffd00c]  INFO -- : MIQ(MiqQueue.delivered)  Message id: [667843], State: [er
ror], Delivered in [153.345743455] seconds

and scvmm log:

[----] I, [2014-10-13T03:48:41.651847 #29952:eaa808]  INFO -- : MIQ(EmsRefresh::Parsers::Scvmm.ems_inv_to_hashes) Collecting data for EMS name: [SCVMM] id: [11]...
[----] E, [2014-10-13T05:48:44.008550 #20718:5fa80c] ERROR -- : MIQ(Class#log_dos_error_results) 'uname' is not recognized as an internal or external command,
operable program or batch file.

[----] I, [2014-10-13T05:48:47.892993 #29952:eaa808]  INFO -- : MIQ(EmsRefresh::Parsers::Scvmm.ems_inv_to_hashes) Collecting data for EMS name: [SCVMM] id: [11]...
[----] E, [2014-10-13T07:45:33.674263 #2054:ffd00c] ERROR -- : MIQ(Class#log_dos_error_results) 'uname' is not recognized as an internal or external command,
operable program or batch file.

[----] I, [2014-10-13T07:46:08.860441 #2054:ffd00c]  INFO -- : MIQ(EmsRefresh::Parsers::Scvmm.ems_inv_to_hashes) Collecting data for EMS name: [SCVMM] id: [11]...
[----] E, [2014-10-13T07:54:25.603143 #2125:816014] ERROR -- : MIQ(Class#log_dos_error_results) 'uname' is not recognized as an internal or external command,
operable program or batch file.

[----] E, [2014-10-13T07:54:38.476861 #2086:992014] ERROR -- : MIQ(Class#log_dos_error_results) 'uname' is not recognized as an internal or external command,
operable program or batch file.

iii) No,

Thanks for reply.

Hi @ksvoboda
This was helpful, the code is tripping up on the following method:

def identify_primary_ip(nics)
  nics.each do |nic|
    next if nic[:Props][:UsedForManagement] == false
    return nic[:Props][:IPAddresses][0][:MS][:IPAddressToString]
  end
end 

this method extracts the IP Addresses for the Hyper V hosts from the data returned from Powershell, we need to check if the data is in the format we are expecting. Can you please add the following line to the above method:

$scvmm_log.info("NICS: #{nics.inspect}")

This method can be found here: /var/www/miq/vmdb/app/models/ems_refresh/parsers/scvmm.rb:470

Once you paste this line the entire method will look like this:

def identify_primary_ip(nics)
  $scvmm_log.info("NICS: #{nics.inspect}")
  nics.each do |nic|
    next if nic[:Props][:UsedForManagement] == false
    return nic[:Props][:IPAddresses][0][:MS][:IPAddressToString]
  end
end

For this to take effect you will need to restart the server and refresh the SCVMM provider. Then please paste the output into this post. There will likely be a lot of logging written to the scvmm.log file so just paste the output for one host.

Small part of big log…

[----] I, [2014-10-14T09:34:43.914756 #2060:757010] INFO – : NICS: [{:ToString=>“Ethernet - HP CN1100E Converged Network Adapter #2”, :Props=>{:Name=>“HP CN1100E Converged Network Adapter #2”, :IPAddresses=>[], :DHCPEnabled=>true, :IPSubnets=>[], :DefaultIPGateways=>[], :MacAddress=>“FC15B44383E4 “, :PhysicalAddress=>“FC15B44383E4 “, :NetworkLocation=>nil, :VirtualNetwork=>nil, :NetworkSwitchPort=>nil, :UplinkPortProfileSet=>nil, :VLanTags=>[], :UsableVLanTags=>[], :VLanMode=>{:ToString=>“Trunk”, :I32=>1}, :DesiredVLanMode=>{:ToString=>“Trunk”, :I32=>1}, :VLanEnabled=>true, :ConnectionState=>{:ToString=>“Failed”, :I32=>3}, :ConnectionName=>“Ethernet”, :Description=>nil, :PrimaryDNSSuffix=>nil, :MaxBandwidth=>10000, :VMHost=>{:ToString=>“hv4252.rwegroup.cz”, :Props=>{:RunAsAccount=>{:ToString=>“VMM Admin”, :Props=>{:Name=>“VMM Admin”, :UserName=>“SCVMM_Admin”, :Domain=>“rwegroup”, :Enabled=>true, :IsBuiltIn=>false, :GrantedToList=>[], :UserRoleID=>“75700cd5-893e-4f68-ada7-50ef4668acc6”, :UserRole=>{:ToString=>“Administrator”, :Props=>{:UserRolePath=>“Administrator”, :Name=>“Administrator”, :ParentUserRole=>nil, :Description=>“Administrator User Role”, :Members=>[”(UserOrGroup#0) { }”, “(UserOrGroup#0) { }”, “(UserOrGroup#0) { }”, “(UserOrGroup#0) { }”, “(UserOrGroup#0) { }”, “(UserOrGroup#0) { }”], :Profile=>“Administrator”, :UserRoleProfile=>“Administrator”, :MarkedForDeletion=>false, :ServerConnection=>“Microsoft.SystemCenter.VirtualMachineManager.Remoting.ServerConnection”, :ID=>“75700cd5-893e-4f68-ada7-50ef4668acc6”, :IsViewOnly=>false, :ObjectType=>“UserRole”, :IsFullyCached=>true}}, :Owner=>“RWEGROUP\afbenda”, :ObjectType=>“RunAsAccount”, :Accessibility=>“Public”, :IsViewOnly=>false, :Description=>“VMM Roles Admin”, :AddedTime=>2014-10-14 11:33:16 +0200, :ModifiedTime=>2014-10-14 11:33:16 +0200, :MostRecentTask=>nil, :ServerConnection=>{:ToString=>“Microsoft.SystemCenter.VirtualMachineManager.Remoting.ServerConnection”, :Props=>{:Name=>“localhost”, :Port=>8100, :IsConnected=>true, :ServerInterfaceVersion=>“2.1.0”, :Profile=>“Administrator”, :UserRole=>{:ToString=>“Administrator”, :Props=>{:UserRolePath=>“Administrator”, :Name=>“Administrator”, :ParentUserRole=>nil, :Description=>“Administrator User Role”, :Members=>[”(UserOrGroup#0) { }”, “(UserOrGroup#0) { }”, “(UserOrGroup#0) { }”, “(UserOrGroup#0) { }”, “(UserOrGroup#0) { }”, “(UserOrGroup#0) { }”], :Profile=>“Administrator”, :UserRoleProfile=>“Administrator”, :MarkedForDeletion=>false, :ServerConnection=>“Microsoft.SystemCenter.VirtualMachineManager.Remoting.ServerConnection”, :ID=>“75700cd5-893e-4f68-ada7-50ef4668acc6”, :IsViewOnly=>false, :ObjectType=>“UserRole”, :IsFullyCached=>true}}, :UserRoleId=>“75700cd5-893e-4f68-ada7-50ef4668acc6”, :FullyQualifiedDomainName=>“sc420004.rwegroup.cz”, :FQDN=>“sc420004.rwegroup.cz”, :Channel=>{:ToString=>“Microsoft.VirtualManager.Remoting.IVirtualManagerService”}, :ObjectCache=>{:ToString=>“Microsoft.SystemCenter.VirtualMachineManager.ClientCache”, :Props=>{:RelationshipTable=>“Microsoft.SystemCenter.VirtualMachineManager.RelationshipTable”}}, :OpsMgrServer=>“sc420007.rwegroup.cz”, :CEIPOptIn=>false, :VMRCAccessAccount=>nil, :VMRCDefaultPort=>5900, :VMConnectDefaultPort=>2179, :MinimumSupportedAgentVersion=>“2.0.4271.0”, :MinimumSupportedGuestAgentVersion=>“3.0.1469.0”, :LibraryRefresherEnabled=>true, :LibraryRefresherFrequency=>2, :DatabaseServerName=>“WC420112”, :DatabaseInstanceName=>“WC420112\SCVMM”, :DatabaseName=>“VirtualManagerDB”, :ConnectedUserName=>“RWEGROUP\aksvoboda”, :ConnectedUserGroups=>{:ToString=>“Microsoft.VirtualManager.Remoting.AccountCollection”}, :UserName=>“Windows User”, :CompanyName=>“RWE IT Czech”, :ProductVersion=>“3.2.7672.0”, :ProductID=>“03535-092-6002024-02354”, :LicenseType=>“Volume”, :EvaluationDaysLeft=>0, :ManagedComputer=>[{:ToString=>“sc420003.rwegroup.cz”, :Props=>{:StateString=>“Responding”, :RoleString=>“VMM Server”, :State=>“Responding”, :VersionState=>“UpToDate”, :VersionStateString=>“Up-to-date”, :MarkedForDeletion=>false, :Name=>“sc420003.rwegroup.cz”, :MostRecentTaskID=>nil, :MostRecentTaskUIState=>nil, :MostRecentTask=>nil, :FullyQualifiedDomainName=>“sc420003.rwegroup.cz”, :FQDN=>“sc420003.rwegroup.cz”, :ComputerName=>“sc420003”, :Description=>“Virtual Machine Manager Server agent”, :AgentVersion=>“3.2.7510.0”, :Role=>“VMMServerRole”, :UpdatedDate=>2014-05-31 14:35:42 +0200, :ComplianceStatus=>nil, :ServerConnection=>“Microsoft.SystemCenter.VirtualMachineManager.Remoting.ServerConnection”, :ID=>“e25ddb98-bfa2-44cc-814d-b74c060b0ee5”, :IsViewOnly=>false, :ObjectType=>“AgentServer”, :IsFullyCached=>true, :MostRecentTaskIfLocal=>nil}}, {:ToString=>“sc420004.rwegroup.cz”, :Props=>{:StateString=>“Responding”, :RoleString=>“VMM Server”, :State=>“Responding”, :VersionState=>“UpToDate”, :VersionStateString=>“Up-to-date”, :MarkedForDeletion=>false, :Name=>“sc420004.rwegroup.cz”, :MostRecentTaskID=>nil, :MostRecentTaskUIState=>nil, :MostRecentTask=>nil, :FullyQualifiedDomainName=>“sc420004.rwegroup.cz”, :FQDN=>“sc420004.rwegroup.cz”, :ComputerName=>“sc420004”, :Description=>“Virtual Machine Manager Server agent”, :AgentVersion=>“3.2.7510.0”, :Role=>“VMMServerRole”, :UpdatedDate=>2014-05-31 16:19:50 +0200, :ComplianceStatus=>nil, :ServerConnection=>“Microsoft.SystemCenter.VirtualMachineManager.Remoting.ServerConnection”, :ID=>“c08d78c7-45c1-4e28-b705-186510955dd5”, :IsViewOnly=>false, :ObjectType=>“AgentServer”, :IsFullyCached=>true, :MostRecentTaskIfLocal=>nil}}], :VMMServiceAccount=>“RWEGROUP\svc_SCVMM”, :IsHighlyAvailable=>true, :FailoverVMMNodes=>[“sc420003.rwegroup.cz”, “sc420004.rwegroup.cz”], :ActiveVMMNode=>“sc420004.rwegroup.cz”, :AutomaticLogicalNetworkCreationEnabled=>true, :AutomaticVirtualNetworkCreationEnabled=>false, :LogicalNetworkMatchOption=>“FirstDNSSuffixLabel”, :BackupLogicalNetworkMatchOption=>“VirtualNetworkSwitchName”, :ForOnBehalfOf=>false}}, :ID=>“7f3f3ba4-6f6d-4832-a41e-ee8b9fab0735”, :MarkedForDeletion=>false, :IsFullyCached=>true, :MostRecentTaskIfLocal=>nil}}, :MostRecentTaskID=>“0cbec80d-2e4a-45d2-90bd-28d09c006d99”, :MostRecentTaskUIState=>“Failed”, :MostRecentTask=>“Refresh virtual machine properties”, :OverallStateString=>“In Maintenance Mode”, :OverallState=>“MaintenanceMode”, :CommunicationStateString=>“Responding”, :CommunicationState=>“Responding”, :Name=>“hv4252.rwegroup.cz”, :FullyQualifiedDomainName=>“hv4252.rwegroup.cz”, :ComputerName=>“hv4252”, :DomainName=>“rwegroup.cz”, :Description=>nil, :RemoteUserName=>nil, :OverrideHostGroupReserves=>false, :CPUPercentageReserve=>10, :NetworkPercentageReserve=>0, :DiskSpaceReserveMB=>10240, :MaxDiskIOReservation=>10000, :MemoryReserveMB=>2048, :VMPaths=>[“C:\ClusterStorage\VHD_SID142_CLD_1A9D_HVC2\”], :BaseDiskPaths=>["\\wr420008.rwegroup.cz\RestoreTests"], :PROEnabled=>false, :MaintenanceHost=>true, :AvailableForPlacement=>true, :IsEmbedded=>false, :CredentialsNeeded=>false, :LogicalProcessorCount=>32, :PhysicalCPUCount=>2, :CoresPerCPU=>16, :L2CacheSize=>3072, :L3CacheSize=>30720, :BusSpeed=>100, :ProcessorSpeed=>2593, :ProcessorModel=>“Xeon”, :ProcessorManufacturer=>“Intel”, :ProcessorArchitecture=>9, :ProcessorFamily=>“179”, :CpuUtilization=>3, :TotalMemory=>274841485312, :AvailableMemory=>256911, :OperatingSystem=>“Microsoft Windows Server 2012 R2 Datacenter “, :OperatingSystemVersion=>“6.3.9600”, :DVDDrives=>nil, :DVDDriveList=>[], :VirtualizationPlatformString=>“Microsoft Hyper-V”, :VirtualizationPlatform=>“HyperV”, :VirtualizationPlatformDetail=>“Microsoft Hyper-V”, :IsVirtualizationSoftwareDetailUnknown=>false, :IsViridianHost=>true, :SupportsLiveMigration=>true, :FloppyDrives=>nil, :FloppyDriveList=>[], :VMHostGroup=>{:ToString=>“All Hosts\Compute\Dev-Test”, :Props=>{:IsRoot=>false, :CreationDate=>2014-07-24 17:56:40 +0200, :Creator=>“RWEGROUP\afbenda”, :Description=>nil, :ModificationDate=>2014-07-31 02:33:49 +0200, :ModifiedBy=>“RWEGROUP\afbenda”, :Name=>“Dev-Test”, :ParentVMHostGroup=>“All Hosts\Compute”, :ParentHostGroup=>“All Hosts\Compute”, :Path=>“All Hosts\Compute\Dev-Test”, :Hosts=>[“hv4252.rwegroup.cz”, {:ToString=>“hv4202.rwegroup.cz”, :Props=>{:RunAsAccount=>“VMM Admin”, :MostRecentTaskID=>“b0d62792-97ea-434e-8b03-f5050d2ba678”, :MostRecentTaskUIState=>“SucceedWithInfo”, :MostRecentTask=>“Invoke script command (cmd.exe /q /c msiexec /i dhcpextn.msi)”, :OverallStateString=>“OK”, :OverallState=>“OK”, :CommunicationStateString=>“Responding”, :CommunicationState=>“Responding”, :Name=>“hv4202.rwegroup.cz”, :FullyQualifiedDomainName=>“hv4202.rwegroup.cz”, :ComputerName=>“hv4202”, :DomainName=>“rwegroup.cz”, :Description=>nil, :RemoteUserName=>nil, :OverrideHostGroupReserves=>false, :CPUPercentageReserve=>10, :NetworkPercentageReserve=>0, :DiskSpaceReserveMB=>10240, :MaxDiskIOReservation=>10000, :MemoryReserveMB=>2048, :VMPaths=>[“C:\ClusterStorage\VHD_SID043_BRONZE_1ADD_HVC2”, “C:\ClusterStorage\VHD_SID043_BRONZE_1AFD_HVC2”, “C:\ClusterStorage\VHD_SID043_CLD_1A9D_HVC2”, “C:\ClusterStorage\VHD_SID043_CLD_1ABD_HVC2”, “C:\ClusterStorage\VHD_SID142_BRONZE_1ADD_HVC2”, “C:\ClusterStorage\VHD_SID142_BRONZE_1AFD_HVC2”, “C:\ClusterStorage\VHD_SID142_CLD_1A9D_HVC2”, “C:\ClusterStorage\VHD_SID142_CLD_1ABD_HVC2”], :BaseDiskPaths=>[”\\wr420008.rwegroup.cz\RestoreTests”], :PROEnabled=>false, :MaintenanceHost=>false, :AvailableForPlacement=>true, :IsEmbedded=>false, :CredentialsNeeded=>false, :LogicalProcessorCount=>32, :PhysicalCPUCount=>2, :CoresPerCPU=>16, :L2CacheSize=>3072, :L3CacheSize=>30720, :BusSpeed=>100, :ProcessorSpeed=>2594, :ProcessorModel=>“Xeon”, :ProcessorManufacturer=>“Intel”, :ProcessorArchitecture=>9, :ProcessorFamily=>“179”, :CpuUtilization=>39, :TotalMemory=>274841485312, :AvailableMemory=>136443, :OperatingSystem=>"Microsoft Windows Server 2012 R2 Datacenter ", :OperatingSystemVersion=>“6.3.9600”, :DVDDrives=>nil, :DVDDriveList=>[], :VirtualizationPlatformString=>“Microsoft Hyper-V”, :VirtualizationPlatform=>“HyperV”, :VirtualizationPlatformDetail=>“Microsoft Hyper-V”, :IsVirtualizationSoftwareDetailUnknown=>false, :IsViridianHost=>true, :SupportsLiveMigration=>true, :FloppyDrives=>nil, :FloppyDriveList=>[], :VMHostGroup=>“All Hosts\Compute\Dev-Test”, :HostCluster=>“hvc2.rwegroup.cz”, :RemoteConnectEnabled=>true, :RemoteConnectPort=>2179, :SecureRemoteConnectEnabled=>false, :VMRCCertificateAvailable=>false, :EnableLiveMigration=>true, :LiveMigrationMaximum=>4, :LiveStorageMigrationMaximum=>4, :UseAnyMigrationSubnet=>false,

Hello All,

Can any one confirm is ManageIq able to integrate with SVCMM. Help is highly appricated.

@ksvoboda

The problem is that the data returned by Powershell contains no IP addresses for the HyperV host in your sample output. To handle this gracefully you can replace the method identify_primary_ip with the following and then restart the server:

def identify_primary_ip(nics)
  nics.each do |nic|
    next if nic[:Props][:UsedForManagement] == false
    return nic[:Props][:IPAddresses].empty? ? nil : nic[:Props][:IPAddresses][0][:MS][:IPAddressToString]
  end
end

Without visibility into your SCVMM environment i cannot tell why the IP addressees are missing, but it looks like there are some networking issues with your HyperV environment.

Thanks for help.
We have NIC teaming on hyper-v hosts. And this is the reason why powershell script does not return IP addresses. Get-VMHostNetworkAdapter cmdlet works only with physical adapters and therefore does not return any IP addresses.

Get-VMHostNetworkAdapter | select IPAddresses
IPAddresses -----------
{}
{}
{}
{}
After modification identify_primary_ip method I see some hosts and most VMs. It’s not perfect, but it’s progress.
Thank you very much

@ksvoboda
Are there any other details in the logs that indicate why some hosts/VMs are missing? Errors or warnings? Are the missing VMs returned by the cmdlet: Get-SCVirtualMachine Are the missing hosts returned by the cmdlet: Get-SCVMHost.

FYI - i made a PR for the code change that gracefully handles an environment with no host IPs.

thanks

@chandrahasa01
Yes, but it is new. For me to help you I need some visibility into what is happening, a first step is to paste into this thread any errors or warnings found in the evm.log and scvmm.log, as requested above.

Many thanks

scvm.log - hosts:

[----] E, [2014-10-16T13:32:49.911464 #3279:10de804] ERROR – : MIQ(abstract_adapter) Name: [Host Load], Message: [PGError: ERROR: missing FROM-clause entry for table “ipaddress”
[----] E, [2014-10-16T13:32:49.911736 #3279:10de804] ERROR – : MIQ(EmsRefresh.save_hosts_inventory) EMS: [SCVMM], id: [1] Processing Host: [Hv4201.rwegroup.cz] failed with error [ActiveRecord::StatementInvalid: Database statement error encountered]. Skipping Host.
[----] E, [2014-10-16T13:32:49.911961 #3279:10de804] ERROR – : [ActiveRecord::StatementInvalid]: Database statement error encountered Method:[rescue in block in save_hosts_inventory]
[----] E, [2014-10-16T13:32:49.912127 #3279:10de804] ERROR – : /opt/rh/ruby193/root/usr/local/share/gems/bundler/gems/rails-f9749c2ef83b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:1348:in async_exec' [----] E, [2014-10-16T13:32:50.809060 #3279:10de804] ERROR -- : MIQ(abstract_adapter) Name: [SQL], Message: [PGError: ERROR: value too long for type character varying(255) [----] E, [2014-10-16T13:32:50.809781 #3279:10de804] ERROR -- : MIQ(EmsRefresh.save_hosts_inventory) EMS: [SCVMM], id: [1] Processing Host: [hv4253.rwegroup.cz] failed with error [ActiveRecord::StatementInvalid: Database statement error encountered]. Skipping Host. [----] E, [2014-10-16T13:32:50.809920 #3279:10de804] ERROR -- : [ActiveRecord::StatementInvalid]: Database statement error encountered Method:[rescue in block in save_hosts_inventory] [----] E, [2014-10-16T13:32:50.810005 #3279:10de804] ERROR -- : /opt/rh/ruby193/root/usr/local/share/gems/bundler/gems/rails-f9749c2ef83b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:1363:inget_last_result’
[----] E, [2014-10-16T13:32:51.834800 #3279:10de804] ERROR – : MIQ(abstract_adapter) Name: [Host Load], Message: [PGError: ERROR: missing FROM-clause entry for table “ipaddress”
[----] E, [2014-10-16T13:32:51.834906 #3279:10de804] ERROR – : MIQ(EmsRefresh.save_hosts_inventory) EMS: [SCVMM], id: [1] Processing Host: [wr420008.rwegroup.cz] failed with error [ActiveRecord::StatementInvalid: Database statement error encountered]. Skipping Host.
[----] E, [2014-10-16T13:32:51.835039 #3279:10de804] ERROR – : [ActiveRecord::StatementInvalid]: Database statement error encountered Method:[rescue in block in save_hosts_inventory]
[----] E, [2014-10-16T13:32:51.835111 #3279:10de804] ERROR – : /opt/rh/ruby193/root/usr/local/share/gems/bundler/gems/rails-f9749c2ef83b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:1348:in `async_exec’
[----] E, [2014-10-16T13:32:52.881946 #3279:10de804] ERROR – : MIQ(abstract_adapter) Name: [Host Load], Message: [PGError: ERROR: missing FROM-clause entry for table “ipaddress”
[----] E, [2014-10-16T13:32:52.882059 #3279:10de804] ERROR – : MIQ(EmsRefresh.save_hosts_inventory) EMS: [SCVMM], id: [1] Processing Host: [hv4251.rwegroup.cz] failed with error [ActiveRecord::StatementInvalid: Database statement error encountered]. Skipping Host.

and some VMs:

[----] E, [2014-10-16T13:32:53.967568 #3279:10de804] ERROR – : MIQ(EmsRefresh.save_vms_inventory) EMS: [SCVMM], id: [1] Processing Vm: [sc420007] failed with error [Database statement error encountered]. Skipping Vm.
[----] E, [2014-10-16T13:32:53.967705 #3279:10de804] ERROR – : [ActiveRecord::RecordNotUnique]: Database statement error encountered Method:[rescue in block in save_vms_inventory]
[----] E, [2014-10-16T13:32:53.967787 #3279:10de804] ERROR – : /opt/rh/ruby193/root/usr/local/share/gems/bundler/gems/rails-f9749c2ef83b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:1348:in async_exec' [----] E, [2014-10-16T13:32:54.027567 #3279:10de804] ERROR -- : MIQ(abstract_adapter) Name: [], Message: [PGError: ERROR: duplicate key value violates unique constraint "index_storages_vms_on_vm_id_and_storage_id" [----] E, [2014-10-16T13:32:54.028409 #3279:10de804] ERROR -- : MIQ(EmsRefresh.save_vms_inventory) EMS: [SCVMM], id: [1] Processing Vm: [WV420165] failed with error [Database statement error encountered]. Skipping Vm. [----] E, [2014-10-16T13:32:54.028531 #3279:10de804] ERROR -- : [ActiveRecord::RecordNotUnique]: Database statement error encountered Method:[rescue in block in save_vms_inventory] [----] E, [2014-10-16T13:32:54.028613 #3279:10de804] ERROR -- : /opt/rh/ruby193/root/usr/local/share/gems/bundler/gems/rails-f9749c2ef83b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:1348:inasync_exec’
[----] E, [2014-10-16T13:32:54.128346 #3279:10de804] ERROR – : MIQ(abstract_adapter) Name: [], Message: [PGError: ERROR: duplicate key value violates unique constraint “index_storages_vms_on_vm_id_and_storage_id”
[----] E, [2014-10-16T13:32:54.129172 #3279:10de804] ERROR – : MIQ(EmsRefresh.save_vms_inventory) EMS: [SCVMM], id: [1] Processing Vm: [WV420273] failed with error [Database statement error encountered]. Skipping Vm.
[----] E, [2014-10-16T13:32:54.129315 #3279:10de804] ERROR – : [ActiveRecord::RecordNotUnique]: Database statement error encountered Method:[rescue in block in save_vms_inventory]
[----] E, [2014-10-16T13:32:54.129397 #3279:10de804] ERROR – : /opt/rh/ruby193/root/usr/local/share/gems/bundler/gems/rails-f9749c2ef83b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:1348:in async_exec' [----] E, [2014-10-16T13:32:54.368254 #3279:10de804] ERROR -- : MIQ(abstract_adapter) Name: [], Message: [PGError: ERROR: duplicate key value violates unique constraint "index_storages_vms_on_vm_id_and_storage_id" [----] E, [2014-10-16T13:32:54.368963 #3279:10de804] ERROR -- : MIQ(EmsRefresh.save_vms_inventory) EMS: [SCVMM], id: [1] Processing Vm: [WV420191_Test_Memory_Leak!] failed with error [Database statement error encountered]. Skipping Vm. [----] E, [2014-10-16T13:32:54.369072 #3279:10de804] ERROR -- : [ActiveRecord::RecordNotUnique]: Database statement error encountered Method:[rescue in block in save_vms_inventory] [----] E, [2014-10-16T13:32:54.369151 #3279:10de804] ERROR -- : /opt/rh/ruby193/root/usr/local/share/gems/bundler/gems/rails-f9749c2ef83b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:1348:inasync_exec’
[----] E, [2014-10-16T13:32:54.513112 #3279:10de804] ERROR – : MIQ(abstract_adapter) Name: [], Message: [PGError: ERROR: duplicate key value violates unique constraint “index_storages_vms_on_vm_id_and_storage_id”
[----] E, [2014-10-16T13:32:54.513980 #3279:10de804] ERROR – : MIQ(EmsRefresh.save_vms_inventory) EMS: [SCVMM], id: [1] Processing Vm: [WV420274] failed with error [Database statement error encountered]. Skipping Vm.

@ksvoboda
Are the missing hosts the ones with NIC teaming configured? Or is NIC teaming used for all your hyperv hosts?
Was the database modified? By the way, after implementing the code change (to the identify_primary_ip method) i suggest removing the SCVMM provider from the UI and adding it again.

I will look further into these errors and get back to you…