[node-patches] Change in ovirt-node[master]: presets: Add presets module
fabiand at redhat.com
fabiand at redhat.com
Fri Jul 18 10:37:48 UTC 2014
Fabian Deutsch has uploaded a new change for review.
Change subject: presets: Add presets module
......................................................................
presets: Add presets module
Previously some branding specific values resided everywhere in the
codebase. The presets module shall help to ease the branding of several
user visible parts.
Change-Id: I1af33147179ac3bbce938ae618b7067d97013c72
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=922915
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M ovirt-node.spec.in
M src/Makefile.am
M src/ovirt/node/installer/core/storage_vol_page.py
A src/ovirt/node/presets.py
M src/ovirt/node/ui/urwid_builder.py
M src/ovirtnode/storage.py
6 files changed, 59 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/73/30273/1
diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in
index f51be72..04039c3 100644
--- a/ovirt-node.spec.in
+++ b/ovirt-node.spec.in
@@ -98,6 +98,7 @@
Requires: system-release
Requires: %{name}-selinux = %{version}-%{release}
+Requires: %{name}-branding-ovirt = %{version}-%{release}
#libvirt dependencies
Requires: libvirt-python
@@ -422,6 +423,18 @@
%endif
+#
+# oVirt Brand subpackage
+#
+%package branding-ovirt
+Summary: oVirt branding for oVirt Node
+Group: Applications/System
+
+%description branding-ovirt
+This package contains the files to let Node appear in the oVirt look.
+
+
+
%prep
%setup -q -n "%{name}-%{package_version}"
@@ -726,6 +739,10 @@
%endif
+%files branding-ovirt
+%{python_sitelib}/ovirt/node/presets.py*
+
+
%files
%defattr(-,root,root)
%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/default/ovirt
@@ -808,6 +825,7 @@
%{python_sitelib}/ovirt/node/tools/*.py*
%{python_sitelib}/ovirt/node/tools/*.xsl
%{python_sitelib}/ovirt/node/config/*.py*
+%exclude %{python_sitelib}/ovirt/node/presets.py*
%{python_sitelib}/ovirt/node/setup/*.py*
%{python_sitelib}/ovirt/node/setup/core/*.py*
%{python_sitelib}/ovirt/node/installer/*.py*
diff --git a/src/Makefile.am b/src/Makefile.am
index 6db1207..785b167 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -86,7 +86,8 @@
ovirt/node/app.py \
ovirt/node/base.py \
ovirt/node/loader.py \
- ovirt/node/log.py
+ ovirt/node/log.py \
+ ovirt/node/presets.py
dist_ovirt_node_locale_cn_DATA = \
ovirt/node/locale/zh_CN/LC_MESSAGES/ovirt_node.mo
diff --git a/src/ovirt/node/installer/core/storage_vol_page.py b/src/ovirt/node/installer/core/storage_vol_page.py
index 3b4bf7f..3e59bda 100644
--- a/src/ovirt/node/installer/core/storage_vol_page.py
+++ b/src/ovirt/node/installer/core/storage_vol_page.py
@@ -25,6 +25,7 @@
from ovirt.node import plugins, ui, valid
from ovirt.node.utils import process
from ovirt.node.exceptions import InvalidData
+from ovirt.node.config import presets
class Plugin(plugins.NodePlugin):
@@ -161,8 +162,8 @@
cmd = "blockdev --getsize64 /dev/[sv]da"
stdout = process.check_output(cmd, shell=True)
self._drive_size = int(stdout) / 1024 / 1024
- return {"storage.efi_size": "256",
- "storage.root_size": "50",
+ return {"storage.efi_size": presets.BOOT_SIZE,
+ "storage.root_size": presets.ROOT_SIZE,
"storage.swap_size": "0",
"storage.config_size": "5",
"storage.logging_size": "2048",
diff --git a/src/ovirt/node/presets.py b/src/ovirt/node/presets.py
new file mode 100644
index 0000000..60558f1
--- /dev/null
+++ b/src/ovirt/node/presets.py
@@ -0,0 +1,29 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# presets.py - Copyright (C) 2014 Red Hat, Inc.
+# Written by Fabian Deutsch <fabiand at redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA. A copy of the GNU General Public License is
+# also available at http://www.gnu.org/copyleft/gpl.html.
+
+"""
+This module contains some presets for several key values
+"""
+
+BOOT_SIZE = 512
+ROOT_SIZE = 512
+
+TUI_BRAND_COLOR = "dark blue"
diff --git a/src/ovirt/node/ui/urwid_builder.py b/src/ovirt/node/ui/urwid_builder.py
index 86cdcb6..aec0264 100644
--- a/src/ovirt/node/ui/urwid_builder.py
+++ b/src/ovirt/node/ui/urwid_builder.py
@@ -18,7 +18,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA. A copy of the GNU General Public License is
# also available at http://www.gnu.org/copyleft/gpl.html.
-from ovirt.node import ui, base
+from ovirt.node import ui, base, presets
from ovirt.node.ui import widgets as uw
import os
import urwid
@@ -331,13 +331,13 @@
palette = [(None, 'default', element_styles["background"], 'bold',
None, None),
('screen', None),
- ('header', 'white', 'dark blue'),
+ ('header', 'white', presets.TUI_BRAND_COLOR),
('footer', element_styles["text"]),
('table', element_styles["text"]),
('table.label', element_styles["label"]),
('table.header', element_styles["label"] + ", standout"),
('table.entry', element_styles["text"]),
- ('table.entry:focus', None, 'dark blue'),
+ ('table.entry:focus', None, presets.TUI_BRAND_COLOR),
('main.menu', 'black'),
('main.menu.frame', element_styles["text"]),
('notice', 'light red'),
@@ -354,7 +354,7 @@
('plugin.widget.notice', element_styles["invalid"]),
('plugin.widget.header', element_styles["header"]),
('plugin.widget.divider', element_styles["text"]),
- ('plugin.widget.button', 'dark blue'),
+ ('plugin.widget.button', element_styles["header"]),
('plugin.widget.button.disabled', element_styles["disabled"]),
('plugin.widget.label', element_styles["text"]),
('plugin.widget.label.keyword', element_styles["label"]),
diff --git a/src/ovirtnode/storage.py b/src/ovirtnode/storage.py
index 7d69eae..dceb539 100644
--- a/src/ovirtnode/storage.py
+++ b/src/ovirtnode/storage.py
@@ -27,6 +27,7 @@
import subprocess
import shlex
from ovirtnode.iscsi import set_iscsi_initiator
+from ovirt.node import presets
logger = logging.getLogger(__name__)
@@ -36,8 +37,8 @@
logger.propagate = False
OVIRT_VARS = _functions.parse_defaults()
self.overcommit = 0.5
- self.BOOT_SIZE = 512
- self.ROOT_SIZE = 512
+ self.BOOT_SIZE = presets.BOOT_SIZE
+ self.ROOT_SIZE = presets.ROOT_SIZE
self.CONFIG_SIZE = 5
self.LOGGING_SIZE = 2048
self.EFI_SIZE = 256
--
To view, visit http://gerrit.ovirt.org/30273
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1af33147179ac3bbce938ae618b7067d97013c72
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at redhat.com>
More information about the node-patches
mailing list