轉載: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: 全部針對數據庫的操做請務必先進行數據庫的備份操做