openstack环境-解决windows实例重启后比当前时间晚8小时

一、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>
重启实例即可

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值