ó 'KXc@s¢ddlZddlmZddlmZeZdZdZdZdZ dZ d Z d Z d Z d „Zd „Zd„Zged„Zd„Zd„ZdS(iÿÿÿÿN(t PER_INSTANCE(tutils/usr/sbin/bootinfos/usr/sbin/bootlists/usr/bin/bootlists/usr/sbin/lsprops/proc/device-tree/chosens/usr/sbin/ofpathnames /proc/cpuinfosemulated by qemuc Cs#|jdƒtjƒ}d|djƒkr½yatjtdgƒdjƒjdƒ}t|ddd d d |d t ƒ}|j|ƒdSWq½tj k r¹tj |d ƒ‚q½Xnt |ƒrÚ|jdƒdS|dd}d|krødSt|ddd dƒjdƒ} t|ddd dƒjdƒ} |dd \} } t | jdƒdƒ} g}| jdƒr½|jd| ƒ| dkr«t|dƒ}qUt|ƒg}n˜| jdƒr |jd| ƒ| dkrût|dƒ}qUt|ƒg}nH| jdƒr?|jd | ƒt|ƒg}ntd!| | fƒ‚ytjtgƒWn'tj k r’tj |d"ƒ‚nXt|ƒdkrÓt|dd#d dd |ƒ}|j|ƒnt|d| ƒoôt|d| ƒ}|sd$}|j|ƒt|ƒ‚ndS(%Ns&Attempting to configure the boot list.taixtplatforms-bis tmodetnormaltfmttlogicalt boot_devicest cmd_locationsFailed to set the bootlist.sCNot configuring the boot list since this VM is running on PowerKVM.tunameitppctofpathtservicetdistit.sRed Hat Enterprise LinuxsRHEL version: %sis/etc/yaboot.confsSUSE Linux EnterprisesSLES version: %si s/etc/lilo.conftUbuntusUbuntu version: %ss Not yet implemented for (%s, %s)szThe ofpathname command returned errors. Since the bootlist command relies on ofpathname, these errors need to be resolved.tboths'Failed to update the bootlist properly.(tdebugRt system_infotlowertsubptBOOTINFOtstriptsplittrun_bootlist_commandt BOOTLIST_AIXtProcessExecutionErrortlogexct is_powerkvmtintt startswithtget_device_paths_from_filetget_last_booted_devicetNotImplementedErrort OFPATHNAMEtlentverify_bootlistterrort Exception(tnamet_cfgt_cloudtlogt_argsRRtoutt architecturetorig_normal_bootlisttorig_service_bootlistRtverst major_releaset device_pathst successfultmsg((sP/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_update_bootlist.pythandle#sr              c Cs«g}yPt|dƒ7}|jƒ}td„tjd|tjƒƒ}WdQX|SWntj|dƒ‚nXt|ƒdkr§d}|j |ƒt |ƒ‚ndS(NtrcSs |jƒS(N(R(ts((sP/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_update_bootlist.pytyss ^boot.*=(.*)s*Failed to get device paths from conf file.is,No device paths were found in the conf file.( topentreadtmaptretfindallt MULTILINERRR$R&R'(R+t conf_fileR3tft conf_contentsR5((sP/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_update_bootlist.pyR ts    cCsËytjttgƒdjƒ}tjd|tjƒ}t|ƒdkr_t d|ƒ‚n|dj dƒd}tjt d|gƒd}|jƒSWn'tj k rÆtj |dƒ‚nXdS(Nis^bootpath.*\"(.*)\"is6Did not find a bootpath entry in the lsprop output: %st,s-ls%Failed to get the last booted device.(RRtLSPROPtCHOSEN_DEVICE_TREERR=R>R?R$R'RR#RR(R+t lsprop_outtbootpath_matchestdevice_in_ofpath_formattdevice_in_logical_format((sP/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_update_bootlist.pyR!‡s    cCsˆ|dkrd}n|dkr*d}n|d||g}||7}y!tj|ƒd}|jƒSWntj|dƒ‚nXdS(NRs-oR s-rs-misBootlist command failed.(RRRR(R+RRRR tcmdR-((sP/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_update_bootlist.pyR™s     c Cs't}t|d|ddƒ}|jd|jƒ|fƒ|jd|jƒ|fƒ|jdƒr#t}|jd|ƒt|d|ddd |ƒt|d|ddƒ}d|kr#|jd ƒt|d|ddd t|ƒgƒt|d|ddƒ}d|kr t}q q#n|S( NRRRs;%s mode boot list in ofpath format before configuration: %ss;%s mode boot list in logical format after configuration: %st ofpathnamesMThe updated %s mode bootlist is not correct. Attempting to revert the change.R RsYFailed to revert the change, so attempting to use the last booted device as the bootlist.(tTrueRRt capitalizeRtFalsetwarnR!(R+Rt orig_bootlistR4t new_bootlisttreverted_bootlisttlast_chance_bootlist((sP/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_update_bootlist.pyR%«s,       cCsNy-tjdtgƒd}t|jƒkSWntj|dƒ‚nXdS(Ntcatis1Failed to determine if VM is running on PowerKVM.(RRtCPUINFOt QEMU_STRINGRR(R+R-((sP/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_update_bootlist.pyRÈs (R=tcloudinit.settingsRt cloudinitRt frequencyRtBOOTLISTRRDRER#RURVR6R R!RR%R(((sP/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_update_bootlist.pyts$  Q