[RFC] Shutdown VM graceful
by Sheldon
Currently, stopping guests in Kimchi is not graceful in the sense that
the guest becomes 'shut down' immediately. This could be be problematic
because guest file systems could become corrupted. Perhaps a warning
should be added before a guest is immediately stopped or reset.
kimchi can does not support shutdown by agent, so we can not guarantee
we can shutdown graceful.
User should install agent manully
We can use acpi shutdown a VM. But not all guest os will shutdown the VM
even it receive acpi shutdown.
So I have 2 proposal:
1. only one shutdown API and one shutdown button for UI.
when user click shutdown, the backend will try to shutdown VM by acpi.
if 1 minutes timeout, kimchi will destroy the VM forcefully.
2. support ACPI shutdown and destroy two APIs. support "force off" and
"shutdown" 2 buttons in UI.
"shutdown" means ACPI shutdown. but we can not guarantee it can shutdown
the VM.
If the user find the VM is not shutdown for some time, he can try to
force power off the VM
--
Thanks and best regards!
Sheldon Feng(冯少合)<shaohef(a)linux.vnet.ibm.com>
IBM Linux Technology Center
10 years, 8 months
[PATCH 0/6] Add mechanism to translate help pages
by Aline Manera
From: Aline Manera <alinefm(a)br.ibm.com>
This patch set updates the build process and also de UI to get translated help
pages.
Aline Manera (6):
Replicate help pages for pt_BR and zh_CN
Update build process to generate html pages for each help subdir
help pages: Remove former .dita files
help pages: Adjust css url
help pages: Update .gitignore file
help pages: Set default index file to /help URI
.gitignore | 2 +-
configure.ac | 3 +
contrib/kimchi.spec.fedora.in | 2 +-
contrib/kimchi.spec.suse.in | 2 +-
src/kimchi/config.py.in | 1 +
ui/js/src/kimchi.main.js | 11 +--
ui/pages/help/Makefile.am | 16 ++---
ui/pages/help/dita-help.xsl | 4 +-
ui/pages/help/en_US/Makefile.am | 23 +++++++
ui/pages/help/en_US/guests.dita | 134 ++++++++++++++++++++++++++++++++++++
ui/pages/help/en_US/host.dita | 70 +++++++++++++++++++
ui/pages/help/en_US/network.dita | 68 ++++++++++++++++++
ui/pages/help/en_US/storage.dita | 98 ++++++++++++++++++++++++++
ui/pages/help/en_US/templates.dita | 122 ++++++++++++++++++++++++++++++++
ui/pages/help/guests.dita | 134 ------------------------------------
ui/pages/help/host.dita | 70 -------------------
ui/pages/help/network.dita | 68 ------------------
ui/pages/help/pt_BR/Makefile.am | 23 +++++++
ui/pages/help/pt_BR/guests.dita | 134 ++++++++++++++++++++++++++++++++++++
ui/pages/help/pt_BR/host.dita | 70 +++++++++++++++++++
ui/pages/help/pt_BR/network.dita | 68 ++++++++++++++++++
ui/pages/help/pt_BR/storage.dita | 98 ++++++++++++++++++++++++++
ui/pages/help/pt_BR/templates.dita | 122 ++++++++++++++++++++++++++++++++
ui/pages/help/storage.dita | 98 --------------------------
ui/pages/help/templates.dita | 122 --------------------------------
ui/pages/help/zh_CN/Makefile.am | 23 +++++++
ui/pages/help/zh_CN/guests.dita | 134 ++++++++++++++++++++++++++++++++++++
ui/pages/help/zh_CN/host.dita | 70 +++++++++++++++++++
ui/pages/help/zh_CN/network.dita | 68 ++++++++++++++++++
ui/pages/help/zh_CN/storage.dita | 98 ++++++++++++++++++++++++++
ui/pages/help/zh_CN/templates.dita | 122 ++++++++++++++++++++++++++++++++
31 files changed, 1567 insertions(+), 511 deletions(-)
create mode 100644 ui/pages/help/en_US/Makefile.am
create mode 100644 ui/pages/help/en_US/guests.dita
create mode 100644 ui/pages/help/en_US/host.dita
create mode 100644 ui/pages/help/en_US/network.dita
create mode 100644 ui/pages/help/en_US/storage.dita
create mode 100644 ui/pages/help/en_US/templates.dita
delete mode 100644 ui/pages/help/guests.dita
delete mode 100644 ui/pages/help/host.dita
delete mode 100644 ui/pages/help/network.dita
create mode 100644 ui/pages/help/pt_BR/Makefile.am
create mode 100644 ui/pages/help/pt_BR/guests.dita
create mode 100644 ui/pages/help/pt_BR/host.dita
create mode 100644 ui/pages/help/pt_BR/network.dita
create mode 100644 ui/pages/help/pt_BR/storage.dita
create mode 100644 ui/pages/help/pt_BR/templates.dita
delete mode 100644 ui/pages/help/storage.dita
delete mode 100644 ui/pages/help/templates.dita
create mode 100644 ui/pages/help/zh_CN/Makefile.am
create mode 100644 ui/pages/help/zh_CN/guests.dita
create mode 100644 ui/pages/help/zh_CN/host.dita
create mode 100644 ui/pages/help/zh_CN/network.dita
create mode 100644 ui/pages/help/zh_CN/storage.dita
create mode 100644 ui/pages/help/zh_CN/templates.dita
--
1.7.10.4
10 years, 8 months
[PATCH v2 0/4] Github #329: "YOU SHALL NOT ... run as root!"
by Daniel Barboza
From: Daniel Henrique Barboza <danielhb(a)linux.vnet.ibm.com>
Changes:
*v2:
- adressed Ramon's comment about the python path in kimchid.in
This patch series revamps the launch architecture to allow kimchi
to not run as root while being exposed at an open http/https port.
The solution adopted is using a reverse http proxy (nginx) to make
the 'bridge' between two distinct cherrypy processes, one running
as frontend as a regular user and another running as backend, as root.
The communication with the outside will be done through nginx, running
as a regular user too.
The changes were heavy in the kimchid script, but the startup and
usage options still the same. User-wise, there shouldn't be any
functional change in the way kimchi works after applying this change.
Refer to https://github.com/kimchi-project/kimchi/issues/329 for
further information in all the other approaches considered and why
they didn't work out.
Daniel Henrique Barboza (4):
Github #329: kimchid script changes
Github #329: new launch script and proxy template
Github #329: server, root and utils changes
Github #329: config.py.in, spec, readme and makefile changes
.gitignore | 2 +
contrib/kimchi.spec.fedora.in | 5 +-
contrib/kimchi.spec.suse.in | 3 +
docs/README.md | 4 +-
src/Makefile.am | 9 +-
src/kimchi/config.py.in | 9 +-
src/kimchi/root.py | 6 +-
src/kimchi/server.py | 100 ++++++++++++---------
src/kimchi/utils.py | 42 ++++++++-
src/kimchid.in | 202 ++++++++++++++++++++++++++++++++++++------
src/kimchid_server.in | 45 ++++++++++
src/nginx.conf.in | 69 +++++++++++++++
12 files changed, 418 insertions(+), 78 deletions(-)
create mode 100644 src/kimchid_server.in
create mode 100644 src/nginx.conf.in
--
1.8.3.1
10 years, 8 months
[PATCH] Issue#366: Guest Name Can't be Changed
by Hongliang Wang
When changing a guest name in Guest Tab, the change takes no effect because of
a UI bug. Fix it in this patch.
Signed-off-by: Hongliang Wang <hlwang(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.guest_edit_main.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js
index 9375c51..b771263 100644
--- a/ui/js/src/kimchi.guest_edit_main.js
+++ b/ui/js/src/kimchi.guest_edit_main.js
@@ -119,7 +119,7 @@ kimchi.guest_edit_main = function() {
var editableFields = [ 'name' ];
var data = {};
$.each(editableFields, function(i, field) {
- data[field] = $('#form-guest-edit [name="' + field + '"]').val();
+ data[field] = $('input[name="' + field + '"]', guestEditForm).val();
});
kimchi.updateVM(kimchi.selectedGuest, data, function() {
kimchi.listVmsAuto();
--
1.8.1.4
10 years, 8 months
[PATCH] Bug fix #347 / Support i686 architecture
by Ramon Medeiros
Bug fix #347 - Errors when retrieving network information
Signed-off-by: Ramon Medeiros <ramonn(a)linux.vnet.ibm.com>
---
src/kimchi/osinfo.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/kimchi/osinfo.py b/src/kimchi/osinfo.py
index c5f889b..bb86672 100644
--- a/src/kimchi/osinfo.py
+++ b/src/kimchi/osinfo.py
@@ -28,7 +28,7 @@ from distutils.version import LooseVersion
from kimchi.config import paths
-SUPPORTED_ARCHS = {'x86': ('i386', 'x86_64'), 'power': ('ppc', 'ppc64')}
+SUPPORTED_ARCHS = {'x86': ('i386', 'i686', 'x86_64'), 'power': ('ppc', 'ppc64')}
common_spec = {'cpus': 1, 'cpu_cores': 1, 'cpu_threads': 1, 'memory': 1024,
--
1.8.3.1
10 years, 8 months
[PATCH] Fix volume not found error message
by Rodrigo Trujillo
The message 'KCHVOL0002E' expects the storage pool name, however the
backend was passing the libvirt pool object, this makes the user see the
python object string (useless information). This patch corrects this
problem, fixing the duplicated variable name in the source code.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
src/kimchi/model/storagevolumes.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/kimchi/model/storagevolumes.py b/src/kimchi/model/storagevolumes.py
index c524ca3..8a568eb 100644
--- a/src/kimchi/model/storagevolumes.py
+++ b/src/kimchi/model/storagevolumes.py
@@ -108,8 +108,8 @@ class StorageVolumeModel(object):
self.conn = kargs['conn']
self.objstore = kargs['objstore']
- def _get_storagevolume(self, pool, name):
- pool = StoragePoolModel.get_storagepool(pool, self.conn)
+ def _get_storagevolume(self, poolname, name):
+ pool = StoragePoolModel.get_storagepool(poolname, self.conn)
if not pool.isActive():
raise InvalidOperation("KCHVOL0006E", {'name': pool})
try:
@@ -117,7 +117,7 @@ class StorageVolumeModel(object):
except libvirt.libvirtError as e:
if e.get_error_code() == libvirt.VIR_ERR_NO_STORAGE_VOL:
raise NotFoundError("KCHVOL0002E", {'name': name,
- 'pool': pool})
+ 'pool': poolname})
else:
raise
--
1.8.5.3
10 years, 8 months
[PATCH] Fix debugreports download issue
by Mark Wu
Commit be5c57 renamed the debugreport uri field name from 'file' to
'uri' and updated the internal redireciton uri, but the UI side
doesn't use internal redirect. So it still needs to update the
corresponding UI code.
---
ui/js/src/kimchi.host.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui/js/src/kimchi.host.js b/ui/js/src/kimchi.host.js
index d389702..ad62a55 100644
--- a/ui/js/src/kimchi.host.js
+++ b/ui/js/src/kimchi.host.js
@@ -347,7 +347,7 @@ kimchi.host_main = function() {
}
kimchi.downloadReport({
- file: report['file']
+ file: report['uri']
});
}
}],
--
1.8.4.2
10 years, 8 months
[PATCH] objectstore: support sorting by a key in get_list()
by zhshzhou@linux.vnet.ibm.com
From: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
ObjectStoreSession.get_list() just returns an unsorted id list. When the
caller wants to sort the list according to a key, it has to implement
the sorting code each time. This patch implement the sorting in
objectstore to make the code re-usable.
Signed-off-by: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
---
src/kimchi/objectstore.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/kimchi/objectstore.py b/src/kimchi/objectstore.py
index 153b548..d355c58 100644
--- a/src/kimchi/objectstore.py
+++ b/src/kimchi/objectstore.py
@@ -38,11 +38,19 @@ class ObjectStoreSession(object):
self.conn = conn
self.conn.text_factory = lambda x: unicode(x, "utf-8", "ignore")
- def get_list(self, obj_type):
+ def _get_list(self, obj_type):
c = self.conn.cursor()
res = c.execute('SELECT id FROM objects WHERE type=?', (obj_type,))
return [x[0] for x in res]
+ def get_list(self, obj_type, sort_key=None):
+ ids = self._get_list(obj_type)
+ if sort_key is None:
+ return ids
+ objects = [(ident, self.get(obj_type, ident)) for ident in ids]
+ objects.sort(key=lambda (_, obj): obj[sort_key])
+ return [ident for ident, _ in objects]
+
def get(self, obj_type, ident):
c = self.conn.cursor()
res = c.execute('SELECT json FROM objects WHERE type=? AND id=?',
--
1.8.5.3
10 years, 8 months
[PATCH] Try to activate physical interface when create a network on it
by Mark Wu
Currently, the backend network interfaces API doesn't filter out
the down interfaces. So the user could create network on top of
a down interface. Kimchi should try to activate the interface if
it's down and report failure if the cable is not plugged.
In future, we could report the link status to front end and give
a prompt to user that it need takes several seconds to activate
the interface.
---
src/kimchi/i18n.py | 2 ++
src/kimchi/model/networks.py | 18 +++++++++++++++++-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index 86ab5d6..3db2d4c 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -188,6 +188,8 @@ messages = {
"KCHNET0017E": _("Unable to delete network %(name)s. There are some virtual machines and/or templates linked to this network."),
"KCHNET0018E": _("Unable to deactivate network %(name)s. There are some virtual machines and/or templates linked to this network."),
"KCHNET0019E": _("Bridge device %(name)s can not be the trunk device of a VLAN."),
+ "KCHNET0020E": _("Failed to activate interface %(iface)s: %(err)s."),
+ "KCHNET0021E": _("Failed to activate interface %(iface)s. Please check the physical link status."),
"KCHDR0001E": _("Debug report %(name)s does not exist"),
"KCHDR0002E": _("Debug report tool not found in system"),
diff --git a/src/kimchi/model/networks.py b/src/kimchi/model/networks.py
index 8f77c12..c5fec87 100644
--- a/src/kimchi/model/networks.py
+++ b/src/kimchi/model/networks.py
@@ -18,6 +18,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
import sys
+import time
import ipaddr
import libvirt
@@ -29,7 +30,7 @@ from kimchi import xmlutils
from kimchi.exception import InvalidOperation, InvalidParameter
from kimchi.exception import MissingParameter, NotFoundError, OperationFailed
from kimchi.rollbackcontext import RollbackContext
-from kimchi.utils import kimchi_log
+from kimchi.utils import kimchi_log, run_command
class NetworksModel(object):
@@ -141,6 +142,20 @@ class NetworksModel(object):
'dhcp': {'range': {'start': dhcp_start,
'end': dhcp_end}}})
+ def _ensure_iface_up(self, iface):
+ if netinfo.operstate(iface) != 'up':
+ _, err, rc = run_command(['ip', 'link', 'set', 'dev', iface, 'up'])
+ if rc != 0:
+ raise OperationFailed("KCHNET0020E",
+ {'iface': iface, 'err': err})
+ # Add a delay to wait for the link change takes into effect.
+ for i in range(10):
+ time.sleep(1)
+ if netinfo.operstate(iface) == 'up':
+ break
+ else:
+ raise OperationFailed("KCHNET0021E", {'iface': iface})
+
def _set_network_bridge(self, params):
try:
iface = params['interface']
@@ -150,6 +165,7 @@ class NetworksModel(object):
except KeyError:
raise MissingParameter("KCHNET0004E", {'name': params['name']})
+ self._ensure_iface_up(iface)
if netinfo.is_bridge(iface):
if 'vlan_id' in params:
raise InvalidParameter('KCHNET0019E', {'name': iface})
--
1.8.4.2
10 years, 8 months
[PATCH 0/3] bug fix: change power off to stop for VM and add a power off confirmation.
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
We will add a shutdown graceful API later.
"Stop" is obscure for user.
Currently, stopping guests in Kimchi is not graceful in the sense that
the guest becomes 'shut down' immediately. This could be be problematic
because guest file systems could become corrupted. Perhaps a warning
should be added before a guest is immediately stopped or reset.
So "power off" is more exact than "stop" in literal meaning.
The aciton power off a VM forcefully is same that we cut the physical
machine power. This action may produce undesirable results, for example
unflushed disk cache in the guest.
We should also add a confirmation to user.
ShaoHe Feng (3):
change the stop to power off for VM in backend
change the stop to power off for VM in UI
add confirmation for power off a VM
docs/API.md | 3 ++-
src/kimchi/control/vms.py | 2 +-
src/kimchi/i18n.py | 2 +-
src/kimchi/mockmodel.py | 2 +-
src/kimchi/model/vms.py | 4 ++--
tests/test_model.py | 12 ++++++------
tests/test_rest.py | 12 ++++++------
ui/js/src/kimchi.api.js | 6 +++---
ui/js/src/kimchi.guest_main.js | 23 ++++++++++++++++-------
ui/pages/guest.html.tmpl | 4 ++--
ui/pages/help/guests.dita | 2 +-
ui/pages/i18n.html.tmpl | 4 ++++
12 files changed, 45 insertions(+), 31 deletions(-)
--
1.8.5.3
10 years, 8 months