Coverage for nova/conf/netconf.py: 88%

8 statements  

« prev     ^ index     » next       coverage.py v7.6.12, created at 2025-04-17 15:08 +0000

1# Copyright 2010 United States Government as represented by the 

2# Administrator of the National Aeronautics and Space Administration. 

3# All Rights Reserved. 

4# Copyright 2012 Red Hat, Inc. 

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 

18import socket 

19 

20from oslo_config import cfg 

21from oslo_utils import netutils 

22 

23 

24netconf_opts = [ 

25 cfg.StrOpt("my_ip", 

26 default=netutils.get_my_ipv4(), 

27 sample_default='<host_ipv4>', 

28 help=""" 

29The IP address which the host is using to connect to the management network. 

30 

31Possible values: 

32 

33* String with valid IP address. Default is IPv4 address of this host. 

34 

35Related options: 

36 

37* my_block_storage_ip 

38* my_shared_fs_storage_ip 

39"""), 

40 cfg.StrOpt("my_block_storage_ip", 

41 default="$my_ip", 

42 help=""" 

43The IP address which is used to connect to the block storage network. 

44 

45Possible values: 

46 

47* String with valid IP address. Default is IP address of this host. 

48 

49Related options: 

50 

51* my_ip - if my_block_storage_ip is not set, then my_ip value is used. 

52"""), 

53 cfg.StrOpt("my_shared_fs_storage_ip", 

54 default="$my_ip", 

55 help=""" 

56The IP address which is used to connect to the shared_fs storage (manila) 

57network. 

58 

59Possible values: 

60 

61* String with valid IP address. Default is IP address of this host. 

62 

63Related options: 

64 

65* my_ip - if my_shared_fs_storage_ip is not set, then my_ip value is used. 

66"""), 

67 cfg.HostDomainOpt("host", 

68 default=socket.gethostname(), 

69 sample_default='<current_hostname>', 

70 help=""" 

71Hostname, FQDN or IP address of this host. 

72 

73Used as: 

74 

75* the oslo.messaging queue name for nova-compute worker 

76* we use this value for the binding_host sent to neutron. This means if you use 

77 a neutron agent, it should have the same value for host. 

78* cinder host attachment information 

79 

80Must be valid within AMQP key. 

81 

82Possible values: 

83 

84* String with hostname, FQDN or IP address. Default is hostname of this host. 

85"""), 

86 # TODO(sfinucan): This option is tied into the VMWare and Libvirt drivers. 

87 # We should remove this dependency by either adding a new opt for each 

88 # driver or simply removing the offending code. Until then we cannot 

89 # deprecate this option. 

90 cfg.BoolOpt("flat_injected", 

91 default=False, 

92 help=""" 

93This option determines whether the network setup information is injected into 

94the VM before it is booted. While it was originally designed to be used only 

95by nova-network, it is also used by the vmware virt driver to control whether 

96network information is injected into a VM. The libvirt virt driver also uses it 

97when we use config_drive to configure network to control whether network 

98information is injected into a VM. 

99"""), 

100] 

101 

102 

103def register_opts(conf): 

104 conf.register_opts(netconf_opts) 

105 

106 

107def list_opts(): 

108 return {'DEFAULT': netconf_opts}