Coverage for nova/conf/configdrive.py: 83%

6 statements  

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

1# All Rights Reserved. 

2# 

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

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

5# a copy of the License at 

6# 

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

8# 

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

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

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

12# License for the specific language governing permissions and limitations 

13# under the License. 

14 

15from oslo_config import cfg 

16 

17config_drive_opts = [ 

18 cfg.StrOpt('config_drive_format', 

19 default='iso9660', 

20 deprecated_for_removal=True, 

21 deprecated_since='19.0.0', 

22 deprecated_reason=""" 

23This option was originally added as a workaround for bug in libvirt, #1246201, 

24that was resolved in libvirt v1.2.17. As a result, this option is no longer 

25necessary or useful. 

26""", 

27 choices=[ 

28 ('iso9660', 'A file system image standard that is widely ' 

29 'supported across operating systems.'), 

30 ('vfat', 'Provided for legacy reasons and to enable live ' 

31 'migration with the libvirt driver and non-shared storage')], 

32 help=""" 

33Config drive format. 

34 

35Config drive format that will contain metadata attached to the instance when it 

36boots. 

37 

38Related options: 

39 

40* This option is meaningful when one of the following alternatives occur: 

41 

42 1. ``force_config_drive`` option set to ``true`` 

43 2. the REST API call to create the instance contains an enable flag for 

44 config drive option 

45 3. the image used to create the instance requires a config drive, 

46 this is defined by ``img_config_drive`` property for that image. 

47"""), 

48 cfg.BoolOpt('force_config_drive', 

49 default=False, 

50 help=""" 

51Force injection to take place on a config drive 

52 

53When this option is set to true config drive functionality will be forced 

54enabled by default, otherwise users can still enable config drives via the REST 

55API or image metadata properties. Launched instances are not affected by this 

56option. 

57 

58Possible values: 

59 

60* True: Force to use of config drive regardless the user's input in the 

61 REST API call. 

62* False: Do not force use of config drive. Config drives can still be 

63 enabled via the REST API or image metadata properties. 

64 

65Related options: 

66 

67* Use the 'mkisofs_cmd' flag to set the path where you install the 

68 genisoimage program. If genisoimage is in same path as the 

69 nova-compute service, you do not need to set this flag. 

70"""), 

71 cfg.StrOpt('mkisofs_cmd', 

72 default='genisoimage', 

73 help=""" 

74Name or path of the tool used for ISO image creation. 

75 

76Use the ``mkisofs_cmd`` flag to set the path where you install the 

77``genisoimage`` program. If ``genisoimage`` is on the system path, you do not 

78need to change the default value. 

79 

80Possible values: 

81 

82* Name of the ISO image creator program, in case it is in the same directory 

83 as the nova-compute service 

84* Path to ISO image creator program 

85 

86Related options: 

87 

88* This option is meaningful when config drives are enabled. 

89"""), 

90] 

91 

92 

93def register_opts(conf): 

94 conf.register_opts(config_drive_opts) 

95 

96 

97def list_opts(): 

98 return {"DEFAULT": config_drive_opts}