mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-24 23:25:24 +00:00
Host gets list of all storages active/inactive. If there is some inactive storages it gives error. But it coulde be inactive. It is normal. Changing the behaviour of getting list of storages.
This commit is contained in:
parent
e7ecf29359
commit
e387c3a21d
4 changed files with 9 additions and 10 deletions
|
@ -37,7 +37,7 @@ def create_instance(request, compute_id):
|
||||||
compute.password,
|
compute.password,
|
||||||
compute.type)
|
compute.type)
|
||||||
|
|
||||||
storages = sorted(conn.get_storages())
|
storages = sorted(conn.get_storages(only_actives=True))
|
||||||
networks = sorted(conn.get_networks())
|
networks = sorted(conn.get_networks())
|
||||||
instances = conn.get_instances()
|
instances = conn.get_instances()
|
||||||
cache_modes = sorted(conn.get_cache_modes().items())
|
cache_modes = sorted(conn.get_cache_modes().items())
|
||||||
|
|
|
@ -356,12 +356,13 @@ class wvmConnect(object):
|
||||||
"""Return KVM capabilities."""
|
"""Return KVM capabilities."""
|
||||||
return util.is_kvm_available(self.get_cap_xml())
|
return util.is_kvm_available(self.get_cap_xml())
|
||||||
|
|
||||||
def get_storages(self):
|
def get_storages(self, only_actives=False):
|
||||||
storages = []
|
storages = []
|
||||||
for pool in self.wvm.listStoragePools():
|
for pool in self.wvm.listStoragePools():
|
||||||
storages.append(pool)
|
storages.append(pool)
|
||||||
for pool in self.wvm.listDefinedStoragePools():
|
if not only_actives:
|
||||||
storages.append(pool)
|
for pool in self.wvm.listDefinedStoragePools():
|
||||||
|
storages.append(pool)
|
||||||
return storages
|
return storages
|
||||||
|
|
||||||
def get_networks(self):
|
def get_networks(self):
|
||||||
|
|
|
@ -31,11 +31,9 @@ class wvmCreate(wvmConnect):
|
||||||
Function return all images on all storages
|
Function return all images on all storages
|
||||||
"""
|
"""
|
||||||
images = []
|
images = []
|
||||||
storages = self.get_storages()
|
storages = self.get_storages(only_actives=True)
|
||||||
for storage in storages:
|
for storage in storages:
|
||||||
stg = self.get_storage(storage)
|
stg = self.get_storage(storage)
|
||||||
if not stg.isActive():
|
|
||||||
continue
|
|
||||||
try:
|
try:
|
||||||
stg.refresh(0)
|
stg.refresh(0)
|
||||||
except:
|
except:
|
||||||
|
@ -93,7 +91,7 @@ class wvmCreate(wvmConnect):
|
||||||
return 'raw'
|
return 'raw'
|
||||||
|
|
||||||
def get_volume_path(self, volume):
|
def get_volume_path(self, volume):
|
||||||
storages = self.get_storages()
|
storages = self.get_storages(only_actives=True)
|
||||||
for storage in storages:
|
for storage in storages:
|
||||||
stg = self.get_storage(storage)
|
stg = self.get_storage(storage)
|
||||||
if stg.info()[0] != 0:
|
if stg.info()[0] != 0:
|
||||||
|
|
|
@ -303,7 +303,7 @@ class wvmInstance(wvmConnect):
|
||||||
disk.insert(2, src_media)
|
disk.insert(2, src_media)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
storages = self.get_storages()
|
storages = self.get_storages(only_actives=True)
|
||||||
for storage in storages:
|
for storage in storages:
|
||||||
stg = self.get_storage(storage)
|
stg = self.get_storage(storage)
|
||||||
if stg.info()[0] != 0:
|
if stg.info()[0] != 0:
|
||||||
|
@ -597,7 +597,7 @@ class wvmInstance(wvmConnect):
|
||||||
|
|
||||||
def get_iso_media(self):
|
def get_iso_media(self):
|
||||||
iso = []
|
iso = []
|
||||||
storages = self.get_storages()
|
storages = self.get_storages(only_actives=True)
|
||||||
for storage in storages:
|
for storage in storages:
|
||||||
stg = self.get_storage(storage)
|
stg = self.get_storage(storage)
|
||||||
if stg.info()[0] != 0:
|
if stg.info()[0] != 0:
|
||||||
|
|
Loading…
Reference in a new issue