Fabian Deutsch has uploaded a new change for review. Change subject: fix: Keep bootproto in config file ......................................................................
fix: Keep bootproto in config file Previously the bootproto (or other changes) were dropped from the cfg file, due to some legacy code. Now the cfg file is kept as it was and it's beeing worked around this problem. Additionally the UI code was changed to use the features of the new NIC classes. Change-Id: I5098b1a6b2b5b6b4515e8a79b4fd85c7e4fbcc1e Signed-off-by: Fabian Deutsch <[email protected]> --- M scripts/ovirt-auto-install.py M src/ovirt/node/setup/core/network_page.py M src/ovirtnode/network.py 3 files changed, 24 insertions(+), 14 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/00/15700/1 diff --git a/scripts/ovirt-auto-install.py b/scripts/ovirt-auto-install.py index ff554bd..b100bb3 100755 --- a/scripts/ovirt-auto-install.py +++ b/scripts/ovirt-auto-install.py @@ -106,10 +106,18 @@ title = "Installing Bootloader" def commit(self): + # FIXME + # This is a hack because the legacy code messes with + # the config file, so we backup and replay it later + cfgfile = defaults.NodeConfigFile() + cfg = cfgfile.get_dict() + install = Install() if not install.ovirt_boot_setup(): raise RuntimeError("Bootloader Installation Failed") + cfgfile.write(cfg) + if __name__ == "__main__": tx = Transaction("Automatic Installation") diff --git a/src/ovirt/node/setup/core/network_page.py b/src/ovirt/node/setup/core/network_page.py index 6b668af..a523f01 100644 --- a/src/ovirt/node/setup/core/network_page.py +++ b/src/ovirt/node/setup/core/network_page.py @@ -23,7 +23,6 @@ from ovirt.node.plugins import Changeset from ovirt.node.setup.core import ping from ovirt.node.utils import network -from ovirt.node.utils.network import BridgedNIC """ Network page plugin @@ -369,16 +368,12 @@ ip6model["gateway"], ip6model["bootproto"]) - if type(nic) is BridgedNIC: - if model["bootproto"] == "dhcp": - if nic.bridge_nic.exists(): - routes = utils.network.Routes() - gateway = routes.default() - ipaddr, netmask = nic.bridge_nic.ipv4_address().items() - vlanid = ",".join(nic.bridge_nic.vlanids()) - else: - self.logger.warning("Bridge assigned but couldn't " + - "gather nic info: %s" % nic.bridge_nic) + if model["bootproto"] == "dhcp": + if nic.exists(): + routes = utils.network.Routes() + gateway = routes.default() + ipaddr, netmask = nic.ipv4_address().items() + vlanid = ",".join(nic.bridge_nic.vlanids()) link_status_txt = ("Connected" if nic.has_link() else "Disconnected") diff --git a/src/ovirtnode/network.py b/src/ovirtnode/network.py index e7ee150..abebfeb 100644 --- a/src/ovirtnode/network.py +++ b/src/ovirtnode/network.py @@ -112,6 +112,14 @@ return True +class SetDefaultBootproto(Transaction.Element): + title = "Setting DHCP" + + def commit(self): + from ovirt.node.config import defaults + defaults.Network().update(bootproto="dhcp") + + def build_network_auto_transaction(): from ovirt.node.config.defaults import Network, Nameservers, \ Timeservers, Hostname @@ -124,11 +132,10 @@ mnet = Network() netmodel = mnet.retrieve() logger.debug("Got netmodel: %s" % netmodel) + if netmodel["iface"]: - # Only running net configuration if bootif is given - # use dhcp if bootif is given if not netmodel["ipaddr"]: - mnet.update(bootproto="dhcp") + txs.append(SetDefaultBootproto()) txs += mnet.transaction() -- To view, visit http://gerrit.ovirt.org/15700 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5098b1a6b2b5b6b4515e8a79b4fd85c7e4fbcc1e Gerrit-PatchSet: 1 Gerrit-Project: ovirt-node Gerrit-Branch: master Gerrit-Owner: Fabian Deutsch <[email protected]> _______________________________________________ node-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/node-patches
