コード例 #1
0
ファイル: status_page.py プロジェクト: Zealsathish/ovirt-node
    def model(self):
        mng = defaults.Management()
        managementifs = mng.retrieve()["managed_ifnames"]

        # If prmiaryif == None, then the corretc NIC will be automatically be
        # determined
        primaryif = managementifs[0] if managementifs else None

        self.logger.debug("NIC for status: %s" % primaryif)

        net_status, net_br, net_addrs = \
            utils.network.networking_status(primaryif)
        net_addrs_str = ""
        if net_addrs:
            net_addrs_str = "IPv4: {inet}\nIPv6: {inet6}".format(**net_addrs)

        num_domains = virt.number_of_domains()

        model = {
            "status": virt.hardware_status(),
            "managed_by": mng.retrieve()["managed_by"],
            "networking": net_status,
            "networking.ip": net_addrs_str,
            "networking.bridge": net_br,
            "logs": self._logging_summary(),
            "libvirt.num_guests": num_domains,
        }

        model.update(self._extra_model)
        return model
コード例 #2
0
    def model(self):
        mng = defaults.Management()
        managementifs = mng.retrieve()["managed_ifnames"]

        # If prmiaryif == None, then the corretc NIC will be automatically be
        # determined
        primaryif = managementifs[0] if managementifs else None

        self.logger.debug("NIC for status: %s" % primaryif)

        net_status, net_br, net_addrs = \
            utils.network.networking_status(primaryif)
        net_addrs_str = ""
        if net_addrs:
            net_addrs_str = "IPv4: {inet}\nIPv6: {inet6}".format(**net_addrs)

        num_domains = virt.number_of_domains()

        model = {
            "status": virt.hardware_status(),
            "managed_by": mng.retrieve()["managed_by"],
            "networking": net_status,
            "networking.ip": net_addrs_str,
            "networking.bridge": net_br,
            "logs": self._logging_summary(),
            "libvirt.num_guests": num_domains,
        }

        model.update(self._extra_model)
        return model
コード例 #3
0
ファイル: status_page.py プロジェクト: ianjw11/ovirt-node
    def on_merge(self, changes):
        # Handle button presses
        number_of_vm = "There are %s Virtual Machines running." \
            % (virt.number_of_domains())
        if "action.lock" in changes:
            self.logger.info("Locking screen")
            self._lock_dialog = LockDialog()
            self.application.ui.hotkeys_enabled(False)
            self.widgets.add(self._lock_dialog)
            return self._lock_dialog

        elif "action.unlock" in changes and "password" in changes:
            self.logger.info("UnLocking screen")
            pam = security.PAM()
            if pam.authenticate(os.getlogin(), changes["password"]):
                self._lock_dialog.close()
                self.application.ui.hotkeys_enabled(True)
            else:
                self.application.notice("The provided password was incorrect.")
                self.widgets["password"].text("")

        elif "action.logoff" in changes:
            self.logger.info("Logging off")
            self.application.quit()

        elif "action.restart" in changes:
            self.logger.info("Restarting")
            return ui.ConfirmationDialog("confirm.reboot",
                                         "Confirm System Restart",
                                         number_of_vm +
                                         "\nThis will restart the system,"
                                         "proceed?")

        elif "confirm.reboot.yes" in changes:
            self.logger.info("Confirm Restarting")
            self.dry_or(lambda: system.reboot())

        elif "action.poweroff" in changes:
            self.logger.info("Shutting down")
            return ui.ConfirmationDialog("confirm.shutdown",
                                         "Confirm System Poweroff",
                                         number_of_vm +
                                         "\nThis will shut down the system,"
                                         "proceed?")

        elif "confirm.shutdown.yes" in changes:
            self.logger.info("Confirm Shutting down")
            self.dry_or(lambda: system.poweroff())

        elif "action.hostkey" in changes:
            self.logger.info("Showing hostkey")
            return HostkeyDialog("dialog.hostkey", "Host Key")

        elif "action.cpu_details" in changes:
            self.logger.info("Showing CPU details")
            return CPUFeaturesDialog("dialog.cpu_details", "CPU Details")

        elif "_save" in changes:
            self.widgets["dialog.hostkey"].close()
コード例 #4
0
ファイル: status_page.py プロジェクト: fabiand/ovirt-node
    def on_merge(self, changes):
        # Handle button presses
        number_of_vm = "There are %s Virtual Machines running." \
            % (virt.number_of_domains())
        if "action.lock" in changes:
            self.logger.info("Locking screen")
            self._lock_dialog = LockDialog()
            self.application.ui.hotkeys_enabled(False)
            self.widgets.add(self._lock_dialog)
            return self._lock_dialog

        elif "action.unlock" in changes and "password" in changes:
            self.logger.info("UnLocking screen")
            pam = security.PAM()
            if pam.authenticate(os.getlogin(), changes["password"]):
                self._lock_dialog.close()
                self.application.ui.hotkeys_enabled(True)
            else:
                self.application.notice("The provided password was incorrect.")
                self.widgets["password"].text("")

        elif "action.logoff" in changes:
            self.logger.info("Logging off")
            self.application.quit()

        elif "action.restart" in changes:
            self.logger.info("Restarting")
            return ui.ConfirmationDialog(
                "confirm.reboot", "Confirm System Restart",
                number_of_vm + "\nThis will restart the system,"
                "proceed?")

        elif "confirm.reboot.yes" in changes:
            self.logger.info("Confirm Restarting")
            self.dry_or(lambda: system.reboot())

        elif "action.poweroff" in changes:
            self.logger.info("Shutting down")
            return ui.ConfirmationDialog(
                "confirm.shutdown", "Confirm System Poweroff",
                number_of_vm + "\nThis will shut down the system,"
                "proceed?")

        elif "confirm.shutdown.yes" in changes:
            self.logger.info("Confirm Shutting down")
            self.dry_or(lambda: system.poweroff())

        elif "action.hostkey" in changes:
            self.logger.info("Showing hostkey")
            return HostkeyDialog("dialog.hostkey", "Host Key")

        elif "action.cpu_details" in changes:
            self.logger.info("Showing CPU details")
            return CPUFeaturesDialog("dialog.cpu_details", "CPU Details")

        elif "_save" in changes:
            self.widgets["dialog.hostkey"].close()
コード例 #5
0
    def model(self):
        net_status, net_br, net_addrs = utils.network.networking_status()
        net_addrs_str = ""
        if net_addrs:
            net_addrs_str = "\nIPv4: {inet}\nIPv6: {inet6}".format(**net_addrs)

        num_domains = virt.number_of_domains()

        return {
            "status": virt.hardware_status(),
            "networking": net_status,
            "networking.bridge": "%s %s" % (net_br, net_addrs_str),
            "logs": self._logging_summary(),
            "libvirt.num_guests": num_domains,
        }
コード例 #6
0
ファイル: status_page.py プロジェクト: ianjw11/ovirt-node
    def model(self):
        net_status, net_br, net_addrs = utils.network.networking_status()
        net_addrs_str = ""
        if net_addrs:
            net_addrs_str = "\nIPv4: {inet}\nIPv6: {inet6}".format(**net_addrs)

        num_domains = virt.number_of_domains()

        return {
            "status": virt.hardware_status(),
            "networking": net_status,
            "networking.bridge": "%s %s" % (net_br, net_addrs_str),
            "logs": self._logging_summary(),
            "libvirt.num_guests": num_domains,
        }