nova - nova base image id的生成算法
nova spawn instance的时候,会先create_p_w_picpath,下面是获取的base p_w_picpath的函数
defget_cache_fname(p_w_picpaths,key):"""ReturnafilenamebasedontheSHA1hashofagivenp_w_picpathID.Imagefilesstoredinthe_basedirectorythatmatchthispatternareconsideredforcleanupbythep_w_picpathcachemanager.Thecachemanagerconsidersthefiletobeinuseifitmatchesaninstance'sp_w_picpath_ref,kernel_idorramdisk_idproperty.However,ingrizzly-3andbefore,onlythep_w_picpath_refpropertywasconsidered.Thismeansthatit'sunsafetostorekernelandramdiskp_w_picpathsusingthispatternuntilwe'resurethatallcomputenodesarerunningacachemanagernewerthangrizzly-3.Fornow,werequireadminstoconfirmthatbysettingtheremove_unused_kernelsbooleanbut,atsomepointinthefuture,we'llbesafelyabletoassumethis."""p_w_picpath_id=str(p_w_picpaths[key])if((notCONF.libvirt.remove_unused_kernelsand#remove_unused_kernels默认值是Truekeyin['kernel_id','ramdisk_id'])):returnp_w_picpath_idelse:returnhashlib.sha1(p_w_picpath_id).hexdigest()#basep_w_picpathid生成
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。