@mock.patch('nova.console.serial._verify_port', (lambda x, y: None))
def test_acquire_port(self):
    (start, stop) = (15, 20)
    self.flags(port_range=('%d:%d' % (start, stop)), group='serial_console')
    for port in six.moves.range(start, stop):
        self.assertEqual(port, serial.acquire_port('127.0.0.1'))
    for port in six.moves.range(start, stop):
        self.assertEqual(port, serial.acquire_port('127.0.0.2'))
    self.assertTrue(10, len(serial.ALLOCATED_PORTS))
@mock.patch('nova.console.serial._verify_port', (lambda x, y: None))
def test_acquire_port(self):
    (start, stop) = (15, 20)
    self.flags(port_range=('%d:%d' % (start, stop)), group='serial_console')
    for port in six.moves.range(start, stop):
        self.assertEqual(port, serial.acquire_port('127.0.0.1'))
    for port in six.moves.range(start, stop):
        self.assertEqual(port, serial.acquire_port('127.0.0.2'))
    self.assertTrue(10, len(serial.ALLOCATED_PORTS))