ó 'KXc@sddlZddlZddlmZddlmZeZdZdZdZ dZ dZ d „Z d „Z d „Zd „Zd „ZdS(iÿÿÿÿN(t PER_INSTANCE(tutils/usr/sbin/importvgs/usr/sbin/lspvs/usr/sbin/lsvgs/usr/sbin/mounts+/opt/freeware/etc/cloud/pvid_to_vg_mappingscCsð|jdƒtjttjƒs7|jdtƒdSttdƒ}|jƒ}WdQXt||ƒ}x³|j ƒD]¥\}} | j ƒdkr²|jd|| fƒqwnt ||ƒ} | dkrê|jd|| fƒqwn| ddkrw| d rwt || d | ƒqwqwWtd „|jƒDƒƒ} t|ƒ} x@| D]8} | | krOd | }|j|ƒt|ƒ‚qOqOWy*tjtd gƒd }|j|ƒWn'tjk rÞ}|jd|ƒnXtjtƒdS(Ns/Attempting to restore non-rootVG volume groups.s¶Physical volume ID to volume group mapping file "%s" does not exist or permission to read the file does not exist. Ensure that the file exists and the permissions for it are correct.trtnones©The physical volume with ID "%s" was associated with a volume group labeled "%s" on the captured system. This physical volume will not be associated with a volume group.sbThe physical volume with ID "%s" was not found, so it cannot be associated with volume group "%s".t volume_grouptactivethdiskcss|] }|VqdS(N((t.0tvg((sV/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_restore_volume_groups.pys Tss!Volume group "%s" is not present.tallis­Attempting to mount disks marked as auto-mounting resulted in errors. This is likely due to attempting to mount filesystems that are already mounted, therefore ignoring: %s.(tdebugtostaccesst MAPPING_FILEtR_OKtwarntopent readlinestparse_mapping_filet iteritemstlowertget_physical_volume_from_lspvtNonetset_volume_grouptsettvaluestget_existing_volume_groupsterrort ExceptionRtsubptMOUNTtProcessExecutionErrortremove(tnamet_cfgt_cloudtlogt_argstftmapping_file_linestpvid_to_vg_maptphysical_volume_idtvolume_group_nametpvtexpected_volume_groupstexisting_volume_groupstgrouptmsgtoutte((sV/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_restore_volume_groups.pythandle%sD             cCsi}x|D]}|jƒdkr+q n|jƒjƒ}t|ƒdkr{d|jƒ}|j|ƒt|ƒ‚nt|jƒƒ\}}|jƒdkrËd|}|j|ƒt|ƒ‚n|jƒdkrd|}|j|ƒt|ƒ‚n||| Note that the order does not matter. Physical volume IDs that are "none" and volume group names that are "rootvg" will raise exceptions as the script generating the mapping file should not include those entries. Returns a dictionary with keys of physical volume IDs mapping to their corresponding volume group name. tisÁPhysical volume ID to volume group mapping file contains lines in an invalid format. Each line should contain a volume group name, a single space, then a physical volume ID. Invalid line: "%s".Rs`Physical volume ID parsed as "%s", but there should be no entries in the mapping file like this.trootvgs_Volume group name parsed as "%s", but there should be no entries in the mapping file like this.(tstriptsplittlenRRttupleR(R$tlinesR(tlinet split_lineR/R*R)((sV/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_restore_volume_groups.pyRms.     c Cs0y9tj}d|d, 'physical_volume_id': , 'volume_group': , 'active': } tCtLANGtenvisFailed to run lspv command.s.*%s.*iis¸Output from lspv does not match the expected format. The expected output is of of the form " ". The actual output was: "%s".iRRR)RRN(R tenvironRRtLSPVR5RtlogexctretfindallR7RR6RRR( R$R)R>tlspv_outtlspv_out_specific_pvidtlspv_specific_pvidR/Rtphysical_volume((sV/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_restore_volume_groups.pyRžs4   &       cCsby0tjtd||gƒd}|j|ƒWn+tjk r]tj|d|ƒ‚nXdS(sP Uses the importvg command to set the volume group for the given hdisk. s-yis+Failed to set the volume group for disk %s.N(RRtIMPORTVGR RRA(R$RR*R0((sV/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_restore_volume_groups.pyRÐs cCs›g}ygtj}d|dis sFailed to run lsvg command.( R R?RRtLSVGR5R6RRA(R$t volume_groupsR>tlsvg_outR((sV/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_restore_volume_groups.pyRÝs  "#(R RBtcloudinit.settingsRt cloudinitRt frequencyRHR@RIRR R2RRRR(((sV/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_restore_volume_groups.pyts   H 1 2