glance鏡像元數據


一、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

二、設置元數據
# 針對windows鏡像,不設置這個的話,windows虛擬機時區是utc
glance p_w_picpath-update --property os_type='windows' <imgae-id>

    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
        }


參考連接html

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

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

相關文章
相關標籤/搜索