@@ -51,29 +51,20 @@ def _get_network_metadata_with_storage(self, node, network_info):
5151 base_metadata ["networks" ].append (network )
5252 return base_metadata
5353
54- # This is almost exact copy of the IronicDriver's _generate_configdrive,
55- # but we make a determination if injecting storage IPs information is needed
56- # based on the instance 'storage' property.
57- def _generate_configdrive (
58- self , context , instance , node , network_info , extra_md = None , files = None
59- ):
60- """Generate a config drive with optional storage info.
54+ def _understack_get_network_metadata (self , instance , node , network_info ):
55+ """Get network metadata with optional storage network configuration.
56+
57+ This method implements the Understack-specific logic for determining
58+ whether to include storage network configuration based on instance
59+ metadata and configuration settings.
6160
6261 :param instance: The instance object.
6362 :param node: The node object.
6463 :param network_info: Instance network information.
65- :param extra_md: Optional, extra metadata to be added to the
66- configdrive.
67- :param files: Optional, a list of paths to files to be added to
68- the configdrive.
69-
64+ :returns: Network metadata dictionary
7065 """
71- if not extra_md :
72- extra_md = {}
73-
74- ### Understack modified code START
7566 if (
76- instance .metadata [ "storage" ] == "wanted"
67+ instance .metadata . get ( "storage" ) == "wanted"
7768 and CONF .nova_understack .ip_injection_enabled
7869 ):
7970 logger .info ("Instance %s requires storage network setup." , instance .uuid )
@@ -99,6 +90,31 @@ def _generate_configdrive(
9990 instance .uuid ,
10091 )
10192 network_metadata = self ._get_network_metadata (node , network_info )
93+
94+ return network_metadata
95+
96+ # This is almost exact copy of the IronicDriver's _generate_configdrive,
97+ # but we make a determination if injecting storage IPs information is needed
98+ # based on the instance 'storage' property.
99+ def _generate_configdrive (
100+ self , context , instance , node , network_info , extra_md = None , files = None
101+ ):
102+ """Generate a config drive with optional storage info.
103+
104+ :param instance: The instance object.
105+ :param node: The node object.
106+ :param network_info: Instance network information.
107+ :param extra_md: Optional, extra metadata to be added to the
108+ configdrive.
109+ :param files: Optional, a list of paths to files to be added to
110+ the configdrive.
111+
112+ """
113+ if not extra_md :
114+ extra_md = {}
115+
116+ ### Understack modified code START
117+ network_metadata = self ._understack_get_network_metadata (instance , node , network_info )
102118 ### Understack modified code END
103119
104120 i_meta = instance_metadata .InstanceMetadata (
0 commit comments