Tag Archives: hyper-v

System Center Virtual Machine Manager版本列表

找到SCVMM版本列表,在博客记录一下。

Continue reading

Advertisements

Core mode of Windows Server 2016 TP3 – Remote Management Tip

Microsoft just released technical preview 3 of Windows Server 2016, it’s catching up VMware on SDDC. I can see a lot of enhancement in the new version. A stable hypervisor is  prerequisite of SDDC but it’s weakness of Microsoft. You have to patch and reboot frequently, some organizations even have regular reboot schedules. Microsoft introduced core mode on Windows Server 2008, it much enhanced on Windows Server 2012 R2. But Windows Server 2012 R2 aims to SBM. I didn’t think SBM organizations really need that if you compare operation complexity of core mode with GUI.

Continue reading

How to find corresponded physical disk for Hyper-V CSV volumes

CSV (Cluster Shared Volume) is fundamental of Microsoft Hyper-V. You must have it to leverage Live Migration and High Availability features. But it’s very confuse when you want to reclaim CSV since CSV is using different name with physical disks. For example, CSV name usually is “Cluster Disk x”, path usually is “C:ClusterStorageVolumeX”. But real disk name is “Disk x” in Disk Manager. You have to very carefully when delete the disk.

Continue reading

How to Delete a Pending Host from SCVMM 2012 R2

A Hyper-V host shows Pending status under VMs and Services section, the host invisible under Fabric section.

You may experience following symptoms when you re-add the Hyper-V host to SCVMM 2012 R2.

There were no computers discovered based on your inputs. Please verify the following:

  • Your Virtual Machine Manager Server service account has at least read access to the Active Directory domain you requested to discover.
  • Your Virtual Machine Manager Server has access to the computer in the discovery scope.
  • The servers you specified are powered on and running.
  • You specified valid credentials to access the servers.
  • The user account that you specified has Administrator privileges on the Windows servers to be discovered.
  • The servers you specified are already managed by Virtual Machine Manager.

You may see following error when you try to delete the Hyper-V host from SCVMM 2012 R2.

Error (2606)

Unable to perform the job because one or more of the selected objects are locked by another job.

Recommended Action

To find out which job is locking the object, in the Jobs view, group by Status, and find the running or canceling job for the object. When the job is complete, try again.

 

That’s because the Hyper-V host was not added to SCVMM 2012 R2 properly when you first time add it to SCVMM 2012 R2.

Variously reason lead to this issue. It cannot be fixed by restart 2012 R2 services, reboot Hyper-V host, reboot SCVMM 2012 R2 server or force delete by PowerShell command Remove-SCVMHost.

You have to manually delete the host record in SCVMM 2012 R2 SQL database.

HostID is unique ID correspond with each Hyper-V host in SCVMM 2012 R2 database, so basically we need to delete everything related to the target HostID.

The only article about that is How to manually remove a host from the VMM database, but it’s for VMM2008. If you take a look the tables of SCVMM 2012 R2 database, it’s more complicate. I would like to share how I did it. Since everybody may have different situation, I’m going to show you a generic way.

  1. Create a temp share folder on SQL database server. Grant READ/WRITE permission to EVERYONE.
  2. Launch SCVMM 2012 R2 console.
  3. Go to SettingsGeneralBackup.
  4. Enter the share path then click OK to backup SCVMM 2012 R2 database.
  5. Launch SQL Management Studio.
  6. Select SCVMM 2012 R2 database.
  7. Open table tbl_ADHC_Host and find out HostID of the target host.
  8. Right click the database and select New query.
  9. Run query below. (Replace ‘HostID’

    by real one)
    SELECT * FROM tbl_ADHC_Host WHERE (HostID = ‘HostID’)
  10. It returns the host records in tbl_ADHC_Host table.

You can run following query to try deleting basic information of the host. (Replace ‘HostID’
and @computername by real one)

DELETE FROM tbl_ADHC_HostNetworkAdapter WHERE (HostID = ‘HostID’)

DELETE FROM tbl_ADHC_VirtualNetwork WHERE (HostID = ‘HostID’)

