Esempio n. 1
0
    def runResult(result):
        # attempt to fall back on something known

        if not result or result == '':
            scheduler_name = proposed_scheduler_name
            if not scheduler_name or scheduler_name == '':
                scheduler_name = MscConfig().default_scheduler
        else:
            scheduler_name = result
        logging.getLogger().debug(
            "got %s as scheduler for client %s" %
            (scheduler_name, computer[1]['objectUUID'][0]))

        if scheduler_name not in MscConfig().schedulers:
            logging.getLogger().warn("scheduler %s does not exist" %
                                     (scheduler_name))
            return twisted.internet.defer.fail(
                twisted.python.failure.Failure(
                    "Invalid scheduler %s (does not seem to exist)" %
                    (scheduler_name)))

        mydeffered = getProxy(
            MscConfig().schedulers[scheduler_name]).callRemote(
                function, computer[1]['objectUUID'][0],
                computer[1]['fullname'], computer[1]['cn'][0],
                noNoneList(computer[1]['ipHostNumber']),
                noNoneList(computer[1]['macAddress']),
                noNoneList(computer[1]['subnetMask']), *args)
        mydeffered.addCallback(parseResult).addErrback(parseError)
        return mydeffered
Esempio n. 2
0
    def runResult(result):
        # attempt to fall back on something known

        if not result or result == '':
            scheduler_name = proposed_scheduler_name
            if not scheduler_name or scheduler_name == '':
                scheduler_name = MscConfig().default_scheduler
        else:
            scheduler_name = result
        logging.getLogger().debug("got %s as scheduler for client %s" % (scheduler_name, computer[1]['objectUUID'][0]))

        if scheduler_name not in MscConfig().schedulers:
            logging.getLogger().warn("scheduler %s does not exist" % (scheduler_name))
            return twisted.internet.defer.fail(twisted.python.failure.Failure("Invalid scheduler %s (does not seem to exist)" % (scheduler_name)))

        mydeffered = getProxy(MscConfig().schedulers[scheduler_name]).callRemote(
            function,
            computer[1]['objectUUID'][0],
            computer[1]['fullname'],
            computer[1]['cn'][0],
            noNoneList(computer[1]['ipHostNumber']),
            noNoneList(computer[1]['macAddress']),
            noNoneList(computer[1]['subnetMask']),
            *args
        )
        mydeffered.addCallback(parseResult).addErrback(parseError)
        return mydeffered
Esempio n. 3
0
    def scheduler_choose_client_ip(self, scheduler, uuid):
        ctx = self.currentContext
        computer = ComputerManager().getComputer(ctx, {'uuid': uuid}, True)
        network = computer[1]

        interfaces = {"uuid"      : uuid,
                      "fqdn"      : network["cn"][0],
                      "shortname" : network["cn"][0],
                      "ips"       : noNoneList(network["ipHostNumber"]),
                      "macs"      : noNoneList(network["macAddress"]),
                      "netmasks"  : noNoneList(network["subnetMask"]),
                      }
        return xmlrpcCleanup2(mmc.plugins.msc.client.scheduler.choose_client_ip(scheduler, interfaces))
Esempio n. 4
0
    def scheduler_choose_client_ip(self, scheduler, uuid):
        if uuid in self.ip_table:
            ip = self.ip_table[uuid]
            logging.getLogger().debug('IP address for %s found: %s' % (uuid, ip))
            return ip
        else:
            logging.getLogger().warn('IP address for %s not received yet from CM' % (uuid))

        ctx = self.currentContext
        computer = ComputerManager().getComputer(ctx, {'uuid': uuid}, True)
        network = computer[1]

        interfaces = {"uuid"      : uuid,
                      "fqdn"      : network["cn"][0],
                      "shortname" : network["cn"][0],
                      "ips"       : noNoneList(network["ipHostNumber"]),
                      "macs"      : noNoneList(network["macAddress"]),
                      "netmasks"  : noNoneList(network["subnetMask"]),
                      }
        return xmlrpcCleanup2(mmc.plugins.msc.client.scheduler.choose_client_ip(scheduler, interfaces))