Example #1
0
 def __init__(self, path):
     widgets = [ui.Entry("bond.name", _("Name:")),
                ui.Divider("bond.divider[0]"),
                ui.Entry("bond.options", _("Options:")),
                ui.Divider("bond.divider[1]"),
                NicTable("bond.slaves", multi=True)]
     super(CreateBondDialog, self).__init__(path, _("Create Bond"), widgets)
Example #2
0
    def ui_content(self):
        """Describes the UI this plugin requires
        This is an ordered list of (path, widget) tuples.
        """
        mbond = defaults.NicBonding().retrieve()
        bond_status = ", ".join(mbond["slaves"] or [])
        bond_lbl = "Remove %s (%s)" % (mbond["name"], bond_status) \
            if bond_status else "Create Bond"

        ws = [
            ui.Header("header[0]", "System Identification"),
            ui.Entry("hostname", "Hostname:"),
            ui.Divider("divider[0]"),
            ui.Entry("dns[0]", "DNS Server 1:"),
            ui.Entry("dns[1]", "DNS Server 2:"),
            ui.Divider("divider[1]"),
            ui.Entry("ntp[0]", "NTP Server 1:"),
            ui.Entry("ntp[1]", "NTP Server 2:"),
            ui.Divider("divider[2]"),
            NicTable("nics", height=3),
            ui.Row("row[0]", [
                ui.Button("button.ping", "Ping"),
                ui.Button("button.toggle_bond", bond_lbl)
            ])
        ]

        page = ui.Page("page", ws)
        # Save it "locally" as a dict, for better accessability
        self.widgets.add(page)
        return page
Example #3
0
    def __init__(self, title, description, plugin):
        self.keys = [
            "rhn.proxyhost", "rhn.proxyport", "rhn.proxyuser",
            "rhn.proxypassword"
        ]

        def clear_invalid(dialog, changes):
            [plugin.stash_change(prefix) for prefix in self.keys]

        title = _("RHSM Proxy Information")

        entries = [
            ui.Entry("rhn.proxyhost", "Server:"),
            ui.Entry("rhn.proxyport", "Port:"),
            ui.Entry("rhn.proxyuser", "Username:"******"rhn.proxypassword", "Password:"******"label[0]", description),
            ui.Divider("divider[0]")
        ]
        children.extend(entries)
        super(ProxyDialog, self).__init__("proxy.dialog", title, children)
        self.buttons = [
            ui.CloseButton("proxy.save", _("Save"), enabled=True),
            ui.CloseButton("proxy.close", _("Cancel"))
        ]

        b = plugins.UIElements(self.buttons)
        b["proxy.close"].on_activate.clear()
        b["proxy.close"].on_activate.connect(ui.CloseAction())
        b["proxy.close"].on_activate.connect(clear_invalid)
Example #4
0
    def ui_content(self):
        ws = [
            ui.Header("header", _("Remote Storage")),
            ui.Entry("iscsi.initiator_name",
                     _("iSCSI Initiator Name:"),
                     align_vertical=True),
            ui.Divider("divider[0]"),
        ]

        net_is_configured = utils.network.NodeNetwork().is_configured()

        if not net_is_configured:
            ws.extend([
                ui.Notice(
                    "network.notice", "Networking is not configured, " +
                    "please configure it before NFSv4 " + "Domain"),
                ui.Divider("notice.divider")
            ])
        ws.extend([
            ui.Entry("nfsv4.domain",
                     _("NFSv4 Domain (example.redhat.com):"),
                     enabled=net_is_configured,
                     align_vertical=True)
        ])

        page = ui.Page("page", ws)
        self.widgets.add(page)
        return page
Example #5
0
 def ui_content(self):
     ws = [ui.Header("header[0]", "Monitoring Configuration"),
           ui.Label("label", "Collectd gathers statistics " +
                    "about the system and can be used to find " +
                    "performance bottlenecks and predict future " +
                    "system load."),
           ui.Entry("collectd.address", "Server Address:"),
           ui.Entry("collectd.port", "Server Port:"),
           ]
     page = ui.Page("page", ws)
     self.widgets.add(page)
     return page
