def add_rack(building, rackid, netid, aqservice, aqhost, aqport): aq = AQRunner(aqservice=aqservice, aqhost=aqhost, aqport=aqport) rack = TestRack(building, rackid) rc = aq.wait(["ping"]) for half in [0, 1]: network = TestNetwork(netid, half) tor_switch = rack.get_tor_switch(half) "Adding a tor_switch" rc = aq.wait(["add", "tor_switch", "--tor_switch", tor_switch, "--building", building, "--rackid", rack.rackid, "--model", "rs g8000", "--interface", "xge49", "--rackrow", rack.row, "--rackcolumn", rack.column, "--mac", network.get_mac(0), "--ip", network.get_ip(0)]) domain = "testdom_odd" if rackid % 2 else "testdom_even" for offset in range(1, 49): machine = rack.get_machine(half, offset) print "Adding machine %s" % machine rc = aq.wait(["add", "machine", "--machine", machine, "--model", "vb1205xm", "--rack", rack.get_rack()]) print "Adding an interface with %s" % network.get_mac(offset) rc = aq.wait(["add", "interface", "--machine", machine, "--interface", "eth0", "--mac", network.get_mac(offset)]) host = rack.get_host(half, offset) print "Adding host %s with %s" % (host, network.get_ip(offset)) rc = aq.wait(["add", "host", "--machine", machine, "--hostname", host, "--archetype", "aquilon", "--domain", domain, "--buildstatus", "blind", "--ip", network.get_ip(offset)]) print "make aquilon for host %s" % host rc = aq.wait(["make", "aquilon", "--hostname", host, "--os", "linux/5.0.1-x86_64", "--personality", "compileserver"])
def update_rack(building, rackid, newnetid, aqservice, aqhost, aqport): aq = AQRunner(aqservice=aqservice, aqhost=aqhost, aqport=aqport) rack = TestRack(building, rackid) rc = aq.wait(["ping"]) for half in [0, 1]: newnetwork = TestNetwork(newnetid, half) tor_switch = rack.get_tor_switch(half) print "Updating tor_switch %s" % tor_switch rc = aq.wait([ "update", "interface", "--machine", tor_switch, "--interface", "xge49", "--mac", newnetwork.get_mac(0), "--ip", newnetwork.get_ip(0) ]) for offset in range(1, 49): machine = rack.get_machine(half, offset) print "Updating machine %s" % machine rc = aq.wait([ "update", "interface", "--machine", machine, "--interface", "eth0", "--mac", newnetwork.get_mac(offset), "--ip", newnetwork.get_ip(offset) ]) host = rack.get_host(half, offset) print "reconfiguring host %s" % host rc = aq.wait(["reconfigure", "--hostname", host])
def transition_rack(building, rackid, status, aqservice, aqhost, aqport): aq = AQRunner(aqservice=aqservice, aqhost=aqhost, aqport=aqport) rack = TestRack(building, rackid) rc = aq.wait(["ping"]) for half in [0, 1]: for offset in range(1, 49): host = rack.get_host(half, offset) print "Transitioning host %s to status %s" % (host, status) rc = aq.wait( ["reconfigure", "--hostname", host, "--buildstatus", status])
def transition_rack(building, rackid, status, aqservice, aqhost, aqport): aq = AQRunner(aqservice=aqservice, aqhost=aqhost, aqport=aqport) rack = TestRack(building, rackid) rc = aq.wait(["ping"]) for half in [0, 1]: for offset in range(1, 49): host = rack.get_host(half, offset) print "Transitioning host %s to status %s" % (host, status) rc = aq.wait(["reconfigure", "--hostname", host, "--buildstatus", status])
def del_rack(building, rackid, aqservice, aqhost, aqport): aq = AQRunner(aqservice=aqservice, aqhost=aqhost, aqport=aqport) rack = TestRack(building, rackid) rc = aq.wait(["ping"]) for half in [0, 1]: for offset in range(1, 49): host = rack.get_host(half, offset) print "Checking that host exists before deleting." rc = aq.wait(["show", "host", "--hostname", host]) if rc == 0: print "Deleting host %s" % host rc = aq.wait(["del", "host", "--hostname", host]) machine = rack.get_machine(half, offset) print "Deleting machine %s" % machine rc = aq.wait(["del", "machine", "--machine", machine]) tor_switch = rack.get_tor_switch(half) "Deleting tor_switch %s" % tor_switch rc = aq.wait(["del", "tor_switch", "--tor_switch", tor_switch])
def update_rack(building, rackid, newnetid, aqservice, aqhost, aqport): aq = AQRunner(aqservice=aqservice, aqhost=aqhost, aqport=aqport) rack = TestRack(building, rackid) rc = aq.wait(["ping"]) for half in [0, 1]: newnetwork = TestNetwork(newnetid, half) tor_switch = rack.get_tor_switch(half) print "Updating tor_switch %s" % tor_switch rc = aq.wait( [ "update", "interface", "--machine", tor_switch, "--interface", "xge49", "--mac", newnetwork.get_mac(0), "--ip", newnetwork.get_ip(0), ] ) for offset in range(1, 49): machine = rack.get_machine(half, offset) print "Updating machine %s" % machine rc = aq.wait( [ "update", "interface", "--machine", machine, "--interface", "eth0", "--mac", newnetwork.get_mac(offset), "--ip", newnetwork.get_ip(offset), ] ) host = rack.get_host(half, offset) print "reconfiguring host %s" % host rc = aq.wait(["reconfigure", "--hostname", host])