最近很多人碰到关于XenDesktop中Existing Desktop Group的电源控制问题,需求也不一样:
- 一些人不想让VM在关机后自动开机
- 另外一些人却想让VM在关机后能够自动开机
从需求来看,截然相反的两种需求,正常应该总有一半的人能满足,另外一半的人就不行了。但是现在比较奇怪的是,两边都没法实现自己的需求。想让VM自动开机的却开不了,不想让VM开机的,却在关了后,发现VM又开机了。
在对XenDesktop整个Powershell cmdlet浏览一遍后发现有一个值可以满足第一种需求的人。
1 | Set–BrokerDesktopGroup –Name <groupName> –AutomaticPowerOnForAssigned $false |
设置了桌面组的AutomaticPowerOnForAssigned属性以后,那么VM在关机后就肯定不会自动开机了。
但是,正常来讲,该属性默认为$True,那为什么第二种需求的人又没有按照预期的,在VM关机后自动开机呢?在依次尝试了PowerTimerSchedule以及Offpeak,Peak等有关Buffer的设置后,发现还是不行。于是仔细研究下各个参数的实际含义,发现凡是含有Buffer含义的参数都只能针对Pool模式的桌面起作用。所以,这里不管你如何设置都是不会生效的。
Partial Power Management of Permanently Allocated Machines
With machines permanently allocated to individuals or user devices, you can set power state timers but not pools or buffers. XenDesktop turns on the machines at the start of each peak period, and turns them off at the start of each off-peak period, so you have no fine control (as you do with unallocated machines) over the number of machines that become available to compensate for desktops that are consumed.
参考官方文档关于电源管理的说明后,我们发现,Partial power Management并不能在VM关机后马上开机,他需要在peak hour 与Off peak hour状态发生转换的时候才会主动来控制VM开机或者关机。而Desktop Group电源管理的精度为1小时间隔,所以,为了使用该参数来控制VM自动开机,那么只能按小时间隔来设置offpeak与peak,那么控制周期至少要2小时。
针对Existing Desktop Group这种Partial power management的问题,XenDesktop 5.6发布了一个增强功能补丁,在desktop group属性中增加了AutomaticPowerOnForAssignedDuringPeak属性来控制,不需要等待高峰与非高峰的状态改变,在高峰期间就可以控制VM自动开机。
所以,为了实现在VM关机后自动开机,需要安装HF05补丁,设置AutomaticPowerOnForAssignedDuringPeak为$True,同时,修改桌面组的电源管理属性,设置需要的时段为高峰时段。
目前HF05补丁包含了之前的所有补丁,所以,安装该补丁包中的左右组件即可:http://support.citrix.com/article/CTX137644
1 | Set–BrokerDesktopGroup –Name <groupName> –AutomaticPowerOnForAssignedDuringPeak $true |
重启后,一切就完美了。
[alert type=”warning”]安装该补丁的时候,需要安装所有的文件,不能因为电源管理由Broker Service控制,就只升级该组件。 由于补丁修改了Database Schema,所以,需要安装所有文件,并升级Database才行。[/alert]
附上BUG ID:LA1371
By design, existing catalogs provide only partial power management for assigned desktops. As a result, assigned desktops do not power back on during configured peak hours if they were shut down by the Broker at logoff/disconnect. This feature enhancement introduces a new desktop group setting, “AutomaticPowerOnForAssignedDuringPeak” that lets you force assigned desktops to power back on when logged off or disconnected during peak hours. With the “AutomaticPowerOnForAssignedDuringPeak” setting set to “false” (default), XenDesktop behaves entirely as in earlier releases. To force assigned desktops to power back on during peak hours, use the following PowerShell command:
“Set-BrokerDesktopGroup <DesktopGroup> -AutomaticPowerOnForAssignedDuringPeak $True”