DELETE FROM tbl_ADHC_HostVolume WHERE (HostID = ‘HostID’)

DELETE FROM tbl_ADHC_HostDisk WHERE (HostID = ‘HostID’)

DELETE FROM tbl_WLC_PhysicalObject WHERE (HostId = ‘HostID’)

DELETE FROM tbl_WLC_VObject WHERE (HostId = ‘HostID’)

DELETE FROM [tbl_ADHC_AgentServerRelation] WHERE AgentServerID = (select top 1 AgentServerID from tbl_ADHC_AgentServer where Computername = @computername)

DELETE FROM [tbl_ADHC_AgentServer] WHERE AgentServerID = (select top 1 AgentServerID from tbl_ADHC_AgentServer where Computername = @computername)

DELETE FROM tbl_ADHC_AgentServer WHERE (ComputerName = @computername)

DELETE FROM tbl_ADHC_ISCSIHbaToTargetMapping where ISCSIHbaID in (select HbaID from tbl_ADHC_HostBusAdapter where(HostID = ‘HostID’))

DELETE FROM tbl_ADHC_HostInternetSCSIHba where ISCSIHbaID in (select HbaID from tbl_ADHC_HostBusAdapter where(HostID = ‘HostID’))

DELETE FROM tbl_ADHC_HostBusAdapter where (HostID = ‘HostID’)

DELETE FROM tbl_ADHC_Host WHERE (HostID = ‘HostID’)

Since a Hyper-V host has lot of hardware, such as network adapter, HBA, virtual network, logical network, WWPN…etc. The query above may not able to delete all related information in database, it returns similar error below:

Msg 547, Level 16, State 0, Line 1

The DELETE statement conflicted with the REFERENCE constraint “fk__NetMan_LogicalNetworkDefinitionToHostGroup__ADHC_HostNetworkAdapter”. The conflict occurred in database “VirtualManagerDB”, table “dbo.tbl_NetMan_HostNetworkAdapterToLogicalNetwork”, column ‘HostNetworkAdapterID’.

Then you have to chase down related key from table NetMan_LogicalNetworkDefinitionToHostGroup and delete the related information first.

I’m not a DB expert, so I have to chase down the error message one by one and manually delete records from tables, you may have better idea. J

Finally DELETE FROM tbl_ADHC_Host WHERE (HostID = ‘HostID’) should be able to execute successfully, then restart SCVMM 2012 R2 service and login console. You will see the pending Hyper-V host disappeared.

****************************************************************************

Updated – 7/22/2014

A script can completely delete a host from SQL DB.

Please backup database before run it!!!!!

+++++++++++++++++++++++++++++++++++++++++++++++

USE VirtualManagerDB;                           // VirtualManagerDB is your database name.

DECLARE @DeleteHostId GUID;

SET @DeleteHostId = ‘<HostID>’            //HostID is the one you want to delete.

PRINT N’Deleting host with GUID ‘ + RTRIM(CAST(@DeleteHostID AS nvarchar(50)))

PRINT N’Getting host cluster GUID’

DECLARE @HostClusterID GUID;

SET @HostClusterID =

(

SELECT HostClusterID FROM [dbo].[tbl_ADHC_Host]

WHERE HostID = @DeleteHostId

)

IF (@HostClusterID IS NOT NULL)

PRINT N’Retreived host cluster GUID ‘ + RTRIM(CAST(@HostClusterID AS nvarchar(50)))

ELSE

PRINT N’This host does not belong to a cluster’

PRINT N’Deleteing physical objects’

DELETE FROM [dbo].[tbl_WLC_PhysicalObject]

WHERE HostId = @DeleteHostId

PRINT N’Deleteing virtual objects’

DELETE FROM [dbo].[tbl_WLC_VObject]

WHERE HostId = @DeleteHostId

PRINT N’Prepairing to delete host network adapters’

DECLARE @HostNetworkAdapterCursor CURSOR;

DECLARE @HostNetworkAdapterID GUID;

SET @HostNetworkAdapterCursor = CURSOR FOR

