[PATCH 00/10] Adding new-ui to Wok, Kimchi and Gingerbase
by sguimaraes943@gmail.com
From: samhenri <samuel.guimaraes(a)eldorado.org.br>
This patchset adds the new-ui to Hosts (Gingerbase), Templates, Storages and Network tabs, including all modal windows.
Guests tab is still not finished but some elements were already ported to the new-ui.
samhenri (10):
[new-ui] Deleting unused files
[new-ui] Updated widgets
[new-ui] Updated images and distro icons
[new-ui] Updated SCSS files
[new-ui] Base template files
[new-ui] Gingerbase / Hosts tab
[new-ui] Kimchi config and Guests tab
[new-ui] Network tab
[new-ui] Storage tab
[new-ui] Templates tab
src/wok/plugins/gingerbase/.gitignore | 2 +-
src/wok/plugins/gingerbase/configure.ac | 1 -
src/wok/plugins/gingerbase/ui/config/tab-ext.xml | 2 +-
src/wok/plugins/gingerbase/ui/css/Makefile.am | 11 +-
.../plugins/gingerbase/ui/css/src/gingerbase.scss | 29 +
.../gingerbase/ui/css/src/modules/_host.scss | 227 ++++++++
.../gingerbase/ui/css/theme-default/host.css | 289 ---------
.../gingerbase/ui/css/theme-default/report-add.css | 39 --
.../ui/css/theme-default/report-rename.css | 41 --
.../ui/css/theme-default/repository-add.css | 44 --
.../ui/css/theme-default/repository-edit.css | 90 ---
src/wok/plugins/gingerbase/ui/images/Makefile.am | 2 -
src/wok/plugins/gingerbase/ui/images/logo.ico | Bin 1214 -> 15086 bytes
.../gingerbase/ui/images/theme-default/Makefile.am | 20 -
.../ui/images/theme-default/host-icon-sprite.png | Bin 1034 -> 0 bytes
.../images/theme-default/kimchi-loading15x15.gif | Bin 1653 -> 0 bytes
.../gingerbase/ui/js/src/gingerbase.host.js | 645 +++++++++++----------
src/wok/plugins/gingerbase/ui/pages/host.html.tmpl | 213 +++----
.../gingerbase/ui/pages/report-add.html.tmpl | 46 +-
.../gingerbase/ui/pages/report-rename.html.tmpl | 42 +-
.../gingerbase/ui/pages/repository-add.html.tmpl | 124 ++--
.../gingerbase/ui/pages/repository-edit.html.tmpl | 138 ++---
src/wok/plugins/kimchi/ui/config/tab-ext.xml | 8 +-
.../kimchi/ui/css/theme-default/guest-edit.css | 8 +-
.../kimchi/ui/css/theme-default/network.css | 267 ---------
.../kimchi/ui/css/theme-default/storage.css | 502 +---------------
.../css/theme-default/storagepool-add-volume.css | 36 --
.../kimchi/ui/css/theme-default/template-edit.css | 175 ------
.../kimchi/ui/css/theme-default/template.css | 85 ---
.../kimchi/ui/css/theme-default/template_add.css | 317 ----------
.../kimchi/ui/css/theme-default/template_list.css | 267 ---------
.../kimchi/ui/js/src/kimchi.guest_add_main.js | 10 +-
.../kimchi/ui/js/src/kimchi.guest_edit_main.js | 63 +-
src/wok/plugins/kimchi/ui/js/src/kimchi.network.js | 318 +---------
.../kimchi/ui/js/src/kimchi.network_add_main.js | 166 ++++++
.../kimchi/ui/js/src/kimchi.storage_main.js | 191 ++++--
.../ui/js/src/kimchi.storagepool_add_main.js | 36 +-
.../js/src/kimchi.storagepool_add_volume_main.js | 1 +
.../kimchi/ui/js/src/kimchi.template_add_main.js | 406 +++++++++----
.../kimchi/ui/js/src/kimchi.template_edit_main.js | 48 +-
.../kimchi/ui/js/src/kimchi.template_main.js | 59 +-
.../plugins/kimchi/ui/pages/guest-add.html.tmpl | 114 ++--
.../plugins/kimchi/ui/pages/guest-edit.html.tmpl | 97 +---
.../kimchi/ui/pages/guest-storage-add.html.tmpl | 21 +-
src/wok/plugins/kimchi/ui/pages/guests.html.tmpl | 61 +-
.../plugins/kimchi/ui/pages/network-add.html.tmpl | 70 +++
src/wok/plugins/kimchi/ui/pages/network.html.tmpl | 148 ++---
src/wok/plugins/kimchi/ui/pages/storage.html.tmpl | 210 ++++---
.../ui/pages/storagepool-add-volume.html.tmpl | 73 +--
.../kimchi/ui/pages/storagepool-add.html.tmpl | 245 ++++----
.../plugins/kimchi/ui/pages/template-add.html.tmpl | 344 +++++------
.../kimchi/ui/pages/template-edit.html.tmpl | 266 ++++-----
.../plugins/kimchi/ui/pages/templates.html.tmpl | 139 +++--
ui/css/src/bootstrap-select.custom.scss | 4 +
ui/css/src/modules/_administration.scss | 0
ui/css/src/modules/_datagrid.scss | 72 +++
ui/css/src/modules/_guests.scss | 92 +++
ui/css/src/modules/_host.scss | 169 ------
ui/css/src/modules/_iso-list.scss | 126 ++++
ui/css/src/modules/_jqueryui.scss | 0
ui/css/src/modules/_menu-flat.scss | 16 +-
ui/css/src/modules/_modal-flat.scss | 2 +-
ui/css/src/modules/_navbar-flat.scss | 12 +-
ui/css/src/modules/_network.scss | 122 ++++
ui/css/src/modules/_storage.scss | 393 +++++++++++++
ui/css/src/modules/_templates.scss | 304 ++++++++++
ui/css/src/modules/_toolbar.scss | 29 +-
ui/css/src/modules/_wok-confirm.scss | 42 ++
ui/css/src/modules/_wok-grid.scss | 25 +-
ui/css/src/modules/_wok-variables.scss | 11 +-
ui/css/src/wok.scss | 132 +++--
ui/images/theme-default/Makefile.am | 2 +-
ui/images/theme-default/alert.png | Bin 3537 -> 0 bytes
ui/images/theme-default/arrow-down-black.png | Bin 2942 -> 0 bytes
ui/images/theme-default/arrow-down.png | Bin 537 -> 0 bytes
ui/images/theme-default/bg-mask.png | Bin 2899 -> 0 bytes
ui/images/theme-default/bg.png | Bin 35585 -> 0 bytes
ui/images/theme-default/check-green.png | Bin 3501 -> 0 bytes
ui/images/theme-default/check-grey.png | Bin 3535 -> 0 bytes
ui/images/theme-default/folder-arrow-down.png | Bin 2956 -> 0 bytes
ui/images/theme-default/folder-arrow-right.png | Bin 2958 -> 0 bytes
ui/images/theme-default/high.png | Bin 0 -> 532 bytes
ui/images/theme-default/high_disabled.png | Bin 0 -> 513 bytes
ui/images/theme-default/icon-alert.png | Bin 3545 -> 0 bytes
ui/images/theme-default/icon-centos.png | Bin 0 -> 1801 bytes
ui/images/theme-default/icon-debian.png | Bin 0 -> 3318 bytes
ui/images/theme-default/icon-event.png | Bin 3791 -> 0 bytes
ui/images/theme-default/icon-fedora.png | Bin 0 -> 3552 bytes
ui/images/theme-default/icon-gentoo.png | Bin 0 -> 1880 bytes
ui/images/theme-default/icon-opensuse.png | Bin 0 -> 945 bytes
ui/images/theme-default/icon-red_hat.png | Bin 0 -> 3352 bytes
ui/images/theme-default/icon-setting.png | Bin 3664 -> 0 bytes
ui/images/theme-default/icon-tool.png | Bin 4466 -> 0 bytes
ui/images/theme-default/icon-ubuntu.png | Bin 0 -> 611 bytes
ui/images/theme-default/icon-unknown.png | Bin 0 -> 761 bytes
ui/images/theme-default/logo-flat.svg | 113 ++++
ui/images/theme-default/logo-plain.gif | Bin 1601 -> 0 bytes
ui/images/theme-default/logo-white.png | Bin 9879 -> 7583 bytes
ui/images/theme-default/low.png | Bin 0 -> 532 bytes
ui/images/theme-default/low_disabled.png | Bin 0 -> 515 bytes
ui/images/theme-default/med.png | Bin 0 -> 581 bytes
ui/images/theme-default/med_disabled.png | Bin 0 -> 534 bytes
ui/images/theme-default/nav-bg.png | Bin 3043 -> 0 bytes
ui/images/theme-default/thumb-guest.png | Bin 3896 -> 0 bytes
ui/images/theme-default/thumb-host.png | Bin 5069 -> 0 bytes
ui/images/theme-default/user-icon.png | Bin 269 -> 0 bytes
ui/images/theme-default/wok-loading.gif | Bin 6181 -> 0 bytes
ui/js/src/wok.confirm.js | 91 +++
ui/js/src/wok.datagrid.js | 123 ++++
ui/js/src/wok.grid.js | 416 ++++---------
ui/js/src/wok.line-chart.js | 74 ++-
ui/js/src/wok.list.js | 302 ++++++++++
ui/js/src/wok.login.js | 9 +-
ui/js/src/wok.main.js | 61 +-
ui/js/src/wok.message.js | 100 +---
ui/js/src/wok.window.js | 31 +-
ui/js/widgets/grid.js | 123 ----
ui/js/widgets/samples/grid.html | 4 +-
ui/pages/login.html.tmpl | 186 +++---
ui/pages/wok-ui.html.tmpl | 222 +++----
120 files changed, 4865 insertions(+), 5299 deletions(-)
create mode 100644 src/wok/plugins/gingerbase/ui/css/src/gingerbase.scss
create mode 100644 src/wok/plugins/gingerbase/ui/css/src/modules/_host.scss
delete mode 100644 src/wok/plugins/gingerbase/ui/css/theme-default/host.css
delete mode 100644 src/wok/plugins/gingerbase/ui/css/theme-default/report-add.css
delete mode 100644 src/wok/plugins/gingerbase/ui/css/theme-default/report-rename.css
delete mode 100644 src/wok/plugins/gingerbase/ui/css/theme-default/repository-add.css
delete mode 100644 src/wok/plugins/gingerbase/ui/css/theme-default/repository-edit.css
delete mode 100644 src/wok/plugins/gingerbase/ui/images/theme-default/Makefile.am
delete mode 100644 src/wok/plugins/gingerbase/ui/images/theme-default/host-icon-sprite.png
delete mode 100644 src/wok/plugins/gingerbase/ui/images/theme-default/kimchi-loading15x15.gif
delete mode 100644 src/wok/plugins/kimchi/ui/css/theme-default/network.css
delete mode 100644 src/wok/plugins/kimchi/ui/css/theme-default/storagepool-add-volume.css
delete mode 100644 src/wok/plugins/kimchi/ui/css/theme-default/template-edit.css
delete mode 100644 src/wok/plugins/kimchi/ui/css/theme-default/template.css
delete mode 100644 src/wok/plugins/kimchi/ui/css/theme-default/template_add.css
delete mode 100644 src/wok/plugins/kimchi/ui/css/theme-default/template_list.css
create mode 100644 src/wok/plugins/kimchi/ui/js/src/kimchi.network_add_main.js
create mode 100644 src/wok/plugins/kimchi/ui/pages/network-add.html.tmpl
create mode 100644 ui/css/src/modules/_administration.scss
create mode 100644 ui/css/src/modules/_datagrid.scss
create mode 100644 ui/css/src/modules/_guests.scss
delete mode 100644 ui/css/src/modules/_host.scss
create mode 100644 ui/css/src/modules/_iso-list.scss
create mode 100644 ui/css/src/modules/_jqueryui.scss
create mode 100644 ui/css/src/modules/_network.scss
create mode 100644 ui/css/src/modules/_storage.scss
create mode 100644 ui/css/src/modules/_templates.scss
create mode 100644 ui/css/src/modules/_wok-confirm.scss
delete mode 100644 ui/images/theme-default/alert.png
delete mode 100644 ui/images/theme-default/arrow-down-black.png
delete mode 100644 ui/images/theme-default/arrow-down.png
delete mode 100644 ui/images/theme-default/bg-mask.png
delete mode 100644 ui/images/theme-default/bg.png
delete mode 100644 ui/images/theme-default/check-green.png
delete mode 100644 ui/images/theme-default/check-grey.png
delete mode 100644 ui/images/theme-default/folder-arrow-down.png
delete mode 100644 ui/images/theme-default/folder-arrow-right.png
create mode 100644 ui/images/theme-default/high.png
create mode 100644 ui/images/theme-default/high_disabled.png
delete mode 100644 ui/images/theme-default/icon-alert.png
create mode 100644 ui/images/theme-default/icon-centos.png
create mode 100644 ui/images/theme-default/icon-debian.png
delete mode 100644 ui/images/theme-default/icon-event.png
create mode 100644 ui/images/theme-default/icon-fedora.png
create mode 100644 ui/images/theme-default/icon-gentoo.png
create mode 100644 ui/images/theme-default/icon-opensuse.png
create mode 100644 ui/images/theme-default/icon-red_hat.png
delete mode 100644 ui/images/theme-default/icon-setting.png
delete mode 100644 ui/images/theme-default/icon-tool.png
create mode 100644 ui/images/theme-default/icon-ubuntu.png
create mode 100644 ui/images/theme-default/icon-unknown.png
create mode 100644 ui/images/theme-default/logo-flat.svg
delete mode 100644 ui/images/theme-default/logo-plain.gif
create mode 100644 ui/images/theme-default/low.png
create mode 100644 ui/images/theme-default/low_disabled.png
create mode 100644 ui/images/theme-default/med.png
create mode 100644 ui/images/theme-default/med_disabled.png
delete mode 100644 ui/images/theme-default/nav-bg.png
delete mode 100644 ui/images/theme-default/thumb-guest.png
delete mode 100644 ui/images/theme-default/thumb-host.png
delete mode 100644 ui/images/theme-default/user-icon.png
delete mode 100644 ui/images/theme-default/wok-loading.gif
create mode 100644 ui/js/src/wok.confirm.js
create mode 100644 ui/js/src/wok.datagrid.js
create mode 100644 ui/js/src/wok.list.js
delete mode 100644 ui/js/widgets/grid.js
--
1.9.3
9 years, 1 month
[PATCH] Create new storage volume when attaching disk to a guest.
by pvital@linux.vnet.ibm.com
From: Paulo Vital <pvital(a)linux.vnet.ibm.com>
Add back-end support to create new storage volume (new virtual disk) when
attaching disk to a guest created before.
There are three essential parameters to create the new volume:
* vol: Storage volume name of disk image, that should be 'new_vol'.
* capacity: The total space which can be used to store new volumes.
The unit is bytes.
* format: The format of the defined Storage Volume. Only used when creating
a storage volume with 'capacity'.
Signed-off-by: Paulo Vital <pvital(a)linux.vnet.ibm.com>
---
src/wok/plugins/kimchi/API.json | 12 ++++++++++++
src/wok/plugins/kimchi/docs/API.md | 6 +++++-
src/wok/plugins/kimchi/i18n.py | 1 +
src/wok/plugins/kimchi/model/vmstorages.py | 28 +++++++++++++++++++++++++++-
4 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/src/wok/plugins/kimchi/API.json b/src/wok/plugins/kimchi/API.json
index 961f35f..8822520 100644
--- a/src/wok/plugins/kimchi/API.json
+++ b/src/wok/plugins/kimchi/API.json
@@ -564,6 +564,18 @@
"type": "string",
"pattern": "^((/)|(http)[s]?:|[t]?(ftp)[s]?:)+.*$",
"error": "KCHVMSTOR0003E"
+ },
+ "capacity": {
+ "description": "The total size (MiB) of the storage volume",
+ "type": "number",
+ "minimum": 1,
+ "error": "KCHVOL0020E"
+ },
+ "format": {
+ "description": "The format of the volume",
+ "type": "string",
+ "pattern": "^(|bochs|cloop|cow|dmg|qcow|qcow2|qed|raw|vmdk|vpc)$",
+ "error": "KCHVOL0015E"
}
}
},
diff --git a/src/wok/plugins/kimchi/docs/API.md b/src/wok/plugins/kimchi/docs/API.md
index 52368b7..d00c2fe 100644
--- a/src/wok/plugins/kimchi/docs/API.md
+++ b/src/wok/plugins/kimchi/docs/API.md
@@ -205,7 +205,11 @@ Represents a snapshot of the Virtual Machine's primary monitor.
* type: The type of the storage (currently support 'cdrom' and 'disk').
* path: Path of cdrom iso.
* pool: Storage pool which disk image file locate in.
- * vol: Storage volume name of disk image.
+ * vol: Storage volume name of disk image ('new_vol' for create a new volume).
+ * capacity: The total space which can be used to store new volumes.
+ The unit is bytes.
+ * format: The format of the defined Storage Volume. Only used when creating
+ a storage volume with 'capacity'.
### Sub-resource: storage
**URI:** /plugins/kimchi/vms/*:name*/storages/*:dev*
diff --git a/src/wok/plugins/kimchi/i18n.py b/src/wok/plugins/kimchi/i18n.py
index 42a5e16..53a0b6b 100644
--- a/src/wok/plugins/kimchi/i18n.py
+++ b/src/wok/plugins/kimchi/i18n.py
@@ -278,6 +278,7 @@ messages = {
"KCHVMSTOR0016E": _("Volume already in use by other virtual machine."),
"KCHVMSTOR0017E": _("Only one of path or pool/volume can be specified to add a new virtual machine disk"),
"KCHVMSTOR0018E": _("Volume chosen with format %(format)s does not fit in the storage type %(type)s"),
+ "KCHVMSTOR0019E": _("The format msust be used only when creating a new storage volume with 'capacity'."),
"KCHSNAP0001E": _("Virtual machine '%(vm)s' must be stopped before creating a snapshot of it."),
"KCHSNAP0002E": _("Unable to create snapshot '%(name)s' on virtual machine '%(vm)s'. Details: %(err)s"),
diff --git a/src/wok/plugins/kimchi/model/vmstorages.py b/src/wok/plugins/kimchi/model/vmstorages.py
index 23db0a6..f6b3918 100644
--- a/src/wok/plugins/kimchi/model/vmstorages.py
+++ b/src/wok/plugins/kimchi/model/vmstorages.py
@@ -22,12 +22,14 @@ from lxml import etree
from wok.exception import InvalidOperation, InvalidParameter, NotFoundError
from wok.exception import OperationFailed
+from wok.model.tasks import TaskModel
from wok.utils import wok_log
from wok.plugins.kimchi.model.config import CapabilitiesModel
from wok.plugins.kimchi.model.diskutils import get_disk_used_by
from wok.plugins.kimchi.model.diskutils import set_disk_used_by
from wok.plugins.kimchi.model.storagevolumes import StorageVolumeModel
+from wok.plugins.kimchi.model.storagevolumes import StorageVolumesModel
from wok.plugins.kimchi.model.utils import get_vm_config_flag
from wok.plugins.kimchi.model.vms import DOM_STATE_MAP, VMModel
from wok.plugins.kimchi.osinfo import lookup
@@ -51,6 +53,7 @@ class VMStoragesModel(object):
self.conn = kargs['conn']
self.objstore = kargs['objstore']
self.caps = CapabilitiesModel(**kargs)
+ self.task = TaskModel(**kargs)
def _get_available_bus_address(self, bus_type, vm_name):
if bus_type not in ['ide']:
@@ -85,9 +88,12 @@ class VMStoragesModel(object):
if not ('vol' in params) ^ ('path' in params):
raise InvalidParameter("KCHVMSTOR0017E")
+ if ('format' in params) and ('capacity' not in params):
+ raise InvalidParameter("KCHVMSTOR0019E")
+
dom = VMModel.get_vm(vm_name, self.conn)
params['bus'] = _get_device_bus(params['type'], dom)
- params['format'] = 'raw'
+ params['format'] = params['format'] if 'format' in params else 'raw'
dev_list = [dev for dev, bus in get_vm_disks(dom).iteritems()
if bus == params['bus']]
@@ -102,6 +108,26 @@ class VMStoragesModel(object):
DOM_STATE_MAP[dom.info()[0]] != 'shutoff'):
raise InvalidOperation('KCHVMSTOR0011E')
+ if params.get('capacity'):
+ # If 'capacity' is in the parameters a new storage volume will
+ # be created and allocated to the VM.
+ if params['vol'] == 'new_vol':
+ # Set the name of the volume as the same pattern used when
+ # creating a VM based on Template (VM UUID + disk index).
+ # Otherwise, use the name provided by the user.
+ params['vol'] = "%s-%s.img" % (dom.UUIDString(),
+ params['index'])
+ vol_info = dict(name=params['vol'],
+ type=params['type'],
+ capacity=params['capacity'],
+ allocation=params['capacity'],
+ format=params['format'],
+ )
+ storage_volumes = StorageVolumesModel(conn=self.conn,
+ objstore=self.objstore)
+ mytask = storage_volumes.create(params['pool'], vol_info)
+ self.task.wait(mytask['id'])
+
if params.get('vol'):
try:
pool = params['pool']
--
2.4.3
9 years, 1 month
[PATCH v4] shutdown and reboot actions on linux vs linux with KVM
by chandra@linux.vnet.ibm.com
From: chandrureddy <chandra(a)linux.vnet.ibm.com>
Review Comments taken care
---
src/wok/plugins/gingerbase/i18n.py | 1 +
src/wok/plugins/gingerbase/model/host.py | 47 +++++++++++++++-------
.../gingerbase/ui/js/src/gingerbase.host.js | 25 ++++++------
src/wok/plugins/gingerbase/ui/pages/i18n.json.tmpl | 3 ++
4 files changed, 49 insertions(+), 27 deletions(-)
diff --git a/src/wok/plugins/gingerbase/i18n.py b/src/wok/plugins/gingerbase/i18n.py
index 8596f17..ef97266 100644
--- a/src/wok/plugins/gingerbase/i18n.py
+++ b/src/wok/plugins/gingerbase/i18n.py
@@ -39,6 +39,7 @@ messages = {
"GGBHOST0001E": _("Unable to shutdown host machine as there are running virtual machines"),
"GGBHOST0002E": _("Unable to reboot host machine as there are running virtual machines"),
+ "GGBHOST0003E": _("There may be vms running on the host"),
"GGBHOST0005E": _("When specifying CPU topology, each element must be an integer greater than zero."),
"GGBPKGUPD0001E": _("No packages marked for update"),
diff --git a/src/wok/plugins/gingerbase/model/host.py b/src/wok/plugins/gingerbase/model/host.py
index 670fec5..766d6c7 100644
--- a/src/wok/plugins/gingerbase/model/host.py
+++ b/src/wok/plugins/gingerbase/model/host.py
@@ -39,6 +39,14 @@ from wok.plugins.gingerbase.repositories import Repositories
from wok.plugins.gingerbase.swupdate import SoftwareUpdate
HOST_STATS_INTERVAL = 1
+DOM_STATE_MAP = {0: 'nostate',
+ 1: 'running',
+ 2: 'blocked',
+ 3: 'paused',
+ 4: 'shutdown',
+ 5: 'shutoff',
+ 6: 'crashed',
+ 7: 'pmsuspended'}
class HostModel(object):
@@ -142,29 +150,40 @@ class HostModel(object):
def shutdown(self, args=None):
# Check for running vms before shutdown
- # FIXME : Find alternative way to figure out if any vms running
- # running_vms = self._get_vms_list_by_state('running')
- # if len(running_vms) > 0:
- # raise OperationFailed("GGBHOST0001E")
+ running_vms = self.get_vmlist_bystate('running')
+ if len(running_vms) > 0:
+ raise OperationFailed("GGBHOST0001E")
wok_log.info('Host is going to shutdown.')
os.system('shutdown -h now')
def reboot(self, args=None):
- # Find running VMs
- # FIXME : Find alternative way to figure out if any vms running
- # running_vms = self._get_vms_list_by_state('running')
- # if len(running_vms) > 0:
- # raise OperationFailed("GGBHOST0002E")
+ # Check for running vms before reboot
+ running_vms = self.get_vmlist_bystate('running')
+ if len(running_vms) > 0:
+ raise OperationFailed("GGBHOST0002E")
wok_log.info('Host is going to reboot.')
os.system('reboot')
- # def _get_vms_list_by_state(self, state):
- # conn = self.conn.get()
- # return [dom.name().decode('utf-8')
- # for dom in conn.listAllDomains(0)
- # if (DOM_STATE_MAP[dom.info()[0]]) == state]
+ def get_vmlist_bystate(self, state='running'):
+ try:
+ libvirt_mod = __import__('libvirt')
+ except Exception, e:
+ wok_log.info("Unable to import libvirt module. Details:",
+ e.message)
+ # Ignore any error and assume there is no vm running in the host
+ return []
+
+ try:
+ conn = libvirt_mod.open(None)
+ return [dom.name().decode('utf-8')
+ for dom in conn.listAllDomains(0)
+ if (DOM_STATE_MAP[dom.info()[0]] == state)]
+ except Exception, e:
+ wok_log.info("Unable to get virtual machines information. "
+ "Details:", e.message)
+ raise OperationFailed("GGBHOST0003E")
class SoftwareUpdateProgressModel(object):
diff --git a/src/wok/plugins/gingerbase/ui/js/src/gingerbase.host.js b/src/wok/plugins/gingerbase/ui/js/src/gingerbase.host.js
index 0d52b92..77ee736 100644
--- a/src/wok/plugins/gingerbase/ui/js/src/gingerbase.host.js
+++ b/src/wok/plugins/gingerbase/ui/js/src/gingerbase.host.js
@@ -496,22 +496,21 @@ kimchi.host_main = function() {
};
wok.confirm(settings, function() {
- kimchi.shutdown(params);
$(shutdownButtonID).prop('disabled', true);
$(restartButtonID).prop('disabled', true);
// Check if there is any VM is running.
- // FIXME : Find alternative way to figure out if any vms running
- // kimchi.listVMs(function(vms) {
- // for(var i = 0; i < vms.length; i++) {
- // if(vms[i]['state'] === 'running') {
- // wok.message.error.code('GGBHOST6001E');
- // $(shutdownButtonID).prop('disabled', false);
- // $(restartButtonID).prop('disabled', false);
- // return;
- // }
- // }
- //
- // });
+ // Based on the success will shutdown/reboot
+ kimchi.shutdown(params, function(success) {
+ wok.message.success(i18n['GGBHOST6009M'])
+ $(shutdownButtonID).prop('disabled', false);
+ $(restartButtonID).prop('disabled', false);
+ return;
+ }, function(error) {
+ // Looks like VMs are running.
+ wok.message.error.code('GGBHOST6001E');
+ $(shutdownButtonID).prop('disabled', false);
+ $(restartButtonID).prop('disabled', false);
+ });
}, function() {
});
};
diff --git a/src/wok/plugins/gingerbase/ui/pages/i18n.json.tmpl b/src/wok/plugins/gingerbase/ui/pages/i18n.json.tmpl
index f6228ab..3f3b662 100644
--- a/src/wok/plugins/gingerbase/ui/pages/i18n.json.tmpl
+++ b/src/wok/plugins/gingerbase/ui/pages/i18n.json.tmpl
@@ -69,6 +69,7 @@
"GGBHOST6006M": "$_("Received")",
"GGBHOST6007M": "$_("Sent")",
"GGBHOST6008M": "$_("Shutting down or restarting host will cause unsaved work lost. Continue to shut down/restarting?")",
+ "GGBHOST6009M": "$_("The system is going down")",
"GGBREPO6001M": "$_("Confirm")",
@@ -113,6 +114,8 @@
"GGBDR6012M": "$_("Pending...")",
"GGBDR6013M": "$_("Report name is the same as the original one.")",
+ "GGBHOST6001E": "$_("Unable to shut down system as there are some virtual machines running!")",
+
"GGBVM6001M": "$_("This will delete the virtual machine and its virtual disks. This operation cannot be undone. Would you like to continue?")",
"GGBVM6002M": "$_("Power off Confirmation")",
"GGBVM6003M": "$_("This action may produce undesirable results, "
--
2.1.0
9 years, 1 month
Failing to import Gingerbase and Kimchi
by Samuel Henrique De Oliveira Guimaraes
Hi team,
I’ve been trying to run Kimchi on a CentOS 7 virtual machine but the plug-ins are failing to load. Check out the log:
➜ kimchi git:(master) ✗ sudo python src/wokd --host=0.0.0.0 --environment=development
/usr/lib64/python2.7/site-packages/psutil/_pslinux.py:154: RuntimeWarning: couldn't determine platform's TOTAL_PHYMEM
warnings.warn("couldn't determine platform's TOTAL_PHYMEM", RuntimeWarning)
Failed to import plugin plugins.gingerbase.GingerBase, error: Class plugins.gingerbase.GingerBase can not be imported, error: cannot import name config
Failed to import plugin plugins.kimchi.KimchiRoot, error: Class plugins.kimchi.KimchiRoot can not be imported, error: 'module' object has no attribute 'get_sysinfo'
[05/Nov/2015:14:10:25] ENGINE Listening for SIGHUP.
[05/Nov/2015:14:10:25] ENGINE Listening for SIGTERM.
[05/Nov/2015:14:10:25] ENGINE Listening for SIGUSR1.
[05/Nov/2015:14:10:25] ENGINE Bus STARTING
CherryPy Checker:
'/root/kimchi_master/kimchi/src/wok/plugins/ginger/ui/images' (root + dir) is not an existing filesystem path.
section: [/images]
root: None
dir: '/root/kimchi_master/kimchi/src/wok/plugins/ginger/ui/images'
[05/Nov/2015:14:10:25] ENGINE Started monitor thread 'Autoreloader'.
[05/Nov/2015:14:10:25] ENGINE Serving on 127.0.0.1:8010
[05/Nov/2015:14:10:25] ENGINE Bus STARTED
[05/Nov/2015:14:32:43] ENGINE Started monitor thread 'Session cleanup'.
Any ideas?
BTW, Ginger does get imported but the tab is empty.
Thanks,
Samuel
9 years, 1 month
Help with Device Path in Storages / listHostPartitions() response (new-ui)
by Samuel Henrique De Oliveira Guimaraes
Hi team,
I've finished adding the new-ui to Storage main page but I'm blocked with the "Add Device Path" dialog. I've successfully converted jQuery-UI dialog to a Bootstrap modal + made the action button call the window and look up for the volume to find any partition. The problem is that my server doesn't have any other storage device left and I'm unable to run Kimchi inside a VM.
Could somebody grab the partitions json response for me? Just go to Chrome Dev Tools (Ctrl + Shift + I), browse to Storage Tab in Kimchi (any revision) and select Network tab in Chrome Dev Tools, press the "Record" button and filter the XHR requests, click on a logical Storage Pool in Kimchi and then "Extend" in the Action Button. The panel should look like the attached image.
I think the "Extend Device Path" validation is working but If I don't get a VM running Kimchi I won't be able to test it and I need a full listHostPartitions() result to check if {name} is actualyl a device name and {path} is full path + device name or just the device path.
Thanks,
Samuel
9 years, 1 month
[PATCH v3] shutdown and reboot actions on linux vs linux with KVM
by chandra@linux.vnet.ibm.com
From: chandrureddy <chandra(a)linux.vnet.ibm.com>
Review Comments taken care
---
src/wok/plugins/gingerbase/model/host.py | 47 +++++++++++++++-------
.../gingerbase/ui/js/src/gingerbase.host.js | 25 ++++++------
src/wok/plugins/gingerbase/ui/pages/i18n.json.tmpl | 3 ++
3 files changed, 48 insertions(+), 27 deletions(-)
diff --git a/src/wok/plugins/gingerbase/model/host.py b/src/wok/plugins/gingerbase/model/host.py
index 670fec5..9cbef47 100644
--- a/src/wok/plugins/gingerbase/model/host.py
+++ b/src/wok/plugins/gingerbase/model/host.py
@@ -39,6 +39,14 @@ from wok.plugins.gingerbase.repositories import Repositories
from wok.plugins.gingerbase.swupdate import SoftwareUpdate
HOST_STATS_INTERVAL = 1
+DOM_STATE_MAP = {0: 'nostate',
+ 1: 'running',
+ 2: 'blocked',
+ 3: 'paused',
+ 4: 'shutdown',
+ 5: 'shutoff',
+ 6: 'crashed',
+ 7: 'pmsuspended'}
class HostModel(object):
@@ -142,29 +150,40 @@ class HostModel(object):
def shutdown(self, args=None):
# Check for running vms before shutdown
- # FIXME : Find alternative way to figure out if any vms running
- # running_vms = self._get_vms_list_by_state('running')
- # if len(running_vms) > 0:
- # raise OperationFailed("GGBHOST0001E")
+ running_vms = self.get_vmlist_bystate('running')
+ if len(running_vms) > 0:
+ raise OperationFailed("GGBHOST0001E")
wok_log.info('Host is going to shutdown.')
os.system('shutdown -h now')
def reboot(self, args=None):
- # Find running VMs
- # FIXME : Find alternative way to figure out if any vms running
- # running_vms = self._get_vms_list_by_state('running')
- # if len(running_vms) > 0:
- # raise OperationFailed("GGBHOST0002E")
+ # Check for running vms before reboot
+ running_vms = self.get_vmlist_bystate('running')
+ if len(running_vms) > 0:
+ raise OperationFailed("GGBHOST0002E")
wok_log.info('Host is going to reboot.')
os.system('reboot')
- # def _get_vms_list_by_state(self, state):
- # conn = self.conn.get()
- # return [dom.name().decode('utf-8')
- # for dom in conn.listAllDomains(0)
- # if (DOM_STATE_MAP[dom.info()[0]]) == state]
+ def get_vmlist_bystate(self, state='running'):
+ try:
+ libvirt_mod = __import__('libvirt')
+ except Exception, e:
+ wok_log.info("Unable to import libvirt module. Details:",
+ e.message)
+ # Ignore any error and assume there is no vm running in the host
+ return []
+
+ try:
+ conn = libvirt_mod.open(None)
+ return [dom.name().decode('utf-8')
+ for dom in conn.listAllDomains(0)
+ if (DOM_STATE_MAP[dom.info()[0]] == state)]
+ except Exception, e:
+ wok_log.info("Unable to get virtual machines information. "
+ "Details:", e.message)
+ raise OperationFailed("There may be vms running on the host")
class SoftwareUpdateProgressModel(object):
diff --git a/src/wok/plugins/gingerbase/ui/js/src/gingerbase.host.js b/src/wok/plugins/gingerbase/ui/js/src/gingerbase.host.js
index 0d52b92..77ee736 100644
--- a/src/wok/plugins/gingerbase/ui/js/src/gingerbase.host.js
+++ b/src/wok/plugins/gingerbase/ui/js/src/gingerbase.host.js
@@ -496,22 +496,21 @@ kimchi.host_main = function() {
};
wok.confirm(settings, function() {
- kimchi.shutdown(params);
$(shutdownButtonID).prop('disabled', true);
$(restartButtonID).prop('disabled', true);
// Check if there is any VM is running.
- // FIXME : Find alternative way to figure out if any vms running
- // kimchi.listVMs(function(vms) {
- // for(var i = 0; i < vms.length; i++) {
- // if(vms[i]['state'] === 'running') {
- // wok.message.error.code('GGBHOST6001E');
- // $(shutdownButtonID).prop('disabled', false);
- // $(restartButtonID).prop('disabled', false);
- // return;
- // }
- // }
- //
- // });
+ // Based on the success will shutdown/reboot
+ kimchi.shutdown(params, function(success) {
+ wok.message.success(i18n['GGBHOST6009M'])
+ $(shutdownButtonID).prop('disabled', false);
+ $(restartButtonID).prop('disabled', false);
+ return;
+ }, function(error) {
+ // Looks like VMs are running.
+ wok.message.error.code('GGBHOST6001E');
+ $(shutdownButtonID).prop('disabled', false);
+ $(restartButtonID).prop('disabled', false);
+ });
}, function() {
});
};
diff --git a/src/wok/plugins/gingerbase/ui/pages/i18n.json.tmpl b/src/wok/plugins/gingerbase/ui/pages/i18n.json.tmpl
index f6228ab..3f3b662 100644
--- a/src/wok/plugins/gingerbase/ui/pages/i18n.json.tmpl
+++ b/src/wok/plugins/gingerbase/ui/pages/i18n.json.tmpl
@@ -69,6 +69,7 @@
"GGBHOST6006M": "$_("Received")",
"GGBHOST6007M": "$_("Sent")",
"GGBHOST6008M": "$_("Shutting down or restarting host will cause unsaved work lost. Continue to shut down/restarting?")",
+ "GGBHOST6009M": "$_("The system is going down")",
"GGBREPO6001M": "$_("Confirm")",
@@ -113,6 +114,8 @@
"GGBDR6012M": "$_("Pending...")",
"GGBDR6013M": "$_("Report name is the same as the original one.")",
+ "GGBHOST6001E": "$_("Unable to shut down system as there are some virtual machines running!")",
+
"GGBVM6001M": "$_("This will delete the virtual machine and its virtual disks. This operation cannot be undone. Would you like to continue?")",
"GGBVM6002M": "$_("Power off Confirmation")",
"GGBVM6003M": "$_("This action may produce undesirable results, "
--
2.1.0
9 years, 1 month
[PATCH] Issue #751: Fix guest memory utilization calculation.
by pvital@linux.vnet.ibm.com
From: Paulo Vital <pvital(a)linux.vnet.ibm.com>
The return of Pyhton's function memoryStats() returns the guest's memory
utilization statistcs by the Libvirt API virDomainMemoryStats. However,
the content of the return (a dictionary) depends on the combination of
host and guest OS.
This patch fix the issue of not returning the curent utilization of
guest memory when host and guest are running different OS and not all
statistics are returned.
Signed-off-by: Paulo Vital <pvital(a)linux.vnet.ibm.com>
---
src/wok/plugins/kimchi/model/vms.py | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/wok/plugins/kimchi/model/vms.py b/src/wok/plugins/kimchi/model/vms.py
index 63681c7..0641ae8 100644
--- a/src/wok/plugins/kimchi/model/vms.py
+++ b/src/wok/plugins/kimchi/model/vms.py
@@ -919,13 +919,15 @@ class VMModel(object):
def _get_percentage_mem_usage(self, vm_uuid, dom, seconds):
# Get the guest's memory stats
memStats = dom.memoryStats()
- if memStats:
+ if ('available' in memStats) and ('unused' in memStats):
memUsed = memStats.get('available') - memStats.get('unused')
+ percentage = ((memUsed * 100.0) / memStats.get('available'))
+ elif ('rss' in memStats) and ('actual' in memStats):
+ percentage = memStats.get('rss') * 100.0 / memStats.get('actual')
else:
- wok_log.debug('Failed to measure memory usage of the guest.')
+ wok_log.error('Failed to measure memory usage of the guest.')
- percentage = max(0.0, min(100.0, ((memUsed * 100.0) /
- memStats.get('available'))))
+ percentage = max(0.0, min(100.0, percentage))
self.stats[vm_uuid].update({'mem_usage': percentage})
--
2.4.3
9 years, 1 month
[PATCH v2] shutdown and reboot actions on linux vs linux with KVM
by chandra@linux.vnet.ibm.com
From: chandrureddy <chandra(a)linux.vnet.ibm.com>
---
src/wok/plugins/gingerbase/model/host.py | 47 +++++++++++++++-------
.../gingerbase/ui/js/src/gingerbase.host.js | 27 +++++++------
src/wok/plugins/gingerbase/ui/pages/i18n.json.tmpl | 3 ++
3 files changed, 50 insertions(+), 27 deletions(-)
diff --git a/src/wok/plugins/gingerbase/model/host.py b/src/wok/plugins/gingerbase/model/host.py
index 670fec5..8c5ca5f 100644
--- a/src/wok/plugins/gingerbase/model/host.py
+++ b/src/wok/plugins/gingerbase/model/host.py
@@ -39,6 +39,14 @@ from wok.plugins.gingerbase.repositories import Repositories
from wok.plugins.gingerbase.swupdate import SoftwareUpdate
HOST_STATS_INTERVAL = 1
+DOM_STATE_MAP = {0: 'nostate',
+ 1: 'running',
+ 2: 'blocked',
+ 3: 'paused',
+ 4: 'shutdown',
+ 5: 'shutoff',
+ 6: 'crashed',
+ 7: 'pmsuspended'}
class HostModel(object):
@@ -142,29 +150,40 @@ class HostModel(object):
def shutdown(self, args=None):
# Check for running vms before shutdown
- # FIXME : Find alternative way to figure out if any vms running
- # running_vms = self._get_vms_list_by_state('running')
- # if len(running_vms) > 0:
- # raise OperationFailed("GGBHOST0001E")
+ running_vms = self.get_vmlist_bystate('running')
+ if len(running_vms) > 0:
+ raise OperationFailed("GGBHOST0001E")
wok_log.info('Host is going to shutdown.')
os.system('shutdown -h now')
def reboot(self, args=None):
- # Find running VMs
- # FIXME : Find alternative way to figure out if any vms running
- # running_vms = self._get_vms_list_by_state('running')
- # if len(running_vms) > 0:
- # raise OperationFailed("GGBHOST0002E")
+ # Check for running vms before reboot
+ running_vms = self.get_vmlist_bystate('running')
+ if len(running_vms) > 0:
+ raise OperationFailed("GGBHOST0002E")
wok_log.info('Host is going to reboot.')
os.system('reboot')
- # def _get_vms_list_by_state(self, state):
- # conn = self.conn.get()
- # return [dom.name().decode('utf-8')
- # for dom in conn.listAllDomains(0)
- # if (DOM_STATE_MAP[dom.info()[0]]) == state]
+ def get_vmlist_bystate(self, state='running'):
+ try:
+ libvirt_mod = __import__('libvirt')
+ except Exception, e:
+ wok_log.info("Unable to import libvirt module. Details:",
+ e.message)
+ # Ignore any error and assume there is no vm running in the host
+ return []
+
+ try:
+ conn = libvirt_mod.open("qemu:///system")
+ return [dom.name().decode('utf-8')
+ for dom in conn.listAllDomains(0)
+ if (DOM_STATE_MAP[dom.info()[0]] == state)]
+ except Exception, e:
+ wok_log.info("Unable to get virtual machines information. "
+ "Details:", e.message)
+ raise OperationFailed("There may be vms running on the host")
class SoftwareUpdateProgressModel(object):
diff --git a/src/wok/plugins/gingerbase/ui/js/src/gingerbase.host.js b/src/wok/plugins/gingerbase/ui/js/src/gingerbase.host.js
index 0d52b92..e07b2bd 100644
--- a/src/wok/plugins/gingerbase/ui/js/src/gingerbase.host.js
+++ b/src/wok/plugins/gingerbase/ui/js/src/gingerbase.host.js
@@ -496,22 +496,23 @@ kimchi.host_main = function() {
};
wok.confirm(settings, function() {
- kimchi.shutdown(params);
$(shutdownButtonID).prop('disabled', true);
$(restartButtonID).prop('disabled', true);
// Check if there is any VM is running.
- // FIXME : Find alternative way to figure out if any vms running
- // kimchi.listVMs(function(vms) {
- // for(var i = 0; i < vms.length; i++) {
- // if(vms[i]['state'] === 'running') {
- // wok.message.error.code('GGBHOST6001E');
- // $(shutdownButtonID).prop('disabled', false);
- // $(restartButtonID).prop('disabled', false);
- // return;
- // }
- // }
- //
- // });
+ // Based on the success will shutdown/reboot
+ kimchi.shutdown(params, function(success) {
+ wok.message.success(i18n['GGBHOST6009M'])
+ $(shutdownButtonID).prop('disabled', false);
+ $(restartButtonID).prop('disabled', false);
+ return;
+ }, function(error) {
+ if (error['status'] == 500) {
+ // Looks like VMs are running.
+ wok.message.error.code('GGBHOST6001E');
+ }
+ $(shutdownButtonID).prop('disabled', false);
+ $(restartButtonID).prop('disabled', false);
+ });
}, function() {
});
};
diff --git a/src/wok/plugins/gingerbase/ui/pages/i18n.json.tmpl b/src/wok/plugins/gingerbase/ui/pages/i18n.json.tmpl
index f6228ab..3f3b662 100644
--- a/src/wok/plugins/gingerbase/ui/pages/i18n.json.tmpl
+++ b/src/wok/plugins/gingerbase/ui/pages/i18n.json.tmpl
@@ -69,6 +69,7 @@
"GGBHOST6006M": "$_("Received")",
"GGBHOST6007M": "$_("Sent")",
"GGBHOST6008M": "$_("Shutting down or restarting host will cause unsaved work lost. Continue to shut down/restarting?")",
+ "GGBHOST6009M": "$_("The system is going down")",
"GGBREPO6001M": "$_("Confirm")",
@@ -113,6 +114,8 @@
"GGBDR6012M": "$_("Pending...")",
"GGBDR6013M": "$_("Report name is the same as the original one.")",
+ "GGBHOST6001E": "$_("Unable to shut down system as there are some virtual machines running!")",
+
"GGBVM6001M": "$_("This will delete the virtual machine and its virtual disks. This operation cannot be undone. Would you like to continue?")",
"GGBVM6002M": "$_("Power off Confirmation")",
"GGBVM6003M": "$_("This action may produce undesirable results, "
--
2.1.0
9 years, 1 month
[PATCH 0/2] *** Sosreport accepts underscore and support for s390x platform ***
by mesmriti@linux.vnet.ibm.com
From: Megha Smriti <mesmriti(a)linux.vnet.ibm.com>
#748: Sosreport accepts underscore in name
#749: Added debug report for plaform s390x
along with sosreport
Megha Smriti (2):
Modified code to parse the output of sosreport command using
regular expression which gives the name and location of
sosreport present in command output, instead of searching the
sosreport file with regular pattern "sosreport-<name>*" in /tmp
and /var/tmp
Modified code to check platform and if its s390x then collect
dbginfo tar along with sosreport and create new tar having both
the above tar and move to /var/lib/kimchi/debugreports. Also
added i18n error messages required for dbginfo.
src/wok/plugins/gingerbase/i18n.py | 9 +-
src/wok/plugins/gingerbase/model/debugreports.py | 135 +++++++++++++++++------
2 files changed, 106 insertions(+), 38 deletions(-)
--
2.4.0
9 years, 1 month
Second level navigation code changes
by Chandra Shehkhar Reddy Potula
Hi Samuel,
On behalf of Atreye (she is on vacation) I am sending you the code she
worked on the second level navigation.
Instructions:
1. place wok.main.js in the folder kimchi/ui/js/src folder
2. place wok-ui.html.tmpl in the folder kimchi/ui/pages folder
3. place tab-ext-gingerbase.xml in the folder
kimchi/src/wok/plugins/gingerbase/ui/config folder (make sure you rename
to tab-ext.xml)
4. place tab-ext-kimchi.xml in the folder
kimchi/src/wok/plugins/kimchi/ui/config folder (make sure you rename to
tab-ext.xml)
I know this piece of code is at the initial stage and have the following
issues;
1. Tab focus is not working
2. browsing other tabs than default was failing. For example click on
template tab on the Virtualization tab not work and so on...
If you have any quick solution let us know but this is where now second
level tab navigation stands at.
Thanks in advance for your help !!!
Regards
Chjandra
9 years, 1 month