diff --git a/nova/tests/unit/virt/ironic/test_driver.py b/nova/tests/unit/virt/ironic/test_driver.py index 736eac24ca90..bf3291833d20 100644 --- a/nova/tests/unit/virt/ironic/test_driver.py +++ b/nova/tests/unit/virt/ironic/test_driver.py @@ -2785,8 +2785,8 @@ class IronicDriverGenerateConfigDriveTestCase(test.NoDBTestCase): node_id=self.node.id, address='00:00:00:00:00:02', port_group_id=portgroup.id) - self.mock_conn.ports.return_value = [port1, port2] - self.mock_conn.port_groups.return_value = [portgroup] + self.mock_conn.ports.return_value = iter([port1, port2]) + self.mock_conn.port_groups.return_value = iter([portgroup]) metadata = self.driver._get_network_metadata(self.node, self.network_info) diff --git a/nova/virt/ironic/driver.py b/nova/virt/ironic/driver.py index 3af85d3bd049..c99021866962 100644 --- a/nova/virt/ironic/driver.py +++ b/nova/virt/ironic/driver.py @@ -1050,10 +1050,10 @@ class IronicDriver(virt_driver.ComputeDriver): :param network_info: Instance network information. """ base_metadata = netutils.get_network_metadata(network_info) - ports = self.ironic_connection.ports(node=node.id, details=True) - port_groups = self.ironic_connection.port_groups( + ports = list(self.ironic_connection.ports(node=node.id, details=True)) + port_groups = list(self.ironic_connection.port_groups( node=node.id, details=True, - ) + )) vif_id_to_objects = {'ports': {}, 'portgroups': {}} for collection, name in ((ports, 'ports'), (port_groups, 'portgroups')):