(SELECT NetworkAdapterID FROM [dbo].[tbl_ADHC_HostNetworkAdapter])

OPEN @HostNetworkAdapterCursor

FETCH NEXT FROM @HostNetworkAdapterCursor INTO @HostNetworkAdapterID

WHILE (@@FETCH_STATUS = 0)

BEGIN

PRINT N’Prepairing to delete host network adapter with GUID ‘ + RTRIM(CAST(@HostNetworkAdapterID AS nvarchar(50)))

PRINT N’Deleting logical network mapping for host network adapter with GUID ‘ + RTRIM(CAST(@HostNetworkAdapterID AS nvarchar(50)))

DELETE FROM [dbo].[tbl_NetMan_HostNetworkAdapterToLogicalNetwork]

WHERE HostNetworkAdapterID = @HostNetworkAdapterID

PRINT N’Deleting IP subnet VLAN mapping for host network adapter with GUID ‘ + RTRIM(CAST(@HostNetworkAdapterID AS nvarchar(50)))

DELETE FROM [dbo].[tbl_NetMan_HostNetworkAdapterToIPSubnetVLan]

WHERE HostNetworkAdapterID = @HostNetworkAdapterID

FETCH NEXT FROM @HostNetworkAdapterCursor INTO @HostNetworkAdapterID

END

CLOSE @HostNetworkAdapterCursor

DEALLOCATE @HostNetworkAdapterCursor

PRINT N’Completing host network adapters deletion’

DELETE FROM [dbo].[tbl_ADHC_HostNetworkAdapter]

WHERE HostID = @DeleteHostId

PRINT N’Deleting virtual networks’

DELETE FROM [dbo].[tbl_ADHC_VirtualNetwork]

WHERE HostID = @DeleteHostId

PRINT N’Deleting virtual switch extensions’

DELETE FROM [dbo].[tbl_NetMan_InstalledVirtualSwitchExtension]

WHERE HostID = @DeleteHostId

PRINT N’Deleting host volumes’

DELETE FROM [dbo].[tbl_ADHC_HostVolume]

WHERE HostID = @DeleteHostId

PRINT N’Deleting pass through disks’

DELETE FROM [dbo].[tbl_WLC_VDrive]

WHERE HostDiskId IN (SELECT DiskID FROM [dbo].[tbl_ADHC_HostDisk] WHERE HostID IN (SELECT HostID FROM [dbo].[tbl_ADHC_Host] WHERE HostID = @DeleteHostId))

PRINT N’Deleting host disks’

DELETE FROM [dbo].[tbl_ADHC_HostDisk]

WHERE HostID = @DeleteHostId

PRINT N’Prepairing to delete host bus adapters’

DECLARE @HostBusAdapterCursor CURSOR;

DECLARE @HostBusAdapterID GUID;

SET @HostBusAdapterCursor = CURSOR FOR

(SELECT HbaID FROM [dbo].[tbl_ADHC_HostBusAdapter])

OPEN @HostBusAdapterCursor

FETCH NEXT FROM @HostBusAdapterCursor INTO @HostBusAdapterID

WHILE (@@FETCH_STATUS = 0)

BEGIN

PRINT N’Prepairing to delete host bus adapter with GUID ‘ + RTRIM(CAST(@HostBusAdapterID AS nvarchar(50)))

PRINT N’Deleting fiber port mapping for host bus adapter with GUID ‘ + RTRIM(CAST(@HostBusAdapterID AS nvarchar(50)))

DECLARE @FiberPortID GUID;

SET @FiberPortID =

(

SELECT PortID FROM [dbo].[tbl_ADHC_FCHbaToFibrePortMapping]

WHERE FCHbaID = @HostBusAdapterID

)

DELETE FROM [dbo].[tbl_ADHC_FCHbaToFibrePortMapping]

WHERE FCHbaID = @HostBusAdapterID

PRINT N’Deleting fiber port with GUID ‘ + RTRIM(CAST(@FiberPortID AS nvarchar(50)))

DELETE FROM [dbo].[tbl_ADHC_FibrePort]

