OSDN Git Service

Merge branch 'dev'
[karesansui/karesansui.git] / karesansui / gadget / hostby1storagepoolby1status.py
index db2c5f5..820bf96 100644 (file)
@@ -126,7 +126,12 @@ class HostBy1StoragePoolBy1Status(Rest):
             if status == STORAGE_POOL_START:
                 storagepool_start_stop_job(self, model, pools_obj[0], 'start')
             elif status == STORAGE_POOL_STOP:
-                storagepool_start_stop_job(self, model, pools_obj[0], 'stop')
+                if kvc.is_used_storage_pool(name=pools_obj[0].get_storage_name(),
+                                            active_only=True) is True:
+                    self.logger.debug("Stop storage pool failed. Target storage pool is used by guest.")
+                    return web.badrequest("Target storage pool is used by guest.")
+                else:
+                    storagepool_start_stop_job(self, model, pools_obj[0], 'stop')
             else:
                 self.logger.debug("Set storage pool status failed. Unknown status type.")
                 return web.badrequest()