1、glance上传vmdk镜像
glance p_w_picpath-update 
    --property hw_disk_bus=‘ide’             
    --property vmware_disktype="sparse"  
    --property vmware_adaptertype="ide" 
    --property hypervisor_type=“vmware" 
    --property vmware_ostype="windows7Server64Guest"  # 这是windows2008R2所对应的ostype
    p_w_picpath_id
    
head -n 21 disk_p_w_picpath   # 可以看到p_w_picpath的metadata
2、设置元数据
# 针对windows镜像,不设置这个的话,windows虚拟机时区是utc
glance p_w_picpath-update --property os_type='windows' 
    def _set_clock(self, guest, os_type, p_w_picpath_meta, virt_type):
        # NOTE(mikal): Microsoft Windows expects the clock to be in
        # "localtime". If the clock is set to UTC, then you can use a
        # registry key to let windows know, but Microsoft says this is
        # buggy in http://support.microsoft.com/kb/2687252
        clk = vconfig.LibvirtConfigGuestClock()
        if os_type == 'windows':
            LOG.info(_LI('Configuring timezone for windows instance to '
                         'localtime'))
            clk.offset = 'localtime'
        else:
            clk.offset = 'utc'
        guest.set_clock(clk)
        if virt_type == "kvm":
            self._set_kvm_timers(clk, os_type, p_w_picpath_meta)
            
这段是设置虚拟机时区的代码, os_type是根据nova库instances里面的记录来的, 而instances表里的记录是根据这里来的
 def _inherit_properties_from_p_w_picpath(self, p_w_picpath, auto_disk_config):
        p_w_picpath_properties = p_w_picpath.get('properties', {})
        auto_disk_config_img = \
                utils.get_auto_disk_config_from_p_w_picpath_props(p_w_picpath_properties)
        self._ensure_auto_disk_config_is_valid(auto_disk_config_img,
                                               auto_disk_config,
                                               p_w_picpath.get("id"))
        if auto_disk_config is None:
            auto_disk_config = strutils.bool_from_string(auto_disk_config_img)
        return {
            'os_type': p_w_picpath_properties.get('os_type'),            # 镜像元数据
            'architecture': p_w_picpath_properties.get('architecture'),
            'vm_mode': p_w_picpath_properties.get('vm_mode'),
            'auto_disk_config': auto_disk_config
        }



参考链接


http://docs.openstack.org/liberty/config-reference/content/vmware.html#VMware_p_w_picpaths


http://docs.openstack.org/p_w_picpath-guide/convert-p_w_picpaths.html