转载:https://cloud.tencent.com/info/f2105bd1c69780987178a30bbdcc8987.html
1、问题描述:html
客户重装Vcenter以后(Hostname与以前保持一致)出现以下报错:shell
1.计算机目录显示没法联系到vCenter server数据库
2.VM电源状态未知浏览器
3.测试connection出现以下错误:网络
Attempting to connect to the VCenter server failed due to a certificate error.app
Check that the appropriate certificates are installed on the VCenter server and on the same machine as all instances of the Host service.dom
2、解决目标:ide
无需新建Connection,修复现有的链接测试
全部VM电源处于可管理状态ui
3、Workaround:
根据新的vcenter地址新建新的链接并将现有站点中的机器删除后已现有的方式经过新的vcenter地址添加到现有站点中进行管理,具体方法能够参考Citrix官方文档:
Xenserver:
http://support.citrix.com/article/CTX139041
Vmware:
https://support.citrix.com/article/CTX216898
4、根本解决方案
***Note:此方案非citrix官方支持,谨慎使用!
问题一:修复现有的链接,修复现有虚拟机电源状态
1. 在每一台DDC的证书中心中删除原来的vcenter证书
经过MMC加载证书并浏览到路径:证书>受信任的根证书颁发机构>受信任的人
2.在每一台DDC中安装新的vCenter证书(包括根证书)安装方法有两种:
方式一:
a. 将vCenter Server证书拷贝到全部DDC中
证书路径:
vCenter server for Windows:
C:\ProgramData\VMware\vCenterServer\cfg\vmware-vpx\ssl\rui.crt
VCSA:
/etc/vmware-vpx/ssl/rui.crt
b. 导入证书,MMC->Add/Remove Snap-in->Certificates->Add->Computer account->Local computer->Trusted People->Certificates->Import above Certificates
方式二:
浏览器访问vCenter Server, 访问地址如https://server1.domain1.com.
vCenter证书显示于该路径中:Accept the security warnings->Click on the address bar
点击“Install certificate”,选择“Local Machine”,并点击继续
在证书中心中点击“Place all certificates”,并点击“浏览”
1) 若是你使用的是Windows Server 2008 R2:
a. 选择Show physical stores checkbox
b. 展开 Trusted People
c. 选择Local Computer
d. 点击Next,而后点击Finish
2) 若是你使用的是 Windows Server 2012 或者 Windows Server 2012 R2,则:
a. 选择Trusted People, 而后点击 OK.
b. 点击Next, 直接点击Finish便可
**Note: 证书导入后请务必验证https访问再也不报证书错误,若是还有错考虑将站点加入到本地信任站点列表。
3.更新在Citrix Virtual Desktop数据库中更新新证书的指纹,
a. 经过查看证书详细信息并下拉到指纹(Thumbprint)选项查看指纹(请将指纹信息拷贝到TXT中去除空格并将字母替换成大写后备用):
b. Citrix Virtual Desktop数据库中替换新证书指纹
方法一:直接更新数据库表格
Update [XDSiteDB].[HostingUnitServiceSchema].[HypervisorConnectionSSLThumbprint]
Set SSLThumbprint = '59548212930111B0E279FDC729D7AF4FDE65C25F'
Where Id = 2
**Note: Hypervisor ConnectionUid能够在DDC上运行Powershell Get-BrokerHypervisorConnection来查看相关信息
方法二:经过DDC Powershell更新
a) $cred = Get-Credential
b) Set-Item -LiteralPath "<FullPath_to_connection>" -username $cred.username -Securepassword $cred.password -SslThumbprint "<New ThumbPrint>" -hypervisorAddress <vcenter URL>
**Note:证书指纹须大写!
上述四个步骤作完以后,虚拟机电源状态恢复,同时现有链接也被修复。
问题二:没法向现有计算机目录中添加机器
咱们在完成以上步骤后虽然可以解决现有环境中的链接问题,可是用户没法在新的计算机目录中添加新的计算机。致使问题的根本缘由是由于替换vcenter以后,vcenter管理的network /storage/resouregoup id信息都将改变,而原有的计算机目录仍然关联旧的vcenter下面的id.
解决思路是将XD数据库中相关联的网络/存储/资源组 ID均替换成现有正确的ID.
如何查看当前新的vcenter下的网络/存储/资源组 ID?两种方法:
根据原来的托管主机新建托管主机并使用相同的存储和网络,这样在DB中能够查看到对应的ID
浏览器访问vcenter server地址并选择浏览管理对象
路径为:Browse objects managed by vShpere->Content->rootFolder(Datacenters)->ChileEntity(Real Datacenter Name,此目录下正常能够看到storage ID和network ID)->HostFolder->ChildEntity(此时能够看到cluster名称或者主机)->点击进入,页面为ManagedObjectReference:ComputeResource(此页面中能看到看到storage ID和network ID,下拉找到resourcePool能够查询到对应的ID)
网络ID:
用户在添加计算机的时候会提示如下错误:
Terminating Error:
An unknown error occurred while creating the virtual machines.
Stack Trace:
at Citrix.Console.PowerShellSdk.ProvisioningSchemeService.BackgroundTasks.ProvisioningSchemeTask.CheckForTerminatingError(SdkProvisioningSchemeAction sdkProvisioningSchemeAction)
at Citrix.Console.PowerShellSdk.ProvisioningSchemeService.BackgroundTasks.ProvisioningSchemeTask.WaitForProvisioningSchemeActionCompletion(Guid taskId, Action`1 actionResultsObtained)
at Citrix.Console.PowerShellSdk.ProvisioningSchemeService.BackgroundTasks.MachineProvisioningTask.RunTask()
at Citrix.Console.PowerShellSdk.BackgroundTaskService.BackgroundTask.Task.Run()
DesktopStudio_ErrorId : ProvisioningTaskError
ErrorCategory : NotSpecified
ErrorID : NetworkNotPermitted
TaskErrorInformation : A NIC device is tied to a disallowed network.
InternalErrorMessage : A NIC device is tied to a disallowed network.
Machine Failures:
: Failed to create the virtual machine; .
Inner Error:
A NIC device is tied to a disallowed network.
ErrorID : System.InvalidOperationException
TaskErrorInformation : System.InvalidOperationException: A NIC device is tied to a disallowed network.
at Citrix.MachineCreation.NewProvVMSupport.NewProvVMLogic.DoValidation(NewVirtualMachineWorkflow context)
网络的更改会涉及到数据中的三张表,以下:
[HostingUnitServiceSchema].[HostingUnit]
[HostingUnitServiceSchema].[HostingUnitNetwork]
[DesktopUpdateManagerSchema].[ProvisioningSchemeNetworkMap]
[HostingUnitServiceSchema].[HostingUnit] 主要定义了当前托管主机中对应的RootID/RootPath/NetworkPath/NetworkID等,若是只是替换vcenter(datacenter, cluster没有变化)则只须要更改networkID便可,若是更换以上路径则还须要替换出现问题的Hostingunits对应的RootID和Rootpath等。
Update [CitrixXDSiteDB].[HostingUnitServiceSchema].[HostingUnit]
Set RootPath = 'xxxxx', RootID = 'new rootid', NetworkID = 'NewNetworkID'
Where hostingUnitName = 'vcenter'
[HostingUnitServiceSchema].[HostingUnitNetwork] 定义了托管主机中每一个网络对应的名称和id(有可能用户的托管中配置了多个网络,可是每一个计算机目录只会选择一个网络)
语句:
Update [HostingUnitServiceSchema].[HostingUnitNetwork]
Set NetworkID= 'Newnetwork id'
where networkpath='networkpath'
[DesktopUpdateManagerSchema].[ProvisioningSchemeNetworkMap] 定义了每一个计算机目录对应的scheme中使用的网络路径和ID.
语句:
Update [DesktopUpdateManagerSchema].[ProvisioningSchemeNetworkMap]
Set NetworkId = 'New networkID'
Where ProvsioningSchemeUid='xxxxx-xxxxxx-xxxxxxxxxxxxxx'
**Note: 如何查看计算机目录对应的ProvsionningScheme
DDC上运行Powershell: Get-BrokerCatalog
用户在修改成以上三张表关联的网络ID以后再次添加机器仍然提示报错:
从以上报错咱们能够明显看到建立机器过程当中找不到对应的存储,这里的存储“datastore-1164"在新的vCenter管理下此存储的id已经变动为新的id,咱们须要在数据库中进行替换。
[HostingUnitServiceSchema].[HostingUnitStorageLocation] 此表中记录了托管存储中每一个存储对应的路径和storage ID
语句:
Update [CitrixXDSiteDB].[HostingUnitServiceSchema].[HostingUnitStorageLocation]
set StorageId = 'datastore-15'
Where StorageId = 'datastore-1164'
用户在更新完storage ID后再次从新添加新虚拟机:
Machine Failures:
Domain\RDVDI21$: Could not locate the master disk image; /VDI-ITUser-Template.vm/ITUserVDA.snapshot/set IE proxy.snapshot to create the virtual machine; Domain\RDVDI21$
Inner Error:
Attempt to lookup property [parent] failed as the object [resgroup-1162] does not exist
ErrorID : PluginUtilities.Exceptions.ItemNotFoundException
TaskErrorInformation : PluginUtilities.Exceptions.ItemNotFoundException: Attempt to lookup property [parent] failed as the object [resgroup-1162] does not exist ---> PluginUtilities.Exceptions.ItemNotFoundException: Attempt to lookup property [parent] failed as the object [resgroup-1162] does not exist ---> PluginUtilities.Exceptions.WrappedPluginException: 对象已删除或未彻底建立
以上报错咱们能够看到对用的resouregroup-1162已经改变,咱们须要更新数据库中对应的值
[DesktopUpdateManagerSchema].[ProvisioningSchemeVMImageLocation] 此表中记录了计算机目录再每一个存储中的Basedisk的信息,若是ResourceGroup信息改变则须要在这里更改
语句:
Update [DBName][DesktopUpdateManagerSchema].[ProvisioningSchemeVMImageLocation]
Set DiskId= replace (DiskId,'resgroup-35002_old','resgroup-3xxxx_new')
Where ProvsioningSchemeID = XXX
还须要更改此表中的StorageID
Update [DBName].[DesktopUpdateManagerSchema].[ProvisioningSchemeVMImageLocation]
Set StorageId = 'datastore-15'
Where StorageId = 'datastore-1164'
再次回到DDC针对有问题的计算机目录添加计算机,此时能够从新添加!
**Note: 全部针对数据库的操做请务必先进行数据库的备份操做