Wait for cas_ctrl device in casctl
Signed-off-by: Jan Musial <jan.musial@intel.com>
This commit is contained in:
parent
126615add1
commit
b91fc1ca4a
@ -191,4 +191,5 @@ class cas:
|
|||||||
stop(args.flush)
|
stop(args.flush)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
opencas.wait_for_cas_ctrl()
|
||||||
cas()
|
cas()
|
||||||
|
@ -11,12 +11,6 @@ import sys
|
|||||||
import os
|
import os
|
||||||
import syslog as sl
|
import syslog as sl
|
||||||
|
|
||||||
def wait_for_cas_ctrl():
|
|
||||||
for i in range(30): # timeout 30s
|
|
||||||
if os.path.exists('/dev/cas_ctrl'):
|
|
||||||
return
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
subprocess.call(['/sbin/modprobe', 'cas_cache'])
|
subprocess.call(['/sbin/modprobe', 'cas_cache'])
|
||||||
except:
|
except:
|
||||||
@ -34,7 +28,7 @@ except Exception as e:
|
|||||||
for cache in config.caches.values():
|
for cache in config.caches.values():
|
||||||
if sys.argv[1] == os.path.realpath(cache.device):
|
if sys.argv[1] == os.path.realpath(cache.device):
|
||||||
try:
|
try:
|
||||||
wait_for_cas_ctrl()
|
opencas.wait_for_cas_ctrl()
|
||||||
opencas.start_cache(cache, True)
|
opencas.start_cache(cache, True)
|
||||||
except opencas.casadm.CasadmError as e:
|
except opencas.casadm.CasadmError as e:
|
||||||
sl.syslog(sl.LOG_WARNING,
|
sl.syslog(sl.LOG_WARNING,
|
||||||
@ -45,7 +39,7 @@ for cache in config.caches.values():
|
|||||||
for core in cache.cores.values():
|
for core in cache.cores.values():
|
||||||
if sys.argv[1] == os.path.realpath(core.device):
|
if sys.argv[1] == os.path.realpath(core.device):
|
||||||
try:
|
try:
|
||||||
wait_for_cas_ctrl()
|
opencas.wait_for_cas_ctrl()
|
||||||
opencas.add_core(core, True)
|
opencas.add_core(core, True)
|
||||||
except opencas.casadm.CasadmError as e:
|
except opencas.casadm.CasadmError as e:
|
||||||
sl.syslog(sl.LOG_WARNING,
|
sl.syslog(sl.LOG_WARNING,
|
||||||
|
@ -768,6 +768,13 @@ def get_devices_state():
|
|||||||
return devices
|
return devices
|
||||||
|
|
||||||
|
|
||||||
|
def wait_for_cas_ctrl():
|
||||||
|
for i in range(30): # timeout 30s
|
||||||
|
if os.path.exists('/dev/cas_ctrl'):
|
||||||
|
return
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
def wait_for_startup(timeout=300, interval=5):
|
def wait_for_startup(timeout=300, interval=5):
|
||||||
try:
|
try:
|
||||||
config = cas_config.from_file(
|
config = cas_config.from_file(
|
||||||
|
Loading…
Reference in New Issue
Block a user