[PATCH] UI: Adding widget of gauge
by Wen Wang
V1 -> V2:
Change the time of the copyright.
New widget accept two options: "value" and "color". value varies from 0
to 100 and color contains "red", "blue", "yellow" and "purple".
Signed-off-by: Wen Wang <wenwang(a)linux.vnet.ibm.com>
---
ui/css/theme-default/gauge-flat.css | 45 +++++++++++++++
ui/js/widgets/gauge-flat.js | 110 ++++++++++++++++++++++++++++++++++++
2 files changed, 155 insertions(+)
create mode 100755 ui/css/theme-default/gauge-flat.css
create mode 100755 ui/js/widgets/gauge-flat.js
diff --git a/ui/css/theme-default/gauge-flat.css b/ui/css/theme-default/gauge-flat.css
new file mode 100755
index 0000000..4f65cd9
--- /dev/null
+++ b/ui/css/theme-default/gauge-flat.css
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+.ui-gauge-flat {
+ height: 15px;
+ text-align: left;
+ overflow: hidden;
+ background: #E6E7E8;
+}
+
+.ui-gauge-flat .ui-gauge-flat-value {
+ margin: -1px;
+ height: 100%;
+}
+
+.ui-gauge-flat .red {
+ background: #D9182D;
+}
+
+.ui-gauge-flat .blue {
+ background: #008ABF;
+}
+
+.ui-gauge-flat .yellow {
+ background: #FDB813;
+}
+
+.ui-gauge-flat .purple {
+ background: #7F1C7D;
+}
diff --git a/ui/js/widgets/gauge-flat.js b/ui/js/widgets/gauge-flat.js
new file mode 100755
index 0000000..41a9ce8
--- /dev/null
+++ b/ui/js/widgets/gauge-flat.js
@@ -0,0 +1,110 @@
+/*
+ * 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.
+ */
+
+
+(function( $ ) {
+
+return $.widget( "ui.gaugeflat", {
+ version: "@VERSION",
+ options: {
+ max: 100,
+ value: 0,
+ color: "red"
+ },
+
+ min: 0,
+
+ _create: function() {
+ this.oldValue = this.options.value = this._constrainedValue();
+
+ this.element
+ .addClass( "ui-gauge-flat ui-widget ui-widget-content ui-corner-all" )
+ .attr({
+ role: "gaugeflat",
+ "aria-valuemin": this.min
+ });
+
+ var color = this.options.color;
+
+ this.valueDiv = $( "<div class='ui-gauge-flat-value " + color + " ui-widget-header ui-corner-left'></div>" )
+ .appendTo( this.element );
+
+ this._refreshValue();
+ },
+
+ _destroy: function() {
+ this.element
+ .removeClass( "ui-gauge-flat ui-widget ui-widget-content ui-corner-all" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-valuemin" )
+ .removeAttr( "aria-valuemax" )
+ .removeAttr( "aria-valuenow" );
+
+ this.valueDiv.remove();
+ },
+
+ value: function( newValue ) {
+ if ( newValue === undefined ) {
+ return this.options.value;
+ }
+
+ this.options.value = this._constrainedValue( newValue );
+ this._refreshValue();
+ },
+
+ _constrainedValue: function( newValue ) {
+ if ( newValue === undefined ) {
+ newValue = this.options.value;
+ }
+
+ this.indeterminate = newValue === false;
+
+ if ( typeof newValue !== "number" ) {
+ newValue = 0;
+ }
+
+ return this.indeterminate ? false :
+ Math.min( this.options.max, Math.max( this.min, newValue ) );
+ },
+
+ _setOptions: function( options ) {
+ var value = options.value;
+ delete options.value;
+
+ this._super( options );
+
+ this.options.value = this._constrainedValue( value );
+ this._refreshValue();
+ },
+
+ _percentage: function() {
+ return this.indeterminate ? 100 : 100 * ( this.options.value - this.min ) / ( this.options.max - this.min );
+ },
+
+ _refreshValue: function() {
+ var value = this.options.value,
+ percentage = this._percentage();
+
+ this.valueDiv
+ .toggle( this.indeterminate || value > this.min )
+ .toggleClass( "ui-corner-right", value === this.options.max )
+ .width( percentage.toFixed(0) + "%" );
+ }
+});
+
+})(jQuery);
--
2.1.0
9 years, 11 months
[PATCH] Issue #456: Firewall ports are not open after firewall restart v4
by Ramon Medeiros
Changes:
v4:
Write README instructions based on README-federation
add iptables rules
v3:
Remove postint file from debian
Append opensuse firewall commands
Change README instructions
v2:
Correct firewalld argument "--permanent"
Extend changes to debian
Instead of setup firewall and selinux configuration, kimchi will just
add the files needed by this setup and describe to the user how security
setup will be done in README.
Signed-off-by: Ramon Medeiros <ramonn(a)linux.vnet.ibm.com>
---
contrib/DEBIAN/postinst | 28 ----------------------------
contrib/DEBIAN/postrm | 7 -------
contrib/kimchi.spec.fedora.in | 26 --------------------------
docs/README.md | 31 +++++++++++++++++++++++++++++++
4 files changed, 31 insertions(+), 61 deletions(-)
delete mode 100755 contrib/DEBIAN/postinst
diff --git a/contrib/DEBIAN/postinst b/contrib/DEBIAN/postinst
deleted file mode 100755
index 5bca009..0000000
--- a/contrib/DEBIAN/postinst
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/sh -e
-#
-# Project Kimchi
-#
-# Copyright IBM, Corp. 2013
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library 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
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-set +e
-service firewalld status >/dev/null 2>&1
-if [ $? -ne 0 ]; then
- service firewalld start >/dev/null 2>&1
-fi
-firewall-cmd --reload >/dev/null 2>&1
-firewall-cmd --add-service kimchid >/dev/null 2>&1
-set -e
diff --git a/contrib/DEBIAN/postrm b/contrib/DEBIAN/postrm
index 9f1d895..ef90b49 100755
--- a/contrib/DEBIAN/postrm
+++ b/contrib/DEBIAN/postrm
@@ -26,10 +26,3 @@ case "$1" in
rm -rf /var/log/kimchi /var/run/kimchi.pid /usr/share/kimchi/
;;
esac
-
-set +e
-service firewalld status >/dev/null 2>&1
-if [ $? -eq 0 ]; then
- firewall-cmd --remove-service kimchid >/dev/null 2>&1
-fi
-set -e
diff --git a/contrib/kimchi.spec.fedora.in b/contrib/kimchi.spec.fedora.in
index e75018e..92d3e49 100644
--- a/contrib/kimchi.spec.fedora.in
+++ b/contrib/kimchi.spec.fedora.in
@@ -113,23 +113,6 @@ if [ $1 -eq 1 ] ; then
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
-%if 0%{?with_systemd}
-service firewalld status >/dev/null 2>&1
-if [ $? -ne 0 ]; then
- service firewalld start >/dev/null 2>&1
-fi
-# Add firewalld rules to open 8000 and 8001 port
-firewall-cmd --reload >/dev/null 2>&1
-firewall-cmd --add-service kimchid >/dev/null 2>&1
-%else
-# Add default iptable rules to open 8000 and 8001 port
-iptables -I INPUT -p tcp --dport 8000 -j ACCEPT
-iptables -I INPUT -p tcp --dport 8001 -j ACCEPT
-iptables -I INPUT -p tcp --dport 64667 -j ACCEPT
-service iptables save >/dev/null 2>&1
-%endif
-# Add SELinux rules to "open" Kimchi ports
-semanage permissive -a httpd_t
%preun
@@ -137,13 +120,6 @@ if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
/bin/systemctl --no-reload disable kimchid.service > /dev/null 2>&1 || :
/bin/systemctl stop kimchid.service > /dev/null 2>&1 || :
- %if 0%{?with_systemd}
- firewall-cmd --remove-service kimchid >/dev/null 2>&1 || :
- %else
- iptables -D INPUT -p tcp --dport 8000 -j ACCEPT || :
- iptables -D INPUT -p tcp --dport 8001 -j ACCEPT || :
- iptables -D INPUT -p tcp --dport 64667 -j ACCEPT || :
- %endif
fi
exit 0
@@ -154,8 +130,6 @@ if [ "$1" -ge 1 ] ; then
/bin/systemctl try-restart kimchid.service >/dev/null 2>&1 || :
fi
exit 0
-# Rollback SELinux rules
-semanage permissive -d httpd_t
%clean
rm -rf $RPM_BUILD_ROOT
diff --git a/docs/README.md b/docs/README.md
index 823c856..8dcc652 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -142,6 +142,37 @@ Run
$ sudo kimchid --host=0.0.0.0
+If you cannot access Kimchi, take a look at these 2 points:
+
+1. Firewall
+Kimchi uses by default the ports 8000, 8001 and 64667. To allow incoming connections:
+
+ For system using firewalld, do:
+ sudo firewall-cmd --add-port 8000 --permanent
+ sudo firewall-cmd --add-port 8001 --permanent
+ sudo firewall-cmd --add-port 64667 --permanent
+ sudo firewall-cmd --reload
+
+ For openSUSE systems, do:
+ sudo /sbin/SuSEfirewall2 open EXT TCP 8000
+ sudo /sbin/SuSEfirewall2 open EXT TCP 8001
+ sudo /sbin/SuSEfirewall2 open EXT TCP 64667
+
+ For system using iptables, do:
+ sudo iptables -A INPUT -p tcp --dport 8000 -j ACCEPT
+ sudo iptables -A INPUT -p tcp --dport 8001 -j ACCEPT
+ sudo iptables -A INPUT -p tcp --dport 64667 -j ACCEPT
+
+
+Don't forget to correctly save the rules.
+
+
+2. SELinux
+
+Allow httpd_t context for Kimchi web server:
+
+semanage permissive -a httpd_t
+
Test
----
--
1.8.3.1
9 years, 11 months
[PATCH v2] Do not reuse names when cloning the same VM more than once at the same time
by Crístian Viana
This is the difference between this and the previous patchset (v1):
- Add test.
Without the changes to src/kimchi/model/vms.py, the test mentioned above returns
the following error:
$ sudo ./run_tests.sh test_model.ModelTests.test_vm_clone
WARNING: no 'numpy' module, HyBi protocol will be slower
cpu_info topology not supported.
Loading YumUpdate features.
Loaded plugins: fastestmirror, langpacks, remove-with-leaves
libvirt: Domain Config error : operation failed: domain 'test-clone-1' already exists with uuid f1150e4f-36a6-49c2-a6ef-e416a3358852
Error in async_task 2
Traceback (most recent call last):
File "/home/vianac/LTC/kimchi/src/kimchi/asynctask.py", line 70, in _run_helper
self.fn(cb, opaque)
File "/home/vianac/LTC/kimchi/src/kimchi/model/vms.py", line 380, in _clone_task
'err': e.message})
OperationFailed: KCHVM0035E: Unable to clone VM 'test'. Details: operation failed: domain 'test-clone-1' already exists with uuid f1150e4f-36a6-49c2-a6ef-e416a3358852
libvirt: Test Driver error : Domain not found
F
======================================================================
FAIL: test_vm_clone (test_model.ModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_model.py", line 1390, in test_vm_clone
self.assertEquals('finished', task2['status'])
AssertionError: 'finished' != u'failed'
----------------------------------------------------------------------
Ran 1 test in 1.072s
FAILED (failures=1)
Crístian Viana (1):
Do not reuse names when cloning the same VM more than once at the same
time
src/kimchi/model/vms.py | 19 ++++++++++++++++---
tests/test_model.py | 22 +++++++++++++++-------
2 files changed, 31 insertions(+), 10 deletions(-)
--
2.1.0
9 years, 11 months
[PATCH] Do not reuse names when cloning the same VM more than once at the same time
by Crístian Viana
If the user tries to clone a VM while it's already being cloned, the
name of the VM being cloned may be reused because Kimchi only avoids name
conflicts by looking at the existing VMs, not the ones being created at
the moment. When the second clone operation finishes, an error is raised
because that name is already defined.
Look at the names of the VMs being cloned, as well as the existing VMs',
in order to avoid name conflicts when cloning a VM.
Signed-off-by: Crístian Viana <vianac(a)linux.vnet.ibm.com>
---
src/kimchi/model/vms.py | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
index 3aa1145..9472b1c 100644
--- a/src/kimchi/model/vms.py
+++ b/src/kimchi/model/vms.py
@@ -314,9 +314,22 @@ class VMModel(object):
if info['state'] != u'shutoff':
raise InvalidParameter('KCHVM0033E', {'name': name})
- # this name will be used as the Task's 'target_uri' so it needs to be
- # defined now.
- new_name = get_next_clone_name(self.vms.get_list(), name)
+ # the new VM's name will be used as the Task's 'target_uri' so it needs
+ # to be defined now.
+
+ vms_being_created = []
+
+ # lookup names of VMs being created right now
+ with self.objstore as session:
+ task_names = session.get_list('task')
+ for tn in task_names:
+ t = session.get('task', tn)
+ if t['target_uri'].startswith('/vms/'):
+ uri_name = t['target_uri'][5:] # 5 = len('/vms/')
+ vms_being_created.append(uri_name)
+
+ current_vm_names = self.vms.get_list() + vms_being_created
+ new_name = get_next_clone_name(current_vm_names, name)
# create a task with the actual clone function
taskid = add_task(u'/vms/%s' % new_name, self._clone_task,
--
2.1.0
9 years, 11 months
[v2] UI: Font Size, Color, Weight
by huoyuxin@linux.vnet.ibm.com
From: Yu Xin Huo <huoyuxin(a)linux.vnet.ibm.com>
Signed-off-by: Yu Xin Huo <huoyuxin(a)linux.vnet.ibm.com>
---
ui/css/theme-default/base.css | 68 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 68 insertions(+), 0 deletions(-)
create mode 100644 ui/css/theme-default/base.css
diff --git a/ui/css/theme-default/base.css b/ui/css/theme-default/base.css
new file mode 100644
index 0000000..43318e0
--- /dev/null
+++ b/ui/css/theme-default/base.css
@@ -0,0 +1,68 @@
+/*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2013-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.
+ */
+
+html, body {
+ font-family: 'Helvetica Neue', Helvetica, Arial;
+}
+
+/* header text size */
+.h1 {
+ font-size: 18px;
+}
+
+/* base content text size */
+.c1 {
+ font-size: 14px;
+}
+
+/* 1 level smaller than base text size */
+.c2 {
+ font-size: 11px;
+}
+
+/* for text on black and colored backgroud */
+.white {
+ color: #FFFFFF;
+}
+
+/* for text on disabled element */
+.light-grey {
+ color: #999999;
+}
+
+/* for sorting, filtering control */
+.grey {
+ color: #444444;
+}
+
+/* for text on white backgroud */
+.dark-grey {
+ color: #222222;
+}
+
+.bold {
+ font-weight: bold;
+}
+
+.normal {
+ font-weight: normal;
+}
+
+.light {
+ font-weight: lighter;
+}
--
1.7.1
9 years, 11 months
[PATCH] UI: Adding widget of gauge
by Wen Wang
New widget accept two options: "value" and "color". value varies from 0
to 100 and color contains "red", "blue", "yellow" and "purple".
Signed-off-by: Wen Wang <wenwang(a)linux.vnet.ibm.com>
---
ui/css/theme-default/gauge-flat.css | 45 +++++++++++++++
ui/js/widgets/gauge-flat.js | 110 ++++++++++++++++++++++++++++++++++++
2 files changed, 155 insertions(+)
create mode 100755 ui/css/theme-default/gauge-flat.css
create mode 100755 ui/js/widgets/gauge-flat.js
diff --git a/ui/css/theme-default/gauge-flat.css b/ui/css/theme-default/gauge-flat.css
new file mode 100755
index 0000000..569350e
--- /dev/null
+++ b/ui/css/theme-default/gauge-flat.css
@@ -0,0 +1,45 @@
+/*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2013-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.
+ */
+
+.ui-gauge-flat {
+ height: 15px;
+ text-align: left;
+ overflow: hidden;
+ background: #E6E7E8;
+}
+
+.ui-gauge-flat .ui-gauge-flat-value {
+ margin: -1px;
+ height: 100%;
+}
+
+.ui-gauge-flat .red {
+ background: #D9182D;
+}
+
+.ui-gauge-flat .blue {
+ background: #008ABF;
+}
+
+.ui-gauge-flat .yellow {
+ background: #FDB813;
+}
+
+.ui-gauge-flat .purple {
+ background: #7F1C7D;
+}
diff --git a/ui/js/widgets/gauge-flat.js b/ui/js/widgets/gauge-flat.js
new file mode 100755
index 0000000..7d4039b
--- /dev/null
+++ b/ui/js/widgets/gauge-flat.js
@@ -0,0 +1,110 @@
+/*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2013-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.
+ */
+
+
+(function( $ ) {
+
+return $.widget( "ui.gaugeflat", {
+ version: "@VERSION",
+ options: {
+ max: 100,
+ value: 0,
+ color: "red"
+ },
+
+ min: 0,
+
+ _create: function() {
+ this.oldValue = this.options.value = this._constrainedValue();
+
+ this.element
+ .addClass( "ui-gauge-flat ui-widget ui-widget-content ui-corner-all" )
+ .attr({
+ role: "gaugeflat",
+ "aria-valuemin": this.min
+ });
+
+ var color = this.options.color;
+
+ this.valueDiv = $( "<div class='ui-gauge-flat-value " + color + " ui-widget-header ui-corner-left'></div>" )
+ .appendTo( this.element );
+
+ this._refreshValue();
+ },
+
+ _destroy: function() {
+ this.element
+ .removeClass( "ui-gauge-flat ui-widget ui-widget-content ui-corner-all" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-valuemin" )
+ .removeAttr( "aria-valuemax" )
+ .removeAttr( "aria-valuenow" );
+
+ this.valueDiv.remove();
+ },
+
+ value: function( newValue ) {
+ if ( newValue === undefined ) {
+ return this.options.value;
+ }
+
+ this.options.value = this._constrainedValue( newValue );
+ this._refreshValue();
+ },
+
+ _constrainedValue: function( newValue ) {
+ if ( newValue === undefined ) {
+ newValue = this.options.value;
+ }
+
+ this.indeterminate = newValue === false;
+
+ if ( typeof newValue !== "number" ) {
+ newValue = 0;
+ }
+
+ return this.indeterminate ? false :
+ Math.min( this.options.max, Math.max( this.min, newValue ) );
+ },
+
+ _setOptions: function( options ) {
+ var value = options.value;
+ delete options.value;
+
+ this._super( options );
+
+ this.options.value = this._constrainedValue( value );
+ this._refreshValue();
+ },
+
+ _percentage: function() {
+ return this.indeterminate ? 100 : 100 * ( this.options.value - this.min ) / ( this.options.max - this.min );
+ },
+
+ _refreshValue: function() {
+ var value = this.options.value,
+ percentage = this._percentage();
+
+ this.valueDiv
+ .toggle( this.indeterminate || value > this.min )
+ .toggleClass( "ui-corner-right", value === this.options.max )
+ .width( percentage.toFixed(0) + "%" );
+ }
+});
+
+})(jQuery);
--
2.1.0
9 years, 11 months
[PATCH] Add vm names to delete/deactivate network error message
by Rodrigo Trujillo
This patch changes the error message returned by backend, adding the
name of virtual machines that are prohibiting the network to be removed
or deactivated. In other words, the vms linked to that network.
MSG example:
"Unable to delete network NET1. There are some virtual machines ['VM1',
'VM2', 'VM3'] and/or templates linked to this network
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
src/kimchi/i18n.py | 4 ++--
src/kimchi/model/networks.py | 10 ++++++++--
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index e3a051c..30ec89a 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -229,8 +229,8 @@ messages = {
"KCHNET0014E": _("Network interface must be a string"),
"KCHNET0015E": _("Network VLAN ID must be an integer between 1 and 4094"),
"KCHNET0016E": _("Specify name and type to create a Network"),
- "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."),
+ "KCHNET0017E": _("Unable to delete network %(name)s. There are some virtual machines %(vms)s and/or templates linked to this network."),
+ "KCHNET0018E": _("Unable to deactivate network %(name)s. There are some virtual machines %(vms)s 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."),
diff --git a/src/kimchi/model/networks.py b/src/kimchi/model/networks.py
index 1e94fd2..04783c4 100644
--- a/src/kimchi/model/networks.py
+++ b/src/kimchi/model/networks.py
@@ -313,14 +313,20 @@ class NetworkModel(object):
def deactivate(self, name):
if self._is_network_in_use(name):
- raise InvalidOperation("KCHNET0018E", {'name': name})
+ vms = self._get_vms_attach_to_a_network(name)
+ if not vms:
+ vms = ""
+ raise InvalidOperation("KCHNET0018E", {'name': name, 'vms': vms})
network = self.get_network(self.conn.get(), name)
network.destroy()
def delete(self, name):
if self._is_network_in_use(name):
- raise InvalidOperation("KCHNET0017E", {'name': name})
+ vms = self._get_vms_attach_to_a_network(name)
+ if not vms:
+ vms = ""
+ raise InvalidOperation("KCHNET0017E", {'name': name, 'vms': vms})
network = self.get_network(self.conn.get(), name)
if network.isActive():
--
1.9.3
9 years, 11 months
Re: [Kimchi-devel] [PATCH] <Fix problems of edit a guest containssnapshots>
by Zongmei Gou
Hi,Crístian
I've read your patch, which has solved the snapshots restore problems more clearly. I agree with you that we've already fixed this issue in separate patches, and I need to make some changes for the formatting issues and test case.
My patch will be responsible for the url redirect problem, which modifies base.py and function 'revert' in vmsnapshots.py.
Besides, I found there are two points need to pay attention to:
1. snap.listAllChildren() in _backup_snapshots.py need flag in older libvirt versions, as I used "0.10.2", it raised "listAllChildren() takes exactly 2 arguments (1 given)"
2. UI transfer param 'name' no matter you update vm name or not (of course while you edit a vm), so do we only need to bakup and restore the snapshots while vm name is really updated ?
Best regards,
Zongmei Gou
9 years, 11 months
[feature] Network device type selection
by Rodrigo Trujillo
Hi,
I would like to hear from the community if this feature is interesting
or not ?
Currently, Kimchi allows add new network interfaces to guests, but it
does not allow
to choose the device type (e1000, rtl8139, virtio, etc).
I wonder if community has planned to support this.
I understand that Kimchi aims to facilitate user's life, selecting the
best configuration.
Regards,
Rodrigo Trujillo
9 years, 11 months