WHERE PortID = @FiberPortID

PRINT N’Deleting fiber channel mapping for host bus adapter with GUID ‘ + RTRIM(CAST(@HostBusAdapterID AS nvarchar(50)))

DELETE FROM [dbo].[tbl_ADHC_HostFibreChannelHba]

WHERE FCHbaID = @HostBusAdapterID

PRINT N’Deleting any iSCSI entries for host bus adapter with GUID ‘ + RTRIM(CAST(@HostBusAdapterID AS nvarchar(50)))

DECLARE @iSCSITargets TABLE

(

TargetID GUID

)

INSERT INTO @iSCSITargets (TargetID)

SELECT TargetID FROM [dbo].[tbl_ADHC_ISCSIHbaToTargetMapping]

WHERE ISCSIHbaID = @HostBusAdapterID

PRINT N’Deleting iSCSI host bus adapter to target mapping for mapping for host bus adapter with GUID ‘ + RTRIM(CAST(@HostBusAdapterID AS nvarchar(50)))

PRINT N’Deleting iSCSI host bus adapter with GUID ‘ + RTRIM(CAST(@HostBusAdapterID AS nvarchar(50)))

DELETE FROM [dbo].[tbl_ADHC_ISCSIHbaToPortalMapping]

WHERE ISCSIHbaID = @HostBusAdapterID 

DELETE FROM [dbo].[tbl_ADHC_ISCSIHbaToTargetMapping]

WHERE ISCSIHbaID = @HostBusAdapterID 

DELETE FROM [dbo].[tbl_ADHC_HostInternetSCSIHba]

WHERE ISCSIHbaID = @HostBusAdapterID

PRINT N’Deleting iSCSI targets for host bus adapter with GUID ‘ + RTRIM(CAST(@HostBusAdapterID AS nvarchar(50)))

DECLARE @iSCSITargetIDCursor CURSOR;

DECLARE @iSCSITargetID GUID;

SET @iSCSITargetIDCursor = CURSOR FOR

(SELECT TargetID FROM @iSCSITargets)

OPEN @iSCSITargetIDCursor

FETCH NEXT FROM @iSCSITargetIDCursor INTO @iSCSITargetID

WHILE (@@FETCH_STATUS = 0)

BEGIN

PRINT N’Deleting iSCSI targets with GUID ‘ + RTRIM(CAST(@iSCSITargetID AS nvarchar(50)))

DELETE FROM [dbo].[tbl_ADHC_ISCSIHbaToTargetMapping]

WHERE TargetID = @iSCSITargetID

DELETE FROM [dbo].[tbl_ADHC_ISCSITarget]

WHERE TargetID = @iSCSITargetID

FETCH NEXT FROM @iSCSITargetIDCursor INTO @iSCSITargetID

END

CLOSE @iSCSITargetIDCursor

DEALLOCATE @iSCSITargetIDCursor

FETCH NEXT FROM @HostBusAdapterCursor INTO @HostBusAdapterID

END

CLOSE @HostBusAdapterCursor

DEALLOCATE @HostBusAdapterCursor

PRINT N’Completing host bus adapters deletion’

DELETE FROM [dbo].[tbl_ADHC_HostBusAdapter]

WHERE HostID = @DeleteHostId

PRINT N’Prepairing to delete agent servers’

DECLARE @AgentServerID  GUID;

SET @AgentServerID =

(

SELECT AgentServerID FROM [dbo].[tbl_ADHC_AgentServerRelation]

WHERE HostLibraryServerID = @DeleteHostID

)

PRINT N’Deleting agent server relations’

DELETE FROM [dbo].[tbl_ADHC_AgentServerRelation]

WHERE HostLibraryServerID = @DeleteHostID

PRINT N’Deleting health monitor data for agent server with GUID ‘ + RTRIM(CAST(@AgentServerID AS nvarchar(50)))

DELETE FROM [dbo].[tbl_ADHC_HealthMonitor]

WHERE AgentServerID = @AgentServerID