Example #6
0
    def ui_content(self):

        ws = [
            ui.Header("header[0]", _("Logging")),
            ui.Label(
                "logrotate.header",
                _("The logs will be rotated at the ") +
                _("specified size not more often than the ") +
                _("set inerval")),
            ui.Entry("logrotate.max_size",
                     _("Logrotate Max Log ") + _("Size (KB):")),
            ui.Options("logrotate.interval", _("Interval"), self._intervals),
            ui.Divider("divider[0]")
        ]

        net_is_configured = utils.network.NodeNetwork().is_configured()

        if not net_is_configured:
            ws.extend([
                ui.Notice(
                    "network.notice",
                    _("Networking is not configured, ") +
                    _("please configure it before rsyslog ") +
                    _("and/or netconsole")),
                ui.Divider("notice.divider")
            ])

        ws.extend([
            ui.Label(
                "rsyslog.header",
                _("RSyslog is an enhanced multi-") + _("threaded syslogd")),
            ui.Entry("rsyslog.address",
                     _("Server Address:"),
                     enabled=net_is_configured),
            ui.Entry("rsyslog.port",
                     _("Server Port:"),
                     enabled=net_is_configured),
            ui.Divider("divider[1]"),
            ui.Label(
                "netconsole.label",
                _("Netconsole service allows a remote sys") +
                _("log daemon to record printk() messages")),
            ui.Entry("netconsole.address",
                     _("Server Address:"),
                     enabled=net_is_configured),
            ui.Entry("netconsole.port",
                     _("Server Port:"),
                     enabled=net_is_configured)
        ])

        page = ui.Page("page", ws)
        self.widgets.add(page)
        return page
    def ui_content(self):
        ws = [ui.Header("header", "Remote Storage"),
              ui.Entry("iscsi.initiator_name", "iSCSI Initiator Name:",
                       align_vertical=True),
              ui.Divider("divider[0]"),
              ui.Entry("nfsv4.domain", "NFSv4 Domain (example.redhat.com):",
                       align_vertical=True),
              ]

        page = ui.Page("page", ws)
        self.widgets.add(page)
        return page
Example #8
0
 def ui_content(self):
     ws = [
         ui.Header("header[0]", "Add Engine to Window AD"),
         ui.Label(
             "label",
             "When add your Engine to domain,you can login the Virtual Desktop as normal user."
         ),
         ui.Entry("collectd.address", "Domain:"),
         ui.Entry("collectd.port", "port:"),
     ]
     page = ui.Page("page", ws)
     self.widgets.add(page)
     return page
Example #9
0
 def ui_content(self):
     ws = [
         ui.Header("header[0]", "Add Hostname"),
         ui.Label(
             "label",
             "When you don't have a domain , please add your Node hostname to the Engine."
         ),
         ui.Entry("collectd.ip", "Node ip address:"),
         ui.Entry("collectd.hostname", "Node hostname:"),
     ]
     page = ui.Page("page", ws)
     self.widgets.add(page)
     return page
Example #10
0
    def ui_content(self):
        ws = [
            ui.Header("header[0]", "Puppet Configuration"),
            ui.Checkbox("puppet.enabled", "Enable Puppet"),
            ui.Entry("puppet.server", "Puppet Server:"),
            ui.Entry("puppet.certname", "Puppet Certificate Name"),
            ui.Divider("divider[0]"),
        ]

        page = ui.Page("page", ws)
        page.buttons = [ui.SaveButton("action.register", "Save & Run")]

        self.widgets.add(page)
        return page
    def ui_content(self):
        sync_mgmt()

        buttons = []
        net_is_configured = utils.network.NodeNetwork().is_configured()
        header_menu = "{engine_name} Configuration".format(
            engine_name=config.engine_name)

        if not net_is_configured:
            ws = [
                ui.Header("header[0]", header_menu),
                ui.Notice(
                    "network.notice", "Networking is not configured, " +
                    "please configure it before " + "registering"),
                ui.Divider("divider[0]")
            ]

        elif self._hosted_engine_configured():
            ws = [
                ui.Header("header[0]", header_menu),
                ui.Notice(
                    "he.notice",
                    "Hosted Engine is configured. Engine registration "
                    "is disabled, as this host is already registered to"
                    " the hosted engine"),
                ui.Divider("divider[0]"),
                ui.Label("vdsm_cfg.password._label",
                         "Password for adding additional hosts"),
                ui.Label(
                    "vdsm_cfg.password._label2",
                    "Note: This sets the root password and "
                    "enables SSH"),
                ui.ConfirmedEntry("vdsm_cfg.password", "Password:"******"action.register", "Save")]

        else:
            ws = [
                ui.Header("header[0]", header_menu),
                ui.Entry("vdsm_cfg.address",
                         str(config.engine_name) + " FQDN (or fqdn:port):"),
                ui.Divider("divider[0]"),
                ui.Label(
                    "vdsm_cfg.password._label",
                    "Optional password for adding Node through " +
                    str(config.engine_name)),
                ui.Label(
                    "vdsm_cfg.password._label2",
                    "Note: This sets the root password and "
                    "enables SSH"),
                ui.ConfirmedEntry("vdsm_cfg.password", "Password:"******"action.register", "Save / Register")]

        page = ui.Page("page", ws)
        page.buttons = buttons

        self.widgets.add(page)
        return page
