[PATCH] Disable SSL on nginx
by Tulio Magno Quites Machado Filho
This patch helps to protect Kimchi against CVE-2014-3566 by completely
disabling SSLv3 on nginx.
---
src/nginx.conf.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/nginx.conf.in b/src/nginx.conf.in
index b5d207f..ed926a3 100644
--- a/src/nginx.conf.in
+++ b/src/nginx.conf.in
@@ -52,6 +52,7 @@ http {
ssl_certificate ${cert_pem};
ssl_certificate_key ${cert_key};
+ ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
add_header X-Frame-Options DENY;
--
2.1.0
9 years, 10 months
[PATCH] Set Arch Linux PNG image to be used on frontend always.
by Paulo Vital
Signed-off-by: Paulo Vital <pvital(a)gmail.com>
---
ui/css/theme-default/template_add.css | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/ui/css/theme-default/template_add.css b/ui/css/theme-default/template_add.css
index e58bccb..580a3f3 100644
--- a/ui/css/theme-default/template_add.css
+++ b/ui/css/theme-default/template_add.css
@@ -199,6 +199,11 @@
background-image: url(../../images/icon-gentoo.png);
}
+.iso-icon.arch {
+ background-image: url(../../images/icon-arch.png);
+}
+
+
.list-iso {
overflow: hidden;
margin: 5px;
--
2.1.4
9 years, 10 months
[PATCH] Remove Non-ASCII chars from tests when unnecessary
by Christy Perez
A domain with non-ASCII characters will fail to start. There are
several tests that use such characters, and these tests fail. None
of the failing tests are required to test the validity of non-ascii
characters, so it's best to remove them and create seperate tests
explicitly for these chracters. This way we will not be masking actual
issues by ignoring an expected failure.
The issue was first noticed with libvirt 1.1.3.
The character issue is discussed in this bug:
https://bugzilla.redhat.com/show_bug.cgi?id=1062943
Signed-off-by: Christy Perez <christy(a)linux.vnet.ibm.com>
---
tests/test_model.py | 113 +++++++++++++++++++++++++++-----------
tests/test_model_network.py | 6 +-
tests/test_model_storagepool.py | 26 +++++++++
tests/test_model_storagevolume.py | 1 -
4 files changed, 113 insertions(+), 33 deletions(-)
diff --git a/tests/test_model.py b/tests/test_model.py
index f80f1c9..aa265f5 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -96,6 +96,45 @@ def test_vm_info(self):
self.assertEquals([], info['groups'])
self.assertTrue(info['persistent'])
+
+ @unittest.skipUnless(utils.running_as_root(), 'Must be run as root')
+ def test_non_ascii_vm_name(self):
+ inst = model.Model(objstore_loc=self.tmp_store)
+
+ with RollbackContext() as rollback:
+ vol_params = {'name': u'test-vol', 'capacity': 1024}
+ task = inst.storagevolumes_create(u'default', vol_params)
+ rollback.prependDefer(inst.storagevolume_delete, u'default',
+ vol_params['name'])
+ inst.task_wait(task['id'])
+ task = inst.task_lookup(task['id'])
+ self.assertEquals('finished', task['status'])
+ vol = inst.storagevolume_lookup(u'default', vol_params['name'])
+
+ # Create template
+ params = {'name': 'test', 'disks': [{'base': vol['path'],
+ 'size': 1}],
+ 'cdrom': self.kimchi_iso}
+ inst.templates_create(params)
+ rollback.prependDefer(inst.template_delete, 'test')
+
+ # Create VM with non-ascii char name
+ params = {'name': u'пeω-∨м', 'template': '/templates/test'}
+ inst.vms_create(params)
+ rollback.prependDefer(inst.vm_delete, u'пeω-∨м')
+
+ vms = inst.vms_get_list()
+ self.assertTrue(u'пeω-∨м' in vms)
+
+ # Start VM
+ # Note: This fails with libvirt > 1.1.3
+ inst.vm_start(u'пeω-∨м')
+ info = inst.vm_lookup(u'пeω-∨м')
+ self.assertEquals('running', info['state'])
+
+ vms = inst.vms_get_list()
+ self.assertFalse(u'пeω-∨м' in vms)
+
@unittest.skipUnless(utils.running_as_root(), 'Must be run as root')
def test_vm_lifecycle(self):
inst = model.Model(objstore_loc=self.tmp_store)
@@ -620,6 +659,18 @@ def test_template_storage_customise(self):
params = {'storagepool': '/storagepools/default'}
inst.template_update('test', params)
+ def test_non_ascii_template_create(self):
+ inst = model.Model('test:///default',
+ objstore_loc=self.tmp_store)
+
+ with RollbackContext() as rollback:
+ params = {'name': u'пeω-teмplate', 'memory': 1024, 'cpus': 1,
+ 'cdrom': self.kimchi_iso}
+ inst.templates_create(params)
+ rollback.prependDefer(inst.template_delete, u'пeω-teмplate')
+ info = inst.template_lookup(u'пeω-teмplate')
+ self.assertEquals(info['name'], u'пeω-teмplate')
+
@unittest.skipUnless(utils.running_as_root(), 'Must be run as root')
def test_template_create(self):
inst = model.Model('test:///default',
@@ -737,7 +788,7 @@ def test_template_update(self):
inst.network_activate(net_name)
rollback.prependDefer(inst.network_deactivate, net_name)
- net_name = u'kīмсhī-пet'
+ net_name = u'kimchi-net'
net_args = {'name': net_name,
'connection': 'nat',
'subnet': '127.0.20.0/24'}
@@ -764,7 +815,7 @@ def test_template_update(self):
self.assertEquals("default", info["networks"][0])
params = {'name': 'new-test', 'memory': 1024, 'cpus': 1,
- 'networks': ['default', 'test-network', u'kīмсhī-пet']}
+ 'networks': ['default', 'test-network', u'kimchi-net']}
inst.template_update('new-test', params)
info = inst.template_lookup('new-test')
for key in params.keys():
@@ -792,7 +843,7 @@ def test_template_update(self):
self.assertEquals('some-vm', inst.vms_create(params))
rollback.prependDefer(inst.vm_delete, 'some-vm')
- iface_args = {'type': 'network', 'network': u'kīмсhī-пet'}
+ iface_args = {'type': 'network', 'network': u'kimchi-net'}
mac = inst.vmifaces_create('some-vm', iface_args)
self.assertEquals(17, len(mac))
@@ -865,52 +916,52 @@ def test_vm_edit(self):
self.assertRaises(OperationFailed, inst.vm_update,
'kimchi-vm1', {'name': 'kimchi-vm2'})
- params = {'name': u'пeω-∨м', 'cpus': 4, 'memory': 2048}
+ params = {'name': u'new-vm', 'cpus': 4, 'memory': 2048}
inst.vm_update('kimchi-vm1', params)
rollback.prependDefer(utils.rollback_wrapper, inst.vm_delete,
- u'пeω-∨м')
- self.assertEquals(info['uuid'], inst.vm_lookup(u'пeω-∨м')['uuid'])
- info = inst.vm_lookup(u'пeω-∨м')
+ u'new-vm')
+ self.assertEquals(info['uuid'], inst.vm_lookup(u'new-vm')['uuid'])
+ info = inst.vm_lookup(u'new-vm')
for key in params.keys():
self.assertEquals(params[key], info[key])
# change only VM users - groups are not changed (default is empty)
users = inst.users_get_list()[:3]
- inst.vm_update(u'пeω-∨м', {'users': users})
- self.assertEquals(users, inst.vm_lookup(u'пeω-∨м')['users'])
- self.assertEquals([], inst.vm_lookup(u'пeω-∨м')['groups'])
+ inst.vm_update(u'new-vm', {'users': users})
+ self.assertEquals(users, inst.vm_lookup(u'new-vm')['users'])
+ self.assertEquals([], inst.vm_lookup(u'new-vm')['groups'])
# change only VM groups - users are not changed (default is empty)
groups = inst.groups_get_list()[:2]
- inst.vm_update(u'пeω-∨м', {'groups': groups})
- self.assertEquals(users, inst.vm_lookup(u'пeω-∨м')['users'])
- self.assertEquals(groups, inst.vm_lookup(u'пeω-∨м')['groups'])
+ inst.vm_update(u'new-vm', {'groups': groups})
+ self.assertEquals(users, inst.vm_lookup(u'new-vm')['users'])
+ self.assertEquals(groups, inst.vm_lookup(u'new-vm')['groups'])
# change VM users and groups by adding a new element to each one
users.append(pwd.getpwuid(os.getuid()).pw_name)
groups.append(grp.getgrgid(os.getgid()).gr_name)
- inst.vm_update(u'пeω-∨м', {'users': users, 'groups': groups})
- self.assertEquals(users, inst.vm_lookup(u'пeω-∨м')['users'])
- self.assertEquals(groups, inst.vm_lookup(u'пeω-∨м')['groups'])
+ inst.vm_update(u'new-vm', {'users': users, 'groups': groups})
+ self.assertEquals(users, inst.vm_lookup(u'new-vm')['users'])
+ self.assertEquals(groups, inst.vm_lookup(u'new-vm')['groups'])
# change VM users (wrong value) and groups
# when an error occurs, everything fails and nothing is changed
- self.assertRaises(InvalidParameter, inst.vm_update, u'пeω-∨м',
+ self.assertRaises(InvalidParameter, inst.vm_update, u'new-vm',
{'users': ['userdoesnotexist'], 'groups': []})
- self.assertEquals(users, inst.vm_lookup(u'пeω-∨м')['users'])
- self.assertEquals(groups, inst.vm_lookup(u'пeω-∨м')['groups'])
+ self.assertEquals(users, inst.vm_lookup(u'new-vm')['users'])
+ self.assertEquals(groups, inst.vm_lookup(u'new-vm')['groups'])
# change VM users and groups (wrong value)
# when an error occurs, everything fails and nothing is changed
- self.assertRaises(InvalidParameter, inst.vm_update, u'пeω-∨м',
+ self.assertRaises(InvalidParameter, inst.vm_update, u'new-vm',
{'users': [], 'groups': ['groupdoesnotexist']})
- self.assertEquals(users, inst.vm_lookup(u'пeω-∨м')['users'])
- self.assertEquals(groups, inst.vm_lookup(u'пeω-∨м')['groups'])
+ self.assertEquals(users, inst.vm_lookup(u'new-vm')['users'])
+ self.assertEquals(groups, inst.vm_lookup(u'new-vm')['groups'])
# change VM users and groups by removing all elements
- inst.vm_update(u'пeω-∨м', {'users': [], 'groups': []})
- self.assertEquals([], inst.vm_lookup(u'пeω-∨м')['users'])
- self.assertEquals([], inst.vm_lookup(u'пeω-∨м')['groups'])
+ inst.vm_update(u'new-vm', {'users': [], 'groups': []})
+ self.assertEquals([], inst.vm_lookup(u'new-vm')['users'])
+ self.assertEquals([], inst.vm_lookup(u'new-vm')['groups'])
def test_multithreaded_connection(self):
def worker():
@@ -1090,19 +1141,19 @@ def test_delete_running_vm(self):
inst.templates_create(params)
rollback.prependDefer(inst.template_delete, 'test')
- params = {'name': u'kīмсhī-∨м', 'template': u'/templates/test'}
+ params = {'name': 'kimchi-vm', 'template': u'/templates/test'}
inst.vms_create(params)
rollback.prependDefer(utils.rollback_wrapper, inst.vm_delete,
- u'kīмсhī-∨м')
+ 'kimchi-vm')
- inst.vm_start(u'kīмсhī-∨м')
+ inst.vm_start('kimchi-vm')
rollback.prependDefer(utils.rollback_wrapper, inst.vm_poweroff,
- u'kīмсhī-∨м')
+ 'kimchi-vm')
- inst.vm_delete(u'kīмсhī-∨м')
+ inst.vm_delete('kimchi-vm')
vms = inst.vms_get_list()
- self.assertFalse(u'kīмсhī-∨м' in vms)
+ self.assertFalse('kimchi-vm' in vms)
@unittest.skipUnless(utils.running_as_root(), 'Must be run as root')
def test_vm_list_sorted(self):
diff --git a/tests/test_model_network.py b/tests/test_model_network.py
index 5dbe54d..c61f37c 100644
--- a/tests/test_model_network.py
+++ b/tests/test_model_network.py
@@ -99,6 +99,10 @@ class NetworkTests(unittest.TestCase):
def setUp(self):
self.request = partial(request, host, ssl_port)
+ def test_non_ascii_net_names(self):
+ net = {'name': u'kīмсhī-пet', 'connection': 'isolated'}
+ _do_network_test(self, model, net)
+
def test_get_networks(self):
networks = json.loads(self.request('/networks').read())
self.assertIn('default', [net['name'] for net in networks])
@@ -127,7 +131,7 @@ def test_get_networks(self):
def test_network_lifecycle(self):
# Verify all the supported network type
- networks = [{'name': u'kīмсhī-пet', 'connection': 'isolated'},
+ networks = [{'name': u'kimchi-net', 'connection': 'isolated'},
{'name': u'nat-network', 'connection': 'nat'},
{'name': u'subnet-network', 'connection': 'nat',
'subnet': '127.0.100.0/24'}]
diff --git a/tests/test_model_storagepool.py b/tests/test_model_storagepool.py
index eabf875..35c62fc 100644
--- a/tests/test_model_storagepool.py
+++ b/tests/test_model_storagepool.py
@@ -60,6 +60,32 @@ class StoragepoolTests(unittest.TestCase):
def setUp(self):
self.request = partial(request, host, ssl_port)
+ def test_non_ascii_storagepool_name(self):
+ storagepools = json.loads(self.request('/storagepools').read())
+ self.assertIn('default', [pool['name'] for pool in storagepools])
+
+ with RollbackContext() as rollback:
+ name = u'kīмсhī-storagepool'
+ req = json.dumps({'name': name, 'type': 'dir',
+ 'path': '/var/lib/libvirt/images/test_pool'})
+ resp = self.request('/storagepools', req, 'POST')
+ rollback.prependDefer(model.storagepool_delete, name)
+
+ self.assertEquals(201, resp.status)
+
+ # Verify pool information
+ resp = self.request('/storagepools/%s' % name.encode("utf-8"))
+ p = json.loads(resp.read())
+ keys = [u'name', u'state', u'capacity', u'allocated',
+ u'available', u'path', u'source', u'type',
+ u'nr_volumes', u'autostart', u'persistent']
+ self.assertEquals(sorted(keys), sorted(p.keys()))
+ self.assertEquals(name, p['name'])
+ resp = self.request('/storagepools/%s/activate' % name.encode('utf-8'), req, 'POST')
+ rollback.prependDefer(model.storagepool_deactivate, name)
+ p = json.loads(resp.read())
+ self.assertEquals('active', p['state'])
+
def test_get_storagepools(self):
storagepools = json.loads(self.request('/storagepools').read())
self.assertIn('default', [pool['name'] for pool in storagepools])
diff --git a/tests/test_model_storagevolume.py b/tests/test_model_storagevolume.py
index a3c3ce3..39531e9 100644
--- a/tests/test_model_storagevolume.py
+++ b/tests/test_model_storagevolume.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Project Kimchi
#
--
2.1.0
9 years, 10 months
Scrum meeting on Feb. 18th cancelled
by Aline Manera
Hi folks,
As I mentioned in the last scrum meeting, I will be out next week for
the Linux Foundation Collaboration Summit where I will do a presentation
about Kimchi.
Because that we will not have the usual scrum meeting on Feb 18th.
Regards,
Aline Manera
9 years, 10 months
[PATCH 0/2] Issue #556: Unable to create bridge virbr0: File already exists
by Ramon Medeiros
Discovery which bridge is available and pass it when creating the default network pool.
Ramon Medeiros (2):
Implement function to discover which bridge name is available
Pass bridge name on NAT network creation
src/kimchi/model/networks.py | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
--
1.8.3.1
9 years, 10 months
[PATCH] Fix issue #589: Add listener to remove Kimchi leftovers
by Aline Manera
If Kimchi is stopped before it gets completely up, it can leave some
leftovers on system due the Feature tests.
So add a listener to cherrypy server to clean up any leftovers when
server is stopped.
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
src/kimchi/kvmusertests.py | 19 ++++++++-----------
src/kimchi/model/config.py | 27 +++++++++++++++++++++++++--
src/kimchi/model/featuretests.py | 21 +++++++++++++--------
3 files changed, 46 insertions(+), 21 deletions(-)
diff --git a/src/kimchi/kvmusertests.py b/src/kimchi/kvmusertests.py
index 408706d..37a80d7 100644
--- a/src/kimchi/kvmusertests.py
+++ b/src/kimchi/kvmusertests.py
@@ -18,18 +18,18 @@
import platform
import psutil
-import uuid
import libvirt
from kimchi.rollbackcontext import RollbackContext
+KVMUSERTEST_VM_NAME = "KVMUSERTEST_VM"
+
class UserTests(object):
SIMPLE_VM_XML = """
<domain type='kvm'>
- <name>%(vm_name)s</name>
- <uuid>%(vm_uuid)s</uuid>
+ <name>%(name)s</name>
<memory unit='KiB'>262144</memory>
<os>
<type arch='%(arch)s'>hvm</type>
@@ -43,22 +43,19 @@ class UserTests(object):
if cls.user:
return cls.user
- vm_uuid = uuid.uuid1()
- vm_name = "kimchi_test_%s" % vm_uuid
arch = 'ppc64' if platform.machine() == 'ppc64le' \
else platform.machine()
- xml = cls.SIMPLE_VM_XML % {'vm_name': vm_name, 'vm_uuid': vm_uuid,
- 'arch': arch}
+ xml = cls.SIMPLE_VM_XML % {'name': KVMUSERTEST_VM_NAME, 'arch': arch}
with RollbackContext() as rollback:
conn = libvirt.open(None)
rollback.prependDefer(conn.close)
- dom = conn.defineXML(xml)
- rollback.prependDefer(dom.undefine)
- dom.create()
+ dom = conn.createXML(xml,
+ flags=libvirt.VIR_DOMAIN_START_AUTODESTROY)
rollback.prependDefer(dom.destroy)
- with open('/var/run/libvirt/qemu/%s.pid' % vm_name) as f:
+ filename = '/var/run/libvirt/qemu/%s.pid' % KVMUSERTEST_VM_NAME
+ with open(filename) as f:
pidStr = f.read()
p = psutil.Process(int(pidStr))
diff --git a/src/kimchi/model/config.py b/src/kimchi/model/config.py
index 6a7df41..1c43360 100644
--- a/src/kimchi/model/config.py
+++ b/src/kimchi/model/config.py
@@ -1,7 +1,7 @@
#
# Project Kimchi
#
-# Copyright IBM, Corp. 2014
+# Copyright IBM, Corp. 2014-2015
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -27,7 +27,8 @@ from kimchi.config import find_qemu_binary, get_version
from kimchi.distroloader import DistroLoader
from kimchi.exception import NotFoundError
from kimchi.model.debugreports import DebugReportsModel
-from kimchi.model.featuretests import FeatureTests
+from kimchi.model.featuretests import FeatureTests, FEATURETEST_POOL_NAME
+from kimchi.model.featuretests import FEATURETEST_VM_NAME
from kimchi.repositories import Repositories
from kimchi.screenshot import VMScreenshot
from kimchi.swupdate import SoftwareUpdate
@@ -61,6 +62,28 @@ class CapabilitiesModel(object):
# It is needed because some features tests depends on the server
cherrypy.engine.subscribe('start', self._set_capabilities)
+ # Subscribe function to clean any Kimchi leftovers
+ cherrypy.engine.subscribe('stop', self._clean_leftovers)
+
+ def _clean_leftovers(self):
+ conn = self.conn.get()
+ FeatureTests.disable_libvirt_error_logging()
+ try:
+ dom = conn.lookupByName(FEATURETEST_VM_NAME)
+ dom.undefine()
+ except Exception:
+ # Any exception can be ignored here
+ pass
+
+ try:
+ pool = conn.storagePoolLookupByName(FEATURETEST_POOL_NAME)
+ pool.undefine()
+ except Exception:
+ # Any exception can be ignored here
+ pass
+
+ FeatureTests.enable_libvirt_error_logging()
+
def _set_capabilities(self):
kimchi_log.info("*** Running feature tests ***")
conn = self.conn.get()
diff --git a/src/kimchi/model/featuretests.py b/src/kimchi/model/featuretests.py
index 5a45990..6ffdf4a 100644
--- a/src/kimchi/model/featuretests.py
+++ b/src/kimchi/model/featuretests.py
@@ -25,17 +25,19 @@ import socket
import subprocess
import threading
-
from lxml.builder import E
-
from kimchi.rollbackcontext import RollbackContext
from kimchi.utils import kimchi_log, run_command
+FEATURETEST_VM_NAME = "FEATURETEST_VM"
+FEATURETEST_POOL_NAME = "FEATURETEST_POOL"
+
+
ISO_STREAM_XML = """
<domain type='%(domain)s'>
- <name>ISO_STREAMING</name>
+ <name>%(name)s</name>
<memory unit='KiB'>1048576</memory>
<os>
<type arch='%(arch)s'>hvm</type>
@@ -57,7 +59,7 @@ ISO_STREAM_XML = """
SIMPLE_VM_XML = """
<domain type='%(domain)s'>
- <name>A_SIMPLE_VM</name>
+ <name>%(name)s</name>
<memory unit='KiB'>10240</memory>
<os>
<type arch='%(arch)s'>hvm</type>
@@ -67,7 +69,7 @@ SIMPLE_VM_XML = """
SCSI_FC_XML = """
<pool type='scsi'>
- <name>TEST_SCSI_FC_POOL</name>
+ <name>%(name)s</name>
<source>
<adapter type='fc_host' wwnn='1234567890abcdef' wwpn='abcdef1234567890'/>
</source>
@@ -105,7 +107,8 @@ class FeatureTests(object):
domain_type = 'test' if conn.getType().lower() == 'test' else 'kvm'
arch = 'ppc64' if platform.machine() == 'ppc64le' \
else platform.machine()
- xml = ISO_STREAM_XML % {'domain': domain_type, 'protocol': protocol,
+ xml = ISO_STREAM_XML % {'name': FEATURETEST_VM_NAME,
+ 'domain': domain_type, 'protocol': protocol,
'arch': arch}
try:
FeatureTests.disable_libvirt_error_logging()
@@ -176,7 +179,8 @@ class FeatureTests(object):
try:
FeatureTests.disable_libvirt_error_logging()
pool = None
- pool = conn.storagePoolDefineXML(SCSI_FC_XML, 0)
+ pool_xml = SCSI_FC_XML % {'name': FEATURETEST_POOL_NAME}
+ pool = conn.storagePoolDefineXML(pool_xml, 0)
except libvirt.libvirtError as e:
if e.get_error_code() == 27:
# Libvirt requires adapter name, not needed when supports to FC
@@ -196,7 +200,8 @@ class FeatureTests(object):
domain_type = 'test' if conn.getType().lower() == 'test' else 'kvm'
arch = 'ppc64' if platform.machine() == 'ppc64le' \
else platform.machine()
- dom = conn.defineXML(SIMPLE_VM_XML % {'domain': domain_type,
+ dom = conn.defineXML(SIMPLE_VM_XML % {'name': FEATURETEST_VM_NAME,
+ 'domain': domain_type,
'arch': arch})
rollback.prependDefer(dom.undefine)
try:
--
2.1.0
9 years, 10 months
[PATCH] Fix issue #591: Get the right arch for MockModel
by Aline Manera
Use osinfo information to get the properly arch information when
creating a VM for feature tests.
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
src/kimchi/model/featuretests.py | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/src/kimchi/model/featuretests.py b/src/kimchi/model/featuretests.py
index 5a45990..c9a0c78 100644
--- a/src/kimchi/model/featuretests.py
+++ b/src/kimchi/model/featuretests.py
@@ -20,15 +20,13 @@
import cherrypy
import libvirt
import lxml.etree as ET
-import platform
import socket
import subprocess
import threading
-
from lxml.builder import E
-
+from kimchi import osinfo
from kimchi.rollbackcontext import RollbackContext
from kimchi.utils import kimchi_log, run_command
@@ -103,8 +101,8 @@ class FeatureTests(object):
@staticmethod
def libvirt_supports_iso_stream(conn, protocol):
domain_type = 'test' if conn.getType().lower() == 'test' else 'kvm'
- arch = 'ppc64' if platform.machine() == 'ppc64le' \
- else platform.machine()
+ arch = osinfo.defaults['arch']
+ arch = 'ppc64' if arch == 'ppc64le' else arch
xml = ISO_STREAM_XML % {'domain': domain_type, 'protocol': protocol,
'arch': arch}
try:
@@ -194,8 +192,8 @@ class FeatureTests(object):
FeatureTests.disable_libvirt_error_logging()
rollback.prependDefer(FeatureTests.enable_libvirt_error_logging)
domain_type = 'test' if conn.getType().lower() == 'test' else 'kvm'
- arch = 'ppc64' if platform.machine() == 'ppc64le' \
- else platform.machine()
+ arch = osinfo.defaults['arch']
+ arch = 'ppc64' if arch == 'ppc64le' else arch
dom = conn.defineXML(SIMPLE_VM_XML % {'domain': domain_type,
'arch': arch})
rollback.prependDefer(dom.undefine)
--
2.1.0
9 years, 10 months
Question about KVM domain not available on trusty
by Thierry Fauck@linux.vnet.ibm.com
I forgot, on trusty, qemu-kvm doesn't exist as is,
and when I try to create a template I get errors like:
libvirt: QEMU Driver error : unsupported configuration: Domain
requires KVM, but it is not available. Check that virtualization is
enabled in the host BIOS, and host configuration is setup to load
the kvm modules.
So 2 issues there
- in trusty get a proper qemu version to avoid messages
error: internal error: process exited while connecting to monitor:
Warning: Disabling some instructions which are not emulated by TCG
(0x0, 0x4)
qemu: hardware error: qemu: could not load LPAR rtas '(null)'
- in kimchi, detect if kvm not a valid domain type then use qemu
Does that sound an issue ? - do you want me to code that ?
Thanks
--
Thierry Fauck @ linux.vnet.ibm
9 years, 10 months
[PATCH V3] UI: Add widget messagebar with sample
by Wen Wang
V2 -> V3:
Rename the sample file and add the license.
V1 -> V2:
Add a parameter "dismissTime" that allow delay time as well as "never"
for the dismiss time.
Signed-off-by: Wen Wang <wenwang(a)linux.vnet.ibm.com>
---
ui/css/theme-default/messagebar-flat.css | 64 ++++++++++++++++++++++++++++
ui/js/widgets/messagebar-flat.js | 71 ++++++++++++++++++++++++++++++++
ui/js/widgets/samples/messagebar.html | 49 ++++++++++++++++++++++
3 files changed, 184 insertions(+)
create mode 100644 ui/css/theme-default/messagebar-flat.css
create mode 100644 ui/js/widgets/messagebar-flat.js
create mode 100644 ui/js/widgets/samples/messagebar.html
diff --git a/ui/css/theme-default/messagebar-flat.css b/ui/css/theme-default/messagebar-flat.css
new file mode 100644
index 0000000..d5efc8e
--- /dev/null
+++ b/ui/css/theme-default/messagebar-flat.css
@@ -0,0 +1,64 @@
+/*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2015
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+.messagebar {
+ height: 30px;
+}
+
+.messagebar .messagebar-text {
+ text-align: left;
+ vertical-align: 50%;
+}
+
+.messagebar .messageHead {
+ display: inline-block;
+ width: 5px;
+ height: 30px;
+}
+
+.messagebar-close {
+ line-height: 30px;
+ vertical-align: middle;
+ margin-right: 10px;
+ cursor: pointer;
+ float: right;
+}
+
+.green {
+ background-color: #DAE6CB;
+}
+
+.dark-green {
+ background-color: #89C53A;
+}
+
+.yellow {
+ background-color: #F1E3C2;
+}
+
+.dark-yellow {
+ background-color: #FDB60D;
+}
+
+.red {
+ background-color: #EAC3C7;
+}
+
+.dark-red {
+ background-color: #D81227;
+}
\ No newline at end of file
diff --git a/ui/js/widgets/messagebar-flat.js b/ui/js/widgets/messagebar-flat.js
new file mode 100644
index 0000000..203d194
--- /dev/null
+++ b/ui/js/widgets/messagebar-flat.js
@@ -0,0 +1,71 @@
+/*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2015
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+* Usage:
+ $(selector).messagebarFlat({
+ content: "Test", //message you want to show in the messagebar
+ color: "red", //Three color supported: "red", "yellow" and "green",
+ dismissTime: 3000 //when set to "never", the messagebar will never disappear.
+ // Or setting it to numbers for the dismiss time you want to delay.
+ });
+*/
+
+(function($) {
+ $.widget("kimchi.messagebarFlat", {
+ options : {
+ content : null,
+ color : "red",
+ dismissTime: 3000
+ },
+
+ _create: function() {
+ var now = this._getTime();
+ var that = this;
+ $("<div class='messagebar'><span class='messageHead'></span>" +
+ "<span class='messagebar-text'> " + this.options.content +": " + now + "</span></div>")
+ .addClass(this.options.color)
+ .appendTo(that.element);
+ $(".messageHead").addClass("dark-" + this.options.color);
+ $("<span class='messagebar-close icon-cancel-circled'></span>").on("click", function() {
+ that.destroy();
+ }).appendTo($(".messagebar"));
+ var dismissDelay = this.options.dismissTime;
+ if (dismissDelay != "never") {
+ setTimeout(function() {
+ that.destroy()
+ }, dismissDelay);
+ }
+ },
+
+ _getTime: function() {
+ var CT = new Date();
+ var currentDate = CT.getDate() + "/" + CT.getMonth()+1 + "/" +CT.getFullYear();
+ var currentTime = CT.getHours() + ":" + CT.getMinutes() + ":" + CT.getSeconds();
+ var now = currentDate + " " + currentTime;
+ return now;
+ },
+
+ destroy: function() {
+ var that = this;
+ that.element.fadeOut("normal", function() {
+ that.element.remove();
+ });
+ }
+ });
+})(jQuery);
\ No newline at end of file
diff --git a/ui/js/widgets/samples/messagebar.html b/ui/js/widgets/samples/messagebar.html
new file mode 100644
index 0000000..b0aa600
--- /dev/null
+++ b/ui/js/widgets/samples/messagebar.html
@@ -0,0 +1,49 @@
+<!--
+/*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2015
+ *
+ * Licensed under the Apache License, Version 2.0 (the 'License');
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an 'AS IS' BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>Sample of messagebar</title>
+ <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
+ <link rel="stylesheet" href="../../../css/fontello/css/fontello.css">
+ <link rel="stylesheet" href="../../../css/fontello/css/animation.css">
+ <link rel="stylesheet" href="../../../libs/themes/base/jquery-ui.min.css">
+ <link rel="stylesheet" href="../../../css/theme-default/messagebar-flat.css">
+ <script src="../../../libs/jquery-1.10.0.min.js"></script>
+ <script src="../../../libs/jquery-ui.min.js"></script>
+ <script src="../messagebar-flat.js"></script>
+ </head>
+ <body>
+ <div class="message"></div>
+ <script>
+ $(document).ready(function() {
+ $(".message").messagebarFlat({
+ content: "This is a test",
+ color: "red",
+ dismissTime: 1000
+ });
+ });
+ </script>
+ </body>
+
+</html>
--
2.1.0
9 years, 10 months