PRINT N’Deleting agent server with GUID ‘ + RTRIM(CAST(@AgentServerID AS nvarchar(50)))

DELETE FROM [dbo].[tbl_ADHC_AgentServer]

WHERE AgentServerID = @AgentServerID

PRINT N’Deleting host GPUs’

DELETE FROM [dbo].[tbl_ADHC_HostGPU]

WHERE HostID = @DeleteHostId

PRINT N’Deleting host’

DELETE FROM [dbo].[tbl_ADHC_Host]

WHERE HostID = @DeleteHostId

IF (@HostClusterID IS NOT NULL)

BEGIN

PRINT N’Checking to see if any other hosts are joined to the same cluster’

DECLARE @HostCount INT;

SET @HostCount =

(

SELECT COUNT(*) FROM [dbo].[tbl_ADHC_Host]

WHERE HostClusterID = @HostClusterID

)

PRINT N’There are ‘ + RTRIM(CAST(@HostCount AS nvarchar(50))) + N’ currently joined to the same cluster’

IF (@HostCount = 0)

BEGIN

PRINT N’Deleting cluster disks’

DELETE FROM [dbo].[tbl_ADHC_ClusterDisk]

WHERE ClusterID = @HostClusterID

PRINT N’Deleting cluster’

DELETE FROM [dbo].[tbl_ADHC_HostCluster]

WHERE ClusterID = @HostClusterID

END

ELSE

PRINT N’This host is not the last host in the cluster, the cluster will be deleted upon the deletion of the last host.’

END

ELSE

PRINT N’This host does not belong to a cluster, no clusters will be deleted’

GO

 

How to configure nested Hyper-V VM on VMware Workstation

First, I would like to recommend DELL M4800 for small home lab, I spent lot of time to looking for a solution for my lab, I need some hardware low noise, low weight, and it is better portable. I checked out HP mini server, Apple MAC mini, Mac book pro…etc. They are nice products to show best design of IT industry, but no one perfect. Finally I choose DELL M4800. The reason is RAM can be upgraded to 32GB. 3 SSD hard disks is supported, you can install one native SSD, one in CD-ROM slot, another msata SSD in WAP slot. SSD disk is must have for IT LAB, it can provide you more than 10K IOPS without significant performance degrade.

Okay, back to topic…if you want to testing Windows Server 2012 R2 Hyper-V on lab, you probably prefer install it on a VM of VMware Workstation. You have to follow up proper steps to make sure the Hyper-V functionally.

After you create Hyper-V VM:

  1. Keep VM power off status.
  2. Go to Settings of VM.
  3. Highlight Processors.
  4. Select Virtualize Intel VT-x/EPT or AMD-V/RVI option.
  5. Go to Options tab.
  6. Highlight General.
  7. Select Microsoft Windows.
  8. Select Hyper-V on drop-list.
  9. Power on.

Error 12711 VMM cannot complete the WMI operation on the server because of an error

Finally I implemented Hyper-V 2012 and SCVMM 2012 R2 on my lab, unfortunately FreeNAS does not supports SCSI-3 persistent reservation of Windows Server 2012 R2, you can refer bug #4003. It lead to my iSCSI storage cannot be brought online in Failover Cluster. I have to find out alternative.

I decided to use Windows Server File Server instead of iSCSI eventually. There are bunch of benefit to use that to leverage new SMB 3.0 technology. Key is it supports high available.

Followed the guide I successful created first shares for Hyper-V cluster, I created a testing VM but cannot power it on. It show me:

Error (12711)
VMM cannot complete the WMI operation on the server (dcahyv02.contoso.com) because of an error: [MSCluster_Resource.Name=&quot;SCVMM test (1)&quot;] The cluster resource could not be brought online by the resource monitor.

The cluster resource could not be brought online by the resource monitor (0x139A)

Recommended Action
Resolve the issue and then try the operation again.

I went to cluster service manager on a Hyper-V host, event logs show me:

Cluster resource ‘SCVMM test (1)’ of type ‘Virtual Machine’ in clustered role ‘SCVMM test Resources (1)’ failed. The error code was ‘0x80004005’ (‘Unspecified error’).

