Coverage for manila/cmd/share.py: 94%

30 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2026-02-18 22:19 +0000

1#!/usr/bin/env python3 

2 

3# Copyright 2013 NetApp 

4# All Rights Reserved. 

5# 

6# Licensed under the Apache License, Version 2.0 (the "License"); you may 

7# not use this file except in compliance with the License. You may obtain 

8# a copy of the License at 

9# 

10# http://www.apache.org/licenses/LICENSE-2.0 

11# 

12# Unless required by applicable law or agreed to in writing, software 

13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 

14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 

15# License for the specific language governing permissions and limitations 

16# under the License. 

17 

18"""Starter script for manila Share.""" 

19 

20import eventlet 

21eventlet.monkey_patch() 

22 

23import sys 

24 

25from oslo_config import cfg 

26from oslo_log import log 

27from oslo_reports import guru_meditation_report as gmr 

28from oslo_reports import opts as gmr_opts 

29 

30from manila.common import config # Need to register global_opts # noqa 

31from manila import service 

32from manila import utils 

33from manila import version 

34 

35CONF = cfg.CONF 

36 

37 

38def main(): 

39 log.register_options(CONF) 

40 gmr_opts.set_defaults(CONF) 

41 CONF(sys.argv[1:], project='manila', 

42 version=version.version_string()) 

43 log.setup(CONF, "manila") 

44 utils.monkey_patch() 

45 gmr.TextGuruMeditation.setup_autorun(version, conf=CONF) 

46 launcher = service.process_launcher() 

47 if CONF.enabled_share_backends: 

48 for backend in CONF.enabled_share_backends: 

49 host = "%s@%s" % (CONF.host, backend) 

50 server = service.Service.create(host=host, 

51 service_name=backend, 

52 binary='manila-share', 

53 coordination=True) 

54 launcher.launch_service(server) 

55 else: 

56 server = service.Service.create(binary='manila-share') 

57 launcher.launch_service(server) 

58 launcher.wait() 

59 

60 

61if __name__ == '__main__': 61 ↛ 62line 61 didn't jump to line 62 because the condition on line 61 was never true

62 main()