Example #12
0
    def ui_content(self):
        """Describes the UI this plugin requires
        This is an ordered list of (path, widget) tuples.
        """
        ws = [ui.Header("ping.header", "Ping a remote host"),
              ui.Entry("ping.address", "Address:"),
              ui.Entry("ping.count", "Count:"),
              ui.Divider("divider[1]"),
              ui.SaveButton("ping.do_ping", "Ping"),
              ui.Divider("divider[2]"),
              ui.Label("ping.result", "Result:"),
              ]

        page = ui.Page("page", ws)
        page.buttons = []
        self.widgets.add(page)
        return page
Example #13
0
    def ui_content(self):
        ws = [
            ui.Header("header[0]", _("Remote Access")),
            ui.Checkbox("ssh.pwauth", _("Enable SSH password authentication")),
            ui.Entry("ssh.port", _("SSH Daemon Port:")),
            ui.Header("header[1]", _("Strong Random Number Generator")),
            ui.Checkbox("strongrng.disable_aesni", _("Disable AES-NI")),
            ui.Entry("strongrng.num_bytes", _("Bytes Used:")),
            ui.Header("header[2]", _("Password for the admin user")),
            ui.ConfirmedEntry("passwd.admin.password",
                              _("Password:"******"page", ws)
        self.widgets.add(page)
        return page
Example #14
0
    def ui_content(self):
        """Describes the UI this plugin requires
        This is an ordered list of (path, widget) tuples.
        """
        # _types needs to be rebuild on every page view, as the network
        # state can change between page views
        # NodeNetwork relies on runtime information which is N/A in dev mode
        if self.application.args.dry:
            net_is_configured = True
        else:
            net_is_configured = NodeNetwork().is_configured()

        ws = [ui.Header("kdump._header", _("Configure Kdump"))]

        if not net_is_configured:
            self._types = self._types_local
            ws.extend([
                ui.Notice(
                    _("network.notice"),
                    _("Networking is not configured, ") +
                    _("please configure it before NFS ") +
                    _("or SSH-based kdump")),
                ui.Divider("notice.divider")
            ])
            ws.extend([ui.Options("kdump.type", _("Type"), self._types)])

        else:
            self._types = self._types_local + self._types_remote
            ws.extend([ui.Options("kdump.type", _("Type"), self._types)])
            ws.extend([
                ui.Divider("divider[0]"),
                ui.Entry("kdump.nfs_location",
                         _("NFS Location ") + _("(example.com:/var/crash):"),
                         align_vertical=True),
                ui.Divider("divider[1]"),
                ui.Entry("kdump.ssh_location",
                         _("SSH Location ") + _("([email protected]):"),
                         align_vertical=True),
                ui.Entry("kdump.ssh_key",
                         "SSH Key URL (optional):",
                         align_vertical=True)
            ])
        page = ui.Page("page", ws)
        self.widgets.add(page)
        return page
Example #15
0
 def __init__(self, plugin, path, title):
     self.plugin = plugin
     super(ConsoleDialog, self).__init__(path, title, [])
     self.plugin._extra_model.update({"console.path": self._console()})
     self.plugin.model()
     self.children = [
         ui.Label("Enter the path to a valid console device"),
         ui.Label("Example: /dev/ttyS0,115200n8"),
         ui.Entry("console.path", "Console path:")
     ]
Example #16
0
 def ui_content(self):
     """Describes the UI this plugin requires
     This is an ordered list of (path, widget) tuples.
     """
     ws = [
         ui.Header("kdump._header", "Configure Kdump"),
         ui.Options("kdump.type", "Type", self._types),
         ui.Divider("divider[0]"),
         ui.Entry("kdump.nfs_location",
                  "NFS Location " + "(example.com:/var/crash):",
                  align_vertical=True),
         ui.Divider("divider[1]"),
         ui.Entry("kdump.ssh_location",
                  "SSH Location " + "([email protected]):",
                  align_vertical=True),
     ]
     page = ui.Page("page", ws)
     self.widgets.add(page)
     return page
Example #17
0
    def ui_content(self):
        """Describes the UI this plugin requires
        This is an ordered list of (path, widget) tuples.
        """
        mbond = defaults.NicBonding().retrieve()
        bond_status = ", ".join(mbond["slaves"]
                                or [])
        bond_lbl = _("Remove %s (%s)") % (mbond["name"], bond_status) \
            if bond_status else _("Create Bond")

        ws = [ui.Header("header[0]", _("System Identification")),
              ui.Entry("hostname", _("Hostname:")),
              ui.Divider("divider[0]"),
              ui.Entry("dns[0]", _("DNS Server 1:")),
              ui.Entry("dns[1]", _("DNS Server 2:")),
              ui.Divider("divider[1]"),
              ui.Entry("ntp[0]", _("NTP Server 1:")),
              ui.Entry("ntp[1]", _("NTP Server 2:")),
              ui.Divider("divider[2]"),
              NicTable("nics", height=3),

              ui.Row("row[0]",
                     [ui.Button("button.ping", _("Ping")),
                      ui.Button("button.toggle_bond", bond_lbl)
                      ])
              ]

        page = ui.Page("page", ws)
        # Save it "locally" as a dict, for better accessability
        self.widgets.add(page)

        #
        # NIC Deatils Dialog and Bond creation is disabled
        # when Node is managed
        #
        if has_managed_ifnames():
            self._nic_details_group.enabled(False)
            self.widgets["button.toggle_bond"].enabled(False)
            nictbl = self.widgets["nics"]
            nictbl.on_activate.clear()
            nictbl.label(nictbl.label() + " (read-only/managed)")

        return page
Example #18
0
    def __init__(self, path, title, description):
        title = "Custom Block Device"

        device_entry = ui.Entry("boot.device.custom", "Device path:")
        children = [ui.Label("label[0]", description),
                    ui.Divider("divider[0]"),
                    device_entry]
        super(CustomDeviceDialog, self).__init__(path, title, children)
        self.buttons = [ui.SaveButton("dialog.device.custom.save"),
                        ui.CloseButton("dialog.device.custom.close", "Cancel")]
Example #19
0
 def ui_content(self):
     ws = [
         ui.Header("header[0]", "Storage Volumes"),
         ui.Label(
             "label[0]", "Please enter the sizes for the " +
             "following partitions in MB"),
         ui.Divider("divider[0]"),
         ui.Entry("storage.efi_size", "UEFI/Bios:", enabled=False),
         ui.Divider("divider[1]"),
         ui.Entry("storage.root_size", "Root & RootBackup:", enabled=False),
         ui.Label("label[1]", "(2 partitions at 512MB each)"),
         ui.Divider("divider[2]"),
         ui.Entry("storage.swap_size", "Swap:"),
         ui.Entry("storage.config_size", "Config:"),
         ui.Entry("storage.logging_size", "Logging:"),
         ui.Entry("storage.data_size", "Data:"),
     ]
     self.widgets.add(ws)
     page = ui.Page("storage", ws)
     page.buttons = [
         ui.QuitButton("button.quit", "Quit"),
         ui.Button("button.back", "Back"),
         ui.SaveButton("button.next", "Next")
     ]
     return page
Example #20
0
    def __init__(self, path_prefix, title, description):
        title = _("Custom Block Device")

        device_entry = ui.Entry(path_prefix, _("Device path:"))
        children = [ui.Label("label[0]", description),
                    ui.Divider("divider[0]"),
                    device_entry]
        super(CustomDeviceDialog, self).__init__("%s.dialog" % path_prefix,
                                                 title, children)
        self.buttons = [ui.SaveButton("dialog.device.custom.save", _("Save"),
                                      enabled=False),
                        ui.CloseButton("dialog.device.custom.close",
                                       _("Cancel"))]
Example #21
0
    def ui_content(self):

        ws = [
            ui.Header("header[0]", "Logging"),
            ui.Entry("logrotate.max_size",
                     "Logrotate Max Log " + "Size (KB):"),
            ui.Divider("divider[0]")
        ]
        if not utils.network.is_configured():
            ws.extend([
                ui.Notice(
                    "network.notice", "Networking is not configured, " +
                    "please configure it before rsyslog and/or netconsole"),
                ui.Divider("notice.divider")
            ])
        ws.extend([
            ui.Label("rsyslog.header",
                     "RSyslog is an enhanced multi-" + "threaded syslogd"),
            ui.Entry("rsyslog.address",
                     "Server Address:",
                     enabled=utils.network.is_configured()),
            ui.Entry("rsyslog.port",
                     "Server Port:",
                     enabled=utils.network.is_configured()),
            ui.Divider("divider[1]"),
            ui.Label(
                "netconsole.label", "Netconsole service allows a remote sys" +
                "log daemon to record printk() messages"),
            ui.Entry("netconsole.address",
                     "Server Address:",
                     enabled=utils.network.is_configured()),
            ui.Entry("netconsole.port",
                     "Server Port:",
                     enabled=utils.network.is_configured())
        ])

        page = ui.Page("page", ws)
        self.widgets.add(page)
        return page
Example #22
0
    def ui_content(self):
        """Describes the UI this plugin requires
        This is an ordered list of (path, widget) tuples.
        """
        ws = [
            ui.Header("header[0]", "System Identification"),
            ui.Entry("hostname", "Hostname:"),
            ui.Divider("divider[0]"),
            ui.Entry("dns[0]", "DNS Server 1:"),
            ui.Entry("dns[1]", "DNS Server 2:"),
            ui.Divider("divider[1]"),
            ui.Entry("ntp[0]", "NTP Server 1:"),
            ui.Entry("ntp[1]", "NTP Server 2:"),
            ui.Divider("divider[2]"),
            ui.Table("nics", "Available System NICs",
                     "Device   Status         Model          MAC Address",
                     self._get_nics()),
            ui.Button("button.ping", "Ping")
        ]

        page = ui.Page("page", ws)
        # Save it "locally" as a dict, for better accessability
        self.widgets.add(page)
        return page
Example #23
0
    def ui_content(self):
        ws = [
            ui.Header("header[0]", "Remote Access"),
            ui.Checkbox("ssh.pwauth", "Enable SSH password authentication"),
            ui.Header("header[1]", "Strong Random Number Generator"),
            ui.Checkbox("strongrng.disable_aesni", "Disable AES-NI"),
            ui.Entry("strongrng.num_bytes", "Bytes Used:"),
            ui.Header("header[2]", "Local Access"),
            ui.PasswordEntry("passwd.admin.password", "Password:"******"passwd.admin.password_confirmation",
                             "Confirm Password:"******"page", ws)
        self.widgets.add(page)
        return page
Example #24
0
    def ui_content(self):
        if self.application.args.dry:
            net_is_configured = True
        else:
            net_is_configured = NodeNetwork().is_configured()

        if not net_is_configured:

            ws = ([
                ui.Divider("notice.divider"),
                ui.Notice(
                    "network.notice", "Networking is not configured, please " +
                    "configure it before configuring RHN"),
                ui.Divider("notice.divider")
            ])

        else:
            status, rhn_type = get_rhn_status()
            if status == 0:
                rhn_msg = ("RHN Registration is required only if you wish " +
                           "to use Red Hat Enterprise Linux with virtual " +
                           "guests subscriptions for your guests.")
            else:
                rhn_msg = "RHN Registration\n\nRegistration Status: %s" \
                          % rhn_type

            ws = [
                ui.Header("header[0]", rhn_msg),
                ui.Entry("rhn.user", "Login:"******"rhn.password", "Password:"******"rhn.profilename", "Profile Name (optional):"),
                ui.Divider("divider[0]"),
                ui.Options("rhn.type", "Type", self._rhn_types),
                ui.Entry("rhn.url", "URL:"),
                ui.Entry("rhn.ca", "CA URL:"),
                ui.Header("header[0]", "HTTP Proxy Configuration"),
                ui.Entry("rhn.proxyhost", "Server:"),
                ui.Entry("rhn.proxyport", "Port:"),
                ui.Entry("rhn.proxyuser", "Username:"******"rhn.proxypassword", "Password:"******"divider[1]"),
            ]

        page = ui.Page("page", ws)
        self.widgets.add(ws)
        return page
Example #25
0
    def ui_content(self):
        cfg = rhn_model.RHN().retrieve()
        if self.application.args.dry:
            net_is_configured = True
        else:
            net_is_configured = NodeNetwork().is_configured()

        if not net_is_configured:

            ws = ([
                ui.Divider("notice.divider"),
                ui.Notice(
                    "network.notice", "Networking is not configured, please " +
                    "configure it before configuring RHSM"),
                ui.Divider("notice.divider")
            ])

        else:
            rhn_msg = ("RHSM Registration is required only if you wish " +
                       "to use Red Hat Enterprise Linux with virtual " +
                       "guests subscriptions for your guests.")

            if cfg["rhntype"] and self._get_status(cfg) is not None:
                rhn_msg = self._get_status(cfg)

            ws = [
                ui.Header("header[0]", rhn_msg),
                ui.Entry("rhn.username", "Login:"******"rhn.password", "Password:"******"rhn.profilename", "Profile Name (optional):"),
                ui.Divider("divider[0]"),
                ui.Options("rhn.type", "Type", self._rhn_types),
                ui.Entry("rhn.url", "URL:"),
                ui.Entry("rhn.ca", "CA URL:"),
                ui.Entry("rhn.org", "Organization:"),
                ui.Entry("rhn.environment", "Environment:"),
                ui.Entry("rhn.activation_key", "Activation Key:"),
                ui.Button("button.proxy", "HTTP Proxy Configuration"),
            ]

        page = ui.Page("page", ws)
        self.widgets.add(ws)
        return page
Example #26
0
    def __init__(self, path_prefix, title, description, plugin):
        def clear_invalid(dialog, changes):
            plugin.stash_change(path_prefix)

        title = _("Custom Block Device")

        device_entry = ui.Entry(path_prefix, _("Device path:"))
        children = [ui.Label("label[0]", description),
                    ui.Divider("divider[0]"),
                    device_entry]
        super(CustomDeviceDialog, self).__init__("%s.dialog" % path_prefix,
                                                 title, children)
        self.buttons = [ui.SaveButton("dialog.device.custom.save", _("Save"),
                                      enabled=False),
                        ui.CloseButton("dialog.device.custom.close",
                                       _("Cancel"))]

        b = plugins.UIElements(self.buttons)
        b["dialog.device.custom.close"].on_activate.clear()
        b["dialog.device.custom.close"].on_activate.connect(ui.CloseAction())
        b["dialog.device.custom.close"].on_activate.connect(clear_invalid)
    def ui_content(self):
        ws = [ui.Header("header[0]", _("Storage Volumes")),
              ui.KeywordLabel("storage.drive_size", "Drive size: ")]

        if not self.__enough_free_space():
            ws.extend([ui.Notice("space.notice",
                                 "Not enough space! Needs at least "
                                 "%sMB for installation, %sMB "
                                 "available" % (str(self._min_drive_size),
                                                self._drive_size))])

        if not self._fill:
            ws.extend([ui.KeywordLabel("storage.free_space",
                                       "Remaining Space: ")])

        ws.extend([ui.Label("label[0]", "Please enter the sizes for the " +
                            "following partitions in MB"),
                   ui.Checkbox("storage.fill_data", "Fill disk with Data " +
                               "partition", True),
                   ui.Entry("storage.efi_size", _("UEFI/Bios:"),
                            enabled=False),
                   ui.Entry("storage.root_size", _("Root & RootBackup:"),
                            enabled=False),
                   ui.Label("label[1]", _("(2 partitions at %sMB each)") %
                            self.model().get("storage.root_size")),
                   ui.Divider("divider[2]"),
                   ui.Entry("storage.swap_size", _("Swap MB:")),
                   ui.Entry("storage.config_size", _("Config MB:")),
                   ui.Entry("storage.logging_size", _("Logging MB:")),
                   ui.Entry("storage.data_size", _("Data MB:"),
                            enabled=not self._fill),
                   ])

        if not self._fill:
            ws.extend([ui.Label("label[2]", "(-1 fills all free space)")])

        self.widgets.add(ws)
        page = ui.Page("storage", ws)
        page.buttons = [ui.QuitButton("button.quit", _("Quit")),
                        ui.Button("button.back", _("Back"))]

        if self.__enough_free_space():
            can_continue = self.model() and self.__calculate_free_space() >= 0
            page.buttons.extend([ui.SaveButton("button.next",
                                               _("Continue"),
                                               enabled=can_continue)])

        return page
    def __init__(self, title, plugin):
        self.keys = ["hosted_engine.diskpath", "hosted_engine.pxe"]

        def clear_invalid(dialog, changes):
            [plugin.stash_change(prefix) for prefix in self.keys]

        entries = [ui.Entry("hosted_engine.diskpath",
                            "Engine ISO/OVA URL for download:"),
                   ui.Checkbox("hosted_engine.pxe", "PXE Boot Engine VM"),
                   ui.Divider("divider[1]"),
                   ui.SaveButton("deploy.additional",
                                 "Add this host to an existing group")]
        children = [ui.Label("label[0]", "Please provide details for "
                             "deployment of hosted engine"),
                    ui.Divider("divider[0]")]
        children.extend(entries)
        super(DeployDialog, self).__init__("deploy.dialog", title, children)
        self.buttons = [ui.SaveButton("deploy.confirm", "Deploy"),
                        ui.CloseButton("deploy.close", "Cancel")]

        b = plugins.UIElements(self.buttons)
        b["deploy.close"].on_activate.clear()
        b["deploy.close"].on_activate.connect(ui.CloseAction())
        b["deploy.close"].on_activate.connect(clear_invalid)
    def ui_content(self):
        ws = [
            ui.Header("header[0]", _("Storage Volumes")),
            ui.KeywordLabel("storage.drive_size", "Drive size: ")
        ]

        if not self._fill:
            ws.extend(
                [ui.KeywordLabel("storage.free_space", "Remaining Space: ")])

        ws.extend([
            ui.Label(
                "label[0]", "Please enter the sizes for the " +
                "following partitions in MB"),
            ui.Checkbox("storage.fill_data",
                        "Fill disk with Data " + "partition", True),
            ui.Entry("storage.efi_size", _("UEFI/Bios:"), enabled=False),
            ui.Entry("storage.root_size",
                     _("Root & RootBackup:"),
                     enabled=False),
            ui.Label(
                "label[1]",
                _("(2 partitions at %sMB each)") %
                self.model().get("storage.efi_size")),
            ui.Divider("divider[2]"),
            ui.Entry("storage.swap_size", _("Swap:")),
            ui.Entry("storage.config_size", _("Config:")),
            ui.Entry("storage.logging_size", _("Logging:")),
            ui.Entry("storage.data_size", _("Data:"), enabled=not self._fill),
        ])

        if not self._fill:
            ws.extend([ui.Label("label[2]", "(-1 fills all free space)")])

        self.widgets.add(ws)
        page = ui.Page("storage", ws)
        page.buttons = [
            ui.QuitButton("button.quit", _("Quit")),
            ui.Button("button.back", _("Back")),
            ui.SaveButton("button.next", _("Continue"))
        ]
        return page
Example #30
0
    def __init__(self, plugin, ifname):
        super(NicDetailsDialog, self).__init__("dialog.nic",
                                               "NIC Details: %s" % ifname, [])
        self.plugin = plugin

        # Populate model with nic specific informations
        self.logger.debug("Building NIC details dialog for %s" % ifname)

        nic = utils.network.NodeNetwork().nics()[ifname]

        model = defaults.Network().retrieve()
        ip6model = defaults.IPv6().retrieve()
        m_layout = defaults.NetworkLayout().retrieve()

        self.logger.debug("nic: %s" % nic)
        self.logger.debug("model: %s" % model)
        self.logger.debug("ip6model: %s" % ip6model)

        is_primary_interface = model["iface"] == ifname

        if not is_primary_interface:
            # The config contains the information for the primary ifnamee,
            # because this ifnamee is not the primaryifnameme we clear the
            # config
            model = dict((k, "") for k in model.keys())

        ipaddr, netmask, gateway, vlanid = (model["ipaddr"], model["netmask"],
                                            model["gateway"], model["vlanid"])

        ip6addr, ip6netmask, ip6gateway, ip6bootproto = (ip6model["ipaddr"],
                                                         ip6model["netmask"],
                                                         ip6model["gateway"],
                                                         ip6model["bootproto"])

        bootproto = model["bootproto"]
        if model["bootproto"] == "dhcp":
            if nic.exists():
                routes = utils.network.Routes()
                gateway = routes.default()
                ipaddr, netmask = nic.ipv4_address().items()
                vlanid = ",".join(nic.vlanids())
        else:
            if ipaddr:
                bootproto = "static"

        link_status_txt = ("Connected" if nic.has_link() else "Disconnected")
        vendor_txt = nic.vendor[:24] if nic.vendor else ""

        self.plugin._model_extra.update({
            "dialog.nic.driver":
            nic.driver,
            "dialog.nic.vendor":
            vendor_txt,
            "dialog.nic.link_status":
            link_status_txt,
            "dialog.nic.hwaddress":
            nic.hwaddr,
            "dialog.nic.ipv4.bootproto":
            bootproto,
            "dialog.nic.ipv4.address":
            ipaddr,
            "dialog.nic.ipv4.netmask":
            netmask,
            "dialog.nic.ipv4.gateway":
            gateway,
            "dialog.nic.ipv6.bootproto":
            ip6bootproto,
            "dialog.nic.ipv6.address":
            ip6addr,
            "dialog.nic.ipv6.netmask":
            ip6netmask,
            "dialog.nic.ipv6.gateway":
            ip6gateway,
            "dialog.nic.vlanid":
            vlanid,
            "dialog.nic.layout_bridged":
            m_layout["layout"] == "bridged",
        })

        self.logger.debug("model: %s" % self.plugin.model())

        padd = lambda l: l.ljust(12)
        ws = [
            ui.Row("dialog.nic._row[0]", [
                ui.KeywordLabel("dialog.nic.driver", padd("Driver: ")),
                ui.KeywordLabel("dialog.nic.vendor", padd("Vendor: ")),
            ]),
            ui.Row("dialog.nic._row[2]", [
                ui.KeywordLabel("dialog.nic.link_status",
                                padd("Link Status: ")),
                ui.KeywordLabel("dialog.nic.hwaddress", padd("MAC Address: ")),
            ]),
            ui.Divider("dialog.nic._divider[0]"),
            ui.Label("dialog.nic.ipv4._header", "IPv4 Settings"),
            ui.Options("dialog.nic.ipv4.bootproto", "Bootprotocol: ",
                       [("none", "Disabled"), ("dhcp", "DHCP"),
                        ("static", "Static")]),
            ui.Row("dialog.nic._row[4]", [
                ui.Entry("dialog.nic.ipv4.address", padd("IP Address: ")),
                ui.Entry("dialog.nic.ipv4.netmask", padd("  Netmask: "))
            ]),
            ui.Row("dialog.nic._row[5]", [
                ui.Entry("dialog.nic.ipv4.gateway", padd("Gateway: ")),
                ui.Label("dummy[0]", "")
            ]),
            ui.Divider("dialog.nic._divider[1]"),
            ui.Label("dialog.nic.ipv6._header", "IPv6 Settings"),
            ui.Options("dialog.nic.ipv6.bootproto", "Bootprotocol: ",
                       [("none", "Disabled"), ("auto", "Auto"),
                        ("dhcp", "DHCP"), ("static", "Static")]),
            ui.Row("dialog.nic._row[6]", [
                ui.Entry("dialog.nic.ipv6.address", padd("IP Address: ")),
                ui.Entry("dialog.nic.ipv6.netmask", padd("  Prefix Length: "))
            ]),
            ui.Row("dialog.nic._row[7]", [
                ui.Entry("dialog.nic.ipv6.gateway", padd("Gateway: ")),
                ui.Label("dummy[1]", "")
            ]),
            ui.Divider("dialog.nic._divider[2]"),
            ui.Row("dialog.nic._row[8]", [
                ui.Entry("dialog.nic.vlanid", padd("VLAN ID: ")),
                ui.Label("dummy[2]", "")
            ]),
            ui.Divider("dialog.nic._divider[3]"),
            ui.Checkbox("dialog.nic.layout_bridged", "Use Bridge: "),
            ui.Divider("dialog.nic._divider[4]"),
            ui.Button("dialog.nic.identify", "Flash Lights to Identify"),
        ]

        self.plugin.widgets.add(ws)
        self.children = ws
        self.buttons = [
            ui.SaveButton("dialog.nic.save", "Save"),
            ui.CloseButton("dialog.nic.close", "Close")
        ]
        self.plugin._nic_details_group.enabled(False)
        self.plugin.widgets["dialog.nic.vlanid"].enabled(True)
        self.plugin.widgets["dialog.nic.layout_bridged"].enabled(True)