devops network pxe support
This commit is contained in:
parent
acf62669bf
commit
114b25560e
@ -58,7 +58,11 @@ class Controller:
|
||||
|
||||
for network in environment.networks:
|
||||
logger.info("Building network %s" % network.name)
|
||||
|
||||
if network.pxe:
|
||||
tftp_path = os.path.join(environment.work_dir, "tftp")
|
||||
if not os.path.exists(tftp_path):
|
||||
os.mkdir(tftp_path, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)
|
||||
network.tftp_root_dir = tftp_path
|
||||
network.ip_addresses = self.networks_pool.get()
|
||||
self.driver.create_network(network)
|
||||
network.driver = self.driver
|
||||
|
@ -43,12 +43,15 @@ class LibvirtXMLBuilder:
|
||||
|
||||
if hasattr(network, 'ip_addresses') and not network.ip_addresses is None:
|
||||
with network_xml.ip(address=str(network.ip_addresses[1]), prefix=str(network.ip_addresses.prefixlen)):
|
||||
if network.pxe:
|
||||
network_xml.tftp(root=network.tftp_root_dir)
|
||||
if network.dhcp_server:
|
||||
with network_xml.dhcp:
|
||||
start = network.ip_addresses[2]
|
||||
end = network.ip_addresses[network.ip_addresses.numhosts-2]
|
||||
|
||||
network_xml.range(start=str(start), end=str(end))
|
||||
if network.pxe:
|
||||
network_xml.bootp(file="pxelinux.0")
|
||||
|
||||
return str(network_xml)
|
||||
|
||||
|
@ -44,11 +44,12 @@ class Environment(ManagedObject):
|
||||
return name2network
|
||||
|
||||
class Network(ManagedObject):
|
||||
def __init__(self, name, dhcp_server=False):
|
||||
def __init__(self, name, dhcp_server=False, pxe=False):
|
||||
super(Network, self).__init__()
|
||||
|
||||
self.name = name
|
||||
self.dhcp_server = dhcp_server
|
||||
self.pxe = pxe
|
||||
|
||||
def start(self):
|
||||
self.driver.start_network(self)
|
||||
|
@ -9,7 +9,7 @@ import traceback
|
||||
import logging
|
||||
logger = logging.getLogger('integration')
|
||||
|
||||
class Ci:
|
||||
class Ci(object):
|
||||
hostname = 'nailgun'
|
||||
domain = 'mirantis.com'
|
||||
|
||||
|
@ -6,6 +6,10 @@ import paramiko
|
||||
|
||||
logging.basicConfig(format=':%(lineno)d: %(asctime)s %(message)s', level=logging.DEBUG)
|
||||
|
||||
|
||||
"""
|
||||
Integration test helpers
|
||||
"""
|
||||
class HTTPClient(object):
|
||||
def __init__(self):
|
||||
self.opener = urllib2.build_opener(urllib2.HTTPHandler)
|
||||
|
@ -8,12 +8,13 @@ import urllib2
|
||||
from unittest import TestCase
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
from . import ci
|
||||
from devops.helpers import wait, tcp_ping, http
|
||||
from integration.helpers import HTTPClient, SSHClient
|
||||
|
||||
import paramiko
|
||||
|
||||
from devops.helpers import wait, tcp_ping, http
|
||||
|
||||
from . import ci
|
||||
from integration.helpers import HTTPClient, SSHClient
|
||||
|
||||
logging.basicConfig(format=':%(lineno)d: %(asctime)s %(message)s', level=logging.DEBUG)
|
||||
|
||||
SOLO_PATH = os.path.join(os.path.dirname(__file__), "..", "..", "scripts", "agent")
|
||||
@ -25,6 +26,8 @@ SAMPLE_REMOTE_PATH = "/home/ubuntu"
|
||||
class StillPendingException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
class TestNode(TestCase):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(TestNode, self).__init__(*args, **kwargs)
|
||||
|
Loading…
Reference in New Issue
Block a user