Based on the failure policies for the resource and role, the cluster service may try to bring the resource online on this node or move the group to another node of the cluster and then restart it. Check the resource and group state using Failover Cluster Manager or the Get-ClusterResource Windows PowerShell cmdlet.

Initially I suspected that’s a problem of new file server, or SCVMM bug. But problem was it cannot be brought up even I created a VM on Hyper-V host directly. It gave me this error:

Virtual machine ‘test’ could not be started because the hypervisor is not running (Virtual machine ID AE786CAA-C74B-4F9E-8867-30191197087B). The following actions may help you resolve the problem: 1) Verify that the processor of the physical computer has a supported version of hardware-assisted virtualization. 2) Verify that hardware-assisted virtualization and hardware-assisted data execution protection are enabled in the BIOS of the physical computer.  (If you edit the BIOS to enable either setting, you must turn off the power to the physical computer and then turn it back on.  Resetting the physical computer is not sufficient.) 3) If you have made changes to the Boot Configuration Data store, review these changes to ensure that the hypervisor is configured to launch automatically.

Hypervisor is not running… it indicates something related to virtualization layer. I finally realized that I was running Hyper-V host on VMware Workstation on a laptop, it’s twice nested VM, something wrong!

I followed my article How to configure nested Hyper-V VM on VMware Workstation to fix this problem.

Error 2931 The connection to the VMM agent on the virtualization server was lost

Windows Server 2012, the biggest competitor of VMware vSphere. There are adequate reason to use Hyper-V 2012 instead of vSphere 5.x, but it’s still very hard to for newbie, we spend more than 30 hours to try figure out how to create cluster on SCVMM 2012 SP1, the software is easy to install, but hard to configure. I saw “failed” everywhere, it’s not a mature product in my view.

We installed Windows Server 2012 data center edition on HP BL460, storage is NetApp FAS2240 (Maybe wrong, I’m not storage guy). We got following error message when we created Hyper-V Cluster on SCVMM2012 SP1.

Error (2931)
VMM is unable to complete the request. The connection to the VMM agent on the virtualization server (xxx) was lost.
Unknown error (0x80338029)

Recommended Action
Ensure that the Windows Remote Management (WS-Management) service and the VMM agent are installed and running and that a firewall is not blocking HTTPS traffic.

This can also happen due to DNS issues. Try and see if the server (dcahyv04.amat.com) is reachable over the network and can be looked up in DNS. You can ping the virtualization server from VMM management server and make sure that the IP address returned matches the IP address locally obtained from the virtualization server.

If the error still persists, restart the virtualization server, and then try the operation again.

SCVMM job failed on Mounts storage disk on xxxx.

Initially I thought that’s something wrong with services, I checked the mentioned Windows Remote Management service, but it’s up and running. Then I noticed WINS servers was not set, but still no lucky.

Why the job always failed on mount storage? Maybe something related to disk operation? SCVMM server is remote server, it must be operates disk remotely, so I tried connect Hyper-V server by Computer Management tool remotely, it show me RPC is unavailable when I click Disk Management node. Aha…firewall problem, that’s because SCVMM server disabled firewall, but Hyper-V server enabled, the RPC ports was blocked by client side.

Sometimes cluster creating can be successful after I disabled firewall, but still Hyper-V server looks like hard to mount storage.

Since SCVMM mount/unmount storage on each Hyper-V hosts during cluster creating, it takes very long time to mount storage before the job failed, we suspected that’s something related to storage, finally, we installed NetApp Host Utilities 6.0.1 and NTAP MPIO 4.0.1 to solved the problem.

To summarize, you must enable remote management for Hyper-V host, such as Remote Register service…etc, allows required ports in Windows firewall and storage MPIO plugin should be installed as well. BTW, you should disable UAC on Windows Server 2012, it’s different with Windows Server 2008, check http://social.technet.microsoft.com/wiki/contents/articles/13953.windows-server-2012-deactivating-uac.aspx.

That’s just first step to make Hyper-V successful. :)