def build_network_auto_transaction():
    from ovirt.node.config.defaults import Network, Nameservers, \
        Timeservers, Hostname

    txs = Transaction("Automatic Installation")

    mhostname = Hostname()
    txs += mhostname.transaction()

    mnet = Network()
    netmodel = mnet.retrieve()
    logger.debug("Got netmodel: %s" % netmodel)

    if netmodel["iface"]:
        if not netmodel["ipaddr"]:
            txs.append(SetDefaultBootproto())

        txs += mnet.transaction()

        mdns = Nameservers()
        txs += mdns.transaction()

        mntp = Timeservers()
        txs += mntp.transaction()

    return txs
示例#2
0
    def transaction(self, secret):
        tx = Transaction("Dummy TX")

        obj = self

        obj.secret = secret

        class DummyTXE(Transaction.Element):
            def commit(self):
                obj.txe_counter += 1

        tx.append(DummyTXE())

        return tx
示例#3
0
    def transaction(self, secret):
        tx = Transaction("Dummy TX")

        obj = self

        obj.secret = secret

        class DummyTXE(Transaction.Element):
            def commit(self):
                obj.txe_counter += 1

        tx.append(DummyTXE())

        return tx
示例#4
0
    def transaction(self):
        logger.debug("Running transaction")
        from ovirt.node.utils import Transaction

        output = self.output

        class Wrapper(Transaction.Element):
            title = "Test transaction for %s" % self.trans_name

            def commit(self):
                print output

        tx = Transaction("Test")
        tx.append(Wrapper())
        return tx
    e.g. to avoid reboot loops using Cobbler PXE only once
    Cobbler XMLRPC post-install trigger (XXX is there cobbler SRV record?):
    wget "http://192.168.50.2/cblr/svc/op/trig/mode/post/system/$(hostname)"
      -O /dev/null
    """
    title = "Running Hooks"

    def commit(self):
        hooks.Hooks.post_auto_install()


if __name__ == "__main__":
    if "--debug" in sys.argv:
        logging.basicConfig(level=logging.DEBUG)

    tx = Transaction("Automatic Installation")

    tx.append(PrepareInstallation())

    # setup network before storage for iscsi installs
    if is_iscsi_install():
        tx.append(ConfigureNetworking())

    if not is_stateless():
        tx.append(AutomaticDiskPartitioning())

    if not is_iscsi_install():
        tx.append(ConfigureNetworking())

    # set ssh_passwd_auth
    if "OVIRT_SSH_PWAUTH" in OVIRT_VARS:
def is_stateless():
    # check if theres a key first
    if OVIRT_VARS.has_key("OVIRT_STATELESS"):
        if OVIRT_VARS["OVIRT_STATELESS"] == "1":
            return True
        elif OVIRT_VARS["OVIRT_STATELESS"] == "0":
            return False
    return False


if __name__ == "__main__":
    if "--debug" in sys.argv:
        logging.basicConfig(level=logging.DEBUG)

    tx = Transaction("Automatic Installation")

    tx.append(PrepareInstallation())

    # setup network before storage for iscsi installs
    if is_iscsi_install():
        tx.append(ConfigureNetworking())

    if not is_stateless():
        tx.append(AutomaticDiskPartitioning())

    if not is_iscsi_install():
        tx.append(ConfigureNetworking())

    # set ssh_passwd_auth
    if "OVIRT_SSH_PWAUTH" in OVIRT_VARS: