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
    def __init__(self, plugin, iface, app_mode, config_nfs, db_type, firewall,
                 dc_type):
        super(AdvanceOptionsDialog, self).__init__("dialog.options", iface, [])
        self.plugin = plugin

        #padd = lambda l: l.ljust(14)
        ws = [
            ui.Options("engine_cfg.model", "App modes:", self._model),
            ui.Options("engine_cfg.storage", "Storage:", self._storage),
            ui.Options("engine_cfg.isoASK", "NFS ISO Domain:",
                       self._iso_domain),
            ui.Options("engine_cfg.dbTYPE", "DB type:", self._db_type),
            ui.Options("engine_cfg.firewall", "Firewall:", self._firewall),
        ]
        self.plugin._model_extra.update({
            "engine_cfg.firewall": firewall,
            "engine_cfg.model": app_mode or 'both',
            "engine_cfg.storage": dc_type or 'nfs',
            "engine_cfg.isoASK": config_nfs or False,
            "engine_cfg.dbTYPE": db_type,
        })
        self.plugin.widgets.add(ws)
        self.children = ws
        self.buttons = [
            ui.SaveButton("dialog.options.save", "Aplly"),
            ui.CloseButton("dialog.options.close", "Cancel"),
        ]
Beispiel #3
0
    def ui_content(self):
        page_title = "Please select the disk to use for booting %s" % \
                     self.application.product.PRODUCT_SHORT

        other_device = self._model.get("boot.device.custom", "")
        devices = self.storage_discovery.all_devices_for_ui_table(other_device)

        ws = [ui.Header("header[0]", page_title)]

        if devices:
            ws += [
                ui.Table(
                    "boot.device", "",
                    " %6s  %11s  %5s" % ("Location", "Device Name", "Size"),
                    devices),
                DeviceDetails("label.details", self, "(No device)")
            ]
        else:
            ws += [
                ui.Label("boot.no_device", "No Valid Boot Devices Detected")
            ]

        page = ui.Page("boot", ws)
        page.buttons = [
            ui.QuitButton("button.quit", "Quit"),
            ui.Button("button.back", "Back"),
            ui.SaveButton("button.next", "Continue")
        ]

        self.widgets.add(page)
        return page
Beispiel #4
0
 def ui_content(self):
     ws = [
         ui.Header("header[0]",
                   "Require a password for local console access?"),
         ui.Label(
             "label[0]", "Please enter the current admin " +
             "password. You may also change the admin password " +
             "if required. If the new password fields are left" +
             "blank the password will remain the same."),
         ui.Label("label[1]", "Password for local console access"),
         ui.Divider("divider[0]"),
         ui.PasswordEntry("upgrade.current_password", "Current Password:"******"divider[1]"),
         ui.PasswordEntry("upgrade.password", "Password:"******"upgrade.password_confirmation",
                          "Confirm Password:"******"divider[2]"),
         ui.Label("current_password.info", ""),
         ui.Label("password.info", self.__no_new_password_msg)
     ]
     self.widgets.add(ws)
     page = ui.Page("password", ws)
     page.buttons = [
         ui.QuitButton("button.quit", "Quit"),
         ui.Button("button.back", "Back"),
         ui.SaveButton("button.next", "Update")
     ]
     return page
 def ui_content(self):
     ws = [
         ui.Header("header[0]",
                   _("Require a password for the admin user?")),
         ui.Label(
             "label[0]",
             _("Please enter the current admin ") +
             _("password. You may also change the admin password ") +
             _("if required. If the new password fields are left ") +
             _("blank the password will remain the same.")),
         ui.Label("label[1]", _("Password for the admin user")),
         ui.Divider("divider[0]"),
         ui.PasswordEntry("upgrade.current_password",
                          _("Current Password:"******"divider[1]"),
         ui.ConfirmedEntry("upgrade.password",
                           _("Password:"******"current_password.info", ""),
         ui.Label("password.info", self.__no_new_password_msg)
     ]
     page = ui.Page("password", ws)
     page.buttons = [
         ui.QuitButton("button.quit", "Quit"),
         ui.Button("button.back", "Back"),
         ui.SaveButton("button.next", "Update")
     ]
     self.widgets.add(page)
     return page
Beispiel #6
0
    def ui_content(self):
        page_title = _("Please select the disk to use for booting %s") % \
            self.application.product.PRODUCT_SHORT

        other_device = self._model.get("boot.device.custom", "")
        devices = self.storage_discovery.all_devices_for_ui_table()

        ws = [ui.Header("header[0]", page_title)]

        tbl_head = self.storage_discovery.tbl_tpl.format(bus=_("Location"),
                                                         name=_("Device Name"),
                                                         size=_("Size (GB)"))
        if devices:
            ws += [ui.Table("boot.device", "", tbl_head, devices),
                   ui.Divider("divider[0]"),
                   ui.Button("button.other_device", "Other device: %s" %
                             other_device),
                   DeviceDetails("label.details", self, _("(No device)"))
                   ]
        else:
            ws += [ui.Label("boot.no_device",
                            _("No Valid Boot Devices Detected"))]

        page = ui.Page("boot", ws)
        page.buttons = [ui.QuitButton("button.quit", _("Quit")),
                        ui.Button("button.back", _("Back")),
                        ui.SaveButton("button.next", _("Continue"))]

        self.widgets.add(page)
        return page
Beispiel #7
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
Beispiel #8
0
    def ui_content(self):
        all_plugins = self.__list_of_plugins()
        if all_plugins:
            selected_plugin = all_plugins[0][0]
            ws = [ui.Header("header[0]", _("Plugins")),

                  ui.Table("plugins.installed", "", _("Installed Plugins:"),
                           all_plugins, selected_plugin),

                  ui.Divider("divider[0]"),

                  ui.Row("row[0]", [ui.Label("label[0]", _("Name:")),
                                    ui.Label("plugin.name", "")]),

                  ui.Row("row[1]", [ui.Label("label[0]", _("Version:")),
                                    ui.Label("plugin.version", "")]),

                  ui.Row("row[2]", [ui.Label("label[0]", _("Date installed:")),
                                    ui.Label("plugin.createdat", "")]),

                  ui.Divider("divider[1]"),

                  ui.Row("row[3]", [ui.SaveButton("button.drpm",
                                                  _("RPM Diff")),
                                    ui.SaveButton("button.dsrpm",
                                                  _("SRPM Diff")),
                                    ui.SaveButton("button.dfile",
                                                  _("File Diff"))])
                  ]

            plugin_selected_name = {"plugins.installed": selected_plugin}
        else:
            ws = [ui.Header("header[0]", _("Plugins")),
                  ui.Label("label[0]",
                           _("There are no plugins currently installed"))]

        page = ui.Page("page", ws)
        page.buttons = []
        self.widgets.add(page)

        # show immediately data about the plugin selected
        if all_plugins:
            self.on_change(plugin_selected_name)

        return page
Beispiel #9
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")]
Beispiel #10
0
    def ui_content(self):
        all_plugins = self.__list_of_plugins()
        if all_plugins:
            selected_plugin = all_plugins[0][0]
            ws = [
                ui.Header("header[0]", "Installed Plugins"),
                ui.Table("plugins.installed", "", "Installed plugins:",
                         all_plugins, selected_plugin),
                ui.Divider("divider[0]"),
                ui.Row("row[0]", [
                    ui.Label("label[0]", "Name:"),
                    ui.Label("plugin.name", "")
                ]),
                ui.Row("row[1]", [
                    ui.Label("label[0]", "Version:"),
                    ui.Label("plugin.version", "")
                ]),
                ui.Row("row[2]", [
                    ui.Label("label[0]", "Date installed:"),
                    ui.Label("plugin.createdat", "")
                ]),
                ui.Divider("divider[1]"),
                ui.Row("row[3]", [
                    ui.SaveButton("button.drpm", "RPM Diff"),
                    ui.SaveButton("button.dsrpm", "SRPM Diff"),
                    ui.SaveButton("button.dfile", "File Diff")
                ])
            ]
        else:
            ws = [
                ui.Header("header[0]", "Plugins"),
                ui.Label("label[0]",
                         "There are no plugins currently " + "installed")
            ]

        page = ui.Page("page", ws)
        page.buttons = []
        self.widgets.add(page)
        return page
Beispiel #11
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"))]
Beispiel #12
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):
        page_title = \
            _("Please select the disk(s) to use for installation of %s") \
            % self.application.product.PRODUCT_SHORT

        other_device = self._model.get("installation.device.custom", "")
        devices = self.storage_discovery.all_devices_for_ui_table()

        ws = [ui.Header("header[0]", page_title)]

        tbl_head = self.storage_discovery.tbl_tpl.format(bus="Location",
                                                         name="Device Name",
                                                         size="Size (GB)")
        if devices:
            ws += [
                ui.Table("installation.device.current",
                         "",
                         tbl_head,
                         devices,
                         height=3,
                         multi=True),
                ui.Button("button.other_device",
                          "Other Device: %s" % other_device),
                ui.Divider("divider[0]"),
                DeviceDetails("installation.device.details", self,
                              _("(No device)"))
            ]
        else:
            ws += [
                ui.Label("installation.no_device",
                         _("No Valid Install Devices Detected"))
            ]

        page = ui.Page("installation", ws)
        page.buttons = [
            ui.QuitButton("button.quit", _("Quit")),
            ui.Button("button.back", _("Back")),
            ui.SaveButton("button.next", _("Continue"))
        ]

        self.widgets.add(page)

        # We are directly connecting to the table's on_change event
        # The tables on_change event is fired (in the multi-case)
        # when the highlighted entry is changed.
        table = self.widgets["installation.device.current"]
        table.on_change.connect(self.__update_details)

        return page
Beispiel #14
0
 def ui_content(self):
     kbd = system.Keyboard()
     c = kbd.get_current()
     self.logger.debug("Current layout: %s" % c)
     ws = [ui.Header("header[0]", "Keyboard Layout Selection"),
           ui.Table("keyboard.layout", "", "Available Keyboard Layouts",
                    kbd.available_layouts(), c),
           ui.Label("label[0]", "(Hit Enter to select a layout)")
           ]
     self.widgets.add(ws)
     page = ui.Page("keyboard", ws)
     page.buttons = [ui.QuitButton("button.quit", "Quit"),
                     ui.Button("button.back", "Back"),
                     ui.SaveButton("button.next", "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.__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
Beispiel #17
0
 def ui_content(self):
     ws = [ui.Header("header[0]",
                     "Require a password for the admin user?"),
           ui.Divider("divider[0]"),
           ui.PasswordEntry("admin.password", "Password:"******"admin.password_confirmation",
                            "Confirm Password:"******"divider[1]"),
           ui.Label("password.info", "")
           ]
     self.widgets.add(ws)
     page = ui.Page("password", ws)
     page.buttons = [ui.QuitButton("button.quit", "Quit"),
                     ui.Button("button.back", "Back"),
                     ui.SaveButton("button.next", "Install")]
     return page
Beispiel #18
0
 def ui_content(self):
     ws = [
         ui.Header("header[0]",
                   "Require a password for local console access?"),
         ui.Divider("divider[0]"),
         ui.PasswordEntry("root.password", "Password:"******"root.password_confirmation",
                          "Confirm Password:"******"password", ws)
     page.buttons = [
         ui.QuitButton("button.quit", "Quit"),
         ui.Button("button.back", "Back"),
         ui.SaveButton("button.next", "Install")
     ]
     return page
Beispiel #19
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
Beispiel #20
0
    def ui_content(self):
        profiles = [(profile, profile)
                    for profile in tuned.get_available_profiles()]

        ws = [
            ui.Header("header", "tuned Configuration"),
            ui.Label(
                "label", "Choose the tuned profile you would " +
                "like to apply to this system."),
            ui.Divider("divider[0]"),
            ui.KeywordLabel("tuned.profile", "Current Active Profile:  "),
            ui.Table("tuned.profile", "", "Available tuned Profiles",
                     profiles),
        ]
        page = ui.Page("page", ws)
        page.buttons = [ui.SaveButton("page.save")]
        self.widgets.add(page)
        return page
    def ui_content(self):
        """Describes the UI this plugin requires
        This is an ordered list of (path, widget) tuples.
        """
        kbd = utils.system.Keyboard()
        ws = [ui.Header("header", _("Keyboard Layout Selection")),
              ui.Label("label", _("Choose the Keyboard Layout you would ") +
                       _("like to apply to this system.")),
              ui.Divider("divider[0]"),
              ui.KeywordLabel("keyboard.layout_name", _("Current Active ") +
                              _("Keyboard Layout:  ")),
              ui.Table("keyboard.layout", "", _("Available Keyboard Layouts"),
                       kbd.available_layouts(), kbd.get_current()),
              ]

        page = ui.Page("page", ws)
        page.buttons = [ui.SaveButton("page.save", _("Save"))]
        self.widgets.add(page)
        return page
    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
    def ui_content(self):
        ws = [
            ui.Header("header[0]", _("Enter a password for the admin user")),
            ui.Divider("divider[0]"),
            ui.ConfirmedEntry("admin.password",
                              _("Password:"******"password", ws)
        page.buttons = [
            ui.QuitButton("button.quit", _("Quit")),
            ui.Button("button.back", _("Back")),
            ui.SaveButton("button.next", _("Install"), enabled=False)
        ]

        self.widgets.add(page)

        return page
Beispiel #24
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 __init__(self, title, plugin):
        self.keys = ["maintenance.level"]
        self.plugin = plugin

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

        entries = [ui.Options("maintenance.level", "Maintenance Level",
                              self.states, selected=self.__vm_status())]
        children = [ui.Divider("divider.options"),
                    ui.Label("label[0]", "Please select the maintenance "
                             "level"),
                    ui.Divider("divider[0]")]
        children.extend(entries)
        super(MaintenanceDialog, self).__init__(
            "maintenance.dialog", title, children)
        self.buttons = [ui.SaveButton("maintenance.confirm", "Set"),
                        ui.CloseButton("maintenance.close", "Cancel")]

        b = plugins.UIElements(self.buttons)
        b["maintenance.close"].on_activate.clear()
        b["maintenance.close"].on_activate.connect(ui.CloseAction())
        b["maintenance.close"].on_activate.connect(clear_invalid)
Beispiel #26
0
    def ui_content(self):
        align = lambda l: l.ljust(16)
        if not self._model:
            self._build_model()

        ws = [
            ui.Header("header[0]", _("Confirm disk selections")),
            ui.Notice("notice[0]",
                      _("The data on these disks will "
                        "be erased!")),
            ui.KeywordLabel("boot.header", _("Boot device")),
            DiskDetails("boot.device.current", self,
                        self._model["boot.device.current"])
        ]

        if self._storage_tagged(self._model["boot.device.current"]):
            ws.extend([
                ui.Notice("boot.notice",
                          _("Boot device may be part "
                            "of a storage domain!"))
            ])

        ws.extend([ui.KeywordLabel("install.header", "Install devices")])

        for i in range(len(self._model["installation.devices"])):
            ws.extend([
                DiskDetails("installation.device[%s]" % i, self,
                            self._model["installation.devices"][i])
            ])
            if self._storage_tagged(self._model["installation.devices"][i]):
                ws.extend([
                    ui.Notice(
                        "installation.notice[%s]" % i,
                        _("This device may be part of a storage "
                          "domain!"))
                ])

        ws.extend([
            ui.Divider("divider[0]"),
            ui.KeywordLabel("storage.volumes", _("Volume sizes"))
        ])

        intuples = lambda lst, n: [lst[x:x + n] for x in range(0, len(lst), n)]
        for xs in intuples(
                sorted(k for k in self._model.keys()
                       if k.startswith("storage.")), 2):
            chi = []
            for x in xs:
                chi.append(
                    ui.KeywordLabel(
                        x,
                        _(
                            align(
                                x.replace("_", " ").replace(
                                    "storage.", "").title() + ":"))))
            row = ui.Row("row[%s]" % xs, chi)
            ws.append(row)

        if int(self._model["storage.data_size"]) < (50 * 1024):
            ws.extend([
                ui.Divider("divider.he"),
                ui.Notice(
                    "notice.he", "The size of the data volume is "
                    "not large enough to use the Engine "
                    "Appliance, must be at least 50GB (51200MB)")
            ])

        page = ui.Page("confirmation", ws)
        page.buttons = [
            ui.QuitButton("button.quit", _("Quit")),
            ui.Button("button.back", _("Back")),
            ui.SaveButton("button.next", _("Confirm"))
        ]

        self.widgets.add(page)
        return page
Beispiel #27
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()

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

        is_primary_interface = model["iface"] == ifname

        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,
        })

        if isinstance(nic, network.BondedNIC):
            self.plugin._model_extra.update({
                "dialog.nic.bond_mode":
                nic.mode,
                "dialog.nic.bond_slaves":
                " ".join(nic.slaves)
            })

        bootproto = model["bootproto"]
        ipaddr = model["ipaddr"]
        netmask = model["netmask"]
        gateway = model["gateway"]
        vlanid = model["vlanid"]

        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"

        nicfields = {
            "dialog.nic.ipv4.bootproto": bootproto,
            "dialog.nic.ipv4.address": ipaddr,
            "dialog.nic.ipv4.netmask": netmask,
            "dialog.nic.ipv4.gateway": gateway,
            "dialog.nic.ipv6.bootproto": ip6model["bootproto"],
            "dialog.nic.ipv6.address": ip6model["ipaddr"],
            "dialog.nic.ipv6.netmask": ip6model["netmask"],
            "dialog.nic.ipv6.gateway": ip6model["gateway"],
            "dialog.nic.vlanid": vlanid,
        }
        self.plugin._model_extra.update(nicfields)

        if not is_primary_interface:
            # Unset all NIC fields. Because their values are only relevant
            # for the primary interface
            self.plugin._model_extra.update(dict.fromkeys(nicfields.keys()))

        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: ")),
            ])
        ]

        if isinstance(nic, network.BondedNIC):
            ws += [
                ui.Row("dialog.nic._row[3]", [
                    ui.KeywordLabel("dialog.nic.bond_mode", _("Bond Mode: ")),
                    ui.KeywordLabel("dialog.nic.bond_slaves",
                                    _("Bond Slaves: "))
                ])
            ]

        ws += [
            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.Divider("dialog.nic._divider[4]"),
            ui.Button("dialog.nic.identify", _("Flash Lights to Identify"))
        ]

        self.plugin.widgets.add(ws)
        self.children = ws
        self.plugin._nic_details_group.enabled(False)
        if isinstance(nic, network.BridgedNIC):
            self.buttons = [ui.CloseButton("dialog.nic.close", _("Close"))]
        else:
            self.plugin.widgets["dialog.nic.vlanid"].enabled(True)
            self.buttons = [
                ui.SaveButton("dialog.nic.save", _("Save")),
                ui.CloseButton("dialog.nic.close", _("Close"))
            ]
Beispiel #28
0
    def __init__(self, plugin, iface):
        super(NicDetailsDialog, self).__init__("dialog.nic",
                                               "NIC Details: %s" % iface, [])
        self.plugin = plugin

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

        self.logger.debug("Getting informations for NIC details page")
        live = utils.network.node_nics()[iface]
        cfg = defaults.Network().retrieve()

        self.logger.debug("live: %s" % live)
        self.logger.debug("cfg: %s" % cfg)

        # The primary interface of this Node:
        node_bridge_slave = config.network.node_bridge_slave()

        if node_bridge_slave != iface:
            # The config contains the information for the primary iface,
            # because this iface is not the primary iface we clear the config
            cfg = {k: "" for k in cfg.keys()}

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

        bridge_nic = utils.network.NIC(live["bridge"])
        if cfg["bootproto"] == "dhcp":
            if bridge_nic.exists():
                routes = utils.network.Routes()
                ipaddr, netmask = bridge_nic.ipv4_address().items()
                gateway = routes.default()
                vlanid = bridge_nic.vlanid()
            else:
                self.logger.warning("Bridge assigned but couldn't gather " +
                                    "live info: %s" % bridge_nic)

        self.plugin._model_extra.update({
            "dialog.nic.iface":
            live["name"],
            "dialog.nic.driver":
            live["driver"],
            "dialog.nic.protocol":
            live["bootproto"] or "N/A",
            "dialog.nic.vendor":
            live["vendor"],
            "dialog.nic.link_status":
            "Connected" if live["link_detected"] else "Disconnected",
            "dialog.nic.hwaddress":
            live["hwaddr"],
            "dialog.nic.ipv4.bootproto":
            cfg["bootproto"],
            "dialog.nic.ipv4.address":
            ipaddr,
            "dialog.nic.ipv4.netmask":
            netmask,
            "dialog.nic.ipv4.gateway":
            gateway,
            "dialog.nic.vlanid":
            vlanid,
        })

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

        padd = lambda l: l.ljust(14)
        ws = [
            ui.Row("dialog.nic._row[0]", [
                ui.KeywordLabel("dialog.nic.iface", padd("Interface: ")),
                ui.KeywordLabel("dialog.nic.driver", padd("Driver: ")),
            ]),
            ui.Row("dialog.nic._row[1]", [
                ui.KeywordLabel("dialog.nic.protocol", padd("Protocol: ")),
                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.Header("dialog.nic.ipv4._header", "IPv4 Settings"),
            ui.Options("dialog.nic.ipv4.bootproto", "Bootprotocol: ",
                       [("none", "Disabled"), ("dhcp", "DHCP"),
                        ("static", "Static")]),
            ui.Entry("dialog.nic.ipv4.address", padd("IP Address: ")),
            ui.Entry("dialog.nic.ipv4.netmask", padd("Netmask: ")),
            ui.Entry("dialog.nic.ipv4.gateway", padd("Gateway: ")),
            ui.Divider("dialog.nic._divider[1]"),
            ui.Entry("dialog.nic.vlanid", padd("VLAN ID: ")),
        ]
        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)
Beispiel #29
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)