一、OpenStack环境
1:对于还未创建的实例
更新镜像信息,加入os_type选项
glance image-list # 先查找镜像id
glance image-update --property os_type="windows" 镜像id # 更新镜像
glance image-show 镜像id # 查看镜像,看看是否多了一项os_type
然后就可以创建虚拟机了
2:对于已经创建的windows镜像,可以在数据库中更新os_type字段信息,然后重启实例
MariaDB [(none)]> use nova
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [nova]> select os_type,hostname from instances;
+---------+----------------+
| os_type | hostname |
+---------+----------------+
| NULL | test |
| NULL | test-centos65 |
| NULL | test-2 |
| NULL | test-3 |
| NULL | win2003 |
MariaDB [nova]> update instances set os_type='windows' where hostname='win2003';
重启实例即可
在相应计算节点,查看虚拟机配置文件
virsh edit instance-00000281
<clock offset='localtime'>
<timer name='pit' tickpolicy='delay'/>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='hpet' present='no'/>
<timer name='hypervclock' present='yes'/>
</clock>
可以看到clock以及从utc变成localtime
二、KVM环境
kvm虚拟机使用libvirt管理,修改虚拟机libvirt.xml配置文件
virsh edit windows2008r2(虚拟机名字)
修改如下部分
<clock offset='utc'>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='pit' tickpolicy='delay'/>
<timer name='hpet' present='no'/>
</clock>
修改其中的utc为localtime
<clock offset='localtime'>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='pit' tickpolicy='delay'/>
<timer name='hpet' present='no'/>
</clock>
重启实例即可