Fix slow VM recovery after unlocking AIO-SX host

Delay starting compute services until controller services are up. Add
new sm-query service-group support for the compute_config to determine
all controller service groups are enabled.

Change-Id: Ie5a5c941076d1295aabde40361bdaca9bcf3bfe1
Signed-off-by: Kristine Bujold <kristine.bujold@windriver.com>
This commit is contained in:
Bin Qian 2018-04-10 16:08:45 -04:00 committed by Kristine Bujold
parent e450db9ac1
commit b62c18debf
1 changed files with 41 additions and 0 deletions

View File

@ -24,6 +24,10 @@ def main():
s_parser = subparsers.add_parser('service', help='Query Service')
s_parser.set_defaults(which='service')
s_parser.add_argument('service_name', help='service name')
s_parser = subparsers.add_parser('service-group', help='Query Service Group')
s_parser.set_defaults(which='service-group')
s_parser.add_argument('service_group_name', nargs='+', help='service group name')
s_parser.add_argument("--desired-state", help="display desired state", action="store_true")
args = parser.parse_args()
@ -53,6 +57,43 @@ def main():
database.close()
elif args.which == 'service-group':
database = sqlite3.connect(database_name)
cursor = database.cursor()
cursor.execute("SELECT NAME, DESIRED_STATE, STATE FROM "
"SERVICE_GROUPS WHERE NAME IN (%s) AND PROVISIONED='yes';"
% ','.join("'%s'"%i for i in args.service_group_name))
rows = cursor.fetchall()
if args.desired_state:
fmt = "{0} {2} {1}"
else:
fmt = "{0} {1}"
found_list = []
for row in rows:
service_group_name = row[0]
found_list.append(service_group_name)
desired_state = row[1]
state = row[2]
print fmt.format(service_group_name, state, desired_state)
database.close()
not_found_list = []
for g in args.service_group_name:
if g not in found_list:
not_found_list.append(g)
if len(not_found_list) > 1:
print "%s are not provisioned"%','.join( (g for g in not_found_list))
elif len(not_found_list) == 1:
print "%s is not provisioned" % ','.join((g for g in not_found_list))
except KeyboardInterrupt:
sys.exit()