break
return ret
+ def get_storage_volume_iscsi_block_bypool(self, pool):
+ """<comment-ja>
+ ストレージプールの名前からiSCSIブロックデバイスのボリュームの一覧を取得する
+ @param pool: プール名
+ @return: ストレージボリューム名の配列
+ @rtype: dict
+ </comment-ja>
+ <comment-en>
+ TODO: English Comment
+ </comment-en>
+ """
+ retval = []
+
+ try:
+ inactive_pool = self.list_inactive_storage_pool()
+ active_pool = self.list_active_storage_pool()
+ pools = inactive_pool + active_pool
+
+ pool_obj = self.search_kvn_storage_pools(pool)[0]
+ if not pool_obj:
+ raise KaresansuiVirtException(_("No storage pool '%s' could be found.") % pool)
+
+ vols = pool_obj.vol_listVolumes()
+ for vol in vols:
+ vol_obj = pool_obj.vol_storageVolLookupByName(vol)
+ vol_key = vol_obj.key()
+ vol_key = vol_key.replace("%s/" % (ISCSI_DEVICE_DIR), "")
+ regex = re.compile(r"^%s" % (re.escape(vol_key)))
+ is_mount = False
+ for pool in pools:
+ if regex.match(pool):
+ is_mount = True
+
+ if is_mount is False:
+ retval.append(vol)
+ except:
+ pass
+
+ return retval
+
class KaresansuiVirtGuest: