def get_vmdk_name_from_ovf(xmlstr):
 ovf = etree.fromstring(encodeutils.safe_encode(xmlstr))
 nsovf = ('{%s}' % ovf.nsmap['ovf'])
 disk = ovf.find(('./%sDiskSection/%sDisk' % (nsovf, nsovf)))
 file_id = disk.get(('%sfileRef' % nsovf))
 file = ovf.find(('./%sReferences/%sFile[@%sid="%s"]' % (nsovf, nsovf, nsovf, file_id)))
 vmdk_name = file.get(('%shref' % nsovf))
 return vmdk_name

def get_vmdk_name_from_ovf ( xmlstr ) : ovf = etree . fromstring ( encodeutils . safe_encode ( xmlstr ) ) nsovf = ( '{%s}' % ovf . nsmap [ 'ovf' ] ) disk = ovf . find ( ( './%sDiskSection/%sDisk' % ( nsovf , nsovf ) ) ) file_id = disk . get ( ( '%sfileRef' % nsovf ) ) file = ovf . find ( ( './%sReferences/%sFile[@%sid="%s"]' % ( nsovf , nsovf , nsovf , file_id ) ) ) vmdk_name = file . get ( ( '%shref' % nsovf ) ) return vmdk_name
parse the ova descriptor to extract the vmdk name .