[PATCH] network improvment: add vms field
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
Add vms field for network GET method
update API.md
add a function to get all vms attach to a network
update model
add vms field for Network Resource property
update controller
Now get the info of default network:
$ curl -u <user>:<password> -H 'Content-type: application/json' -H 'Accept:
application/json' -X GET http://localhost:8000/networks/default
{
"subnet":"192.168.122.0/24",
"connection":"nat",
"name":"default",
"autostart":true,
"state":"active",
"interface":"virbr0",
"dhcp":{
"start":"192.168.122.2",
"end":"192.168.122.254"
},
"vms":[
"rhel6",
"opensuse12"
]
}
we can see, there are two vms attched to this network
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
docs/API.md | 1 +
src/kimchi/controller.py | 1 +
src/kimchi/model.py | 15 +++++++++++++++
3 files changed, 17 insertions(+)
diff --git a/docs/API.md b/docs/API.md
index 9edc551..a3e6c8a 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -348,6 +348,7 @@ A interface represents available interface on host.
* active: The Network is ready for use
* inactive: The Network is not available
* autostart: Network autostart onboot
+ * vms: all vms attached to this network
* subnet: Network segment in slash-separated format with ip address and prefix
* dhcp: DHCP services on the virtual network is enabled.
* start: start boundary of a pool of addresses to be provided to DHCP clients.
diff --git a/src/kimchi/controller.py b/src/kimchi/controller.py
index 2940278..63b0820 100644
--- a/src/kimchi/controller.py
+++ b/src/kimchi/controller.py
@@ -459,6 +459,7 @@ class Network(Resource):
@property
def data(self):
return {'name': self.ident,
+ 'vms': self.info['vms'],
'autostart': self.info['autostart'],
'connection': self.info['connection'],
'interface': self.info['interface'],
diff --git a/src/kimchi/model.py b/src/kimchi/model.py
index a6790b8..015eb46 100644
--- a/src/kimchi/model.py
+++ b/src/kimchi/model.py
@@ -546,6 +546,11 @@ class Model(object):
xpath = "/domain/devices/disk[@device='disk']/source/@file"
return xmlutils.xpath_get_text(xml, xpath)
+ def _vm_get_networks(self, dom):
+ xml = dom.XMLDesc(0)
+ xpath = "/domain/devices/interface[@type='network']/source/@network"
+ return xmlutils.xpath_get_text(xml, xpath)
+
def vm_delete(self, name):
if self._vm_exists(name):
conn = self.conn.get()
@@ -844,6 +849,15 @@ class Model(object):
conn = self.conn.get()
return sorted(conn.listNetworks() + conn.listDefinedNetworks())
+ def _get_vms_attach_to_a_network(self, network):
+ vms = []
+ conn = self.conn.get()
+ for dom in conn.listAllDomains():
+ networks = self._vm_get_networks(dom)
+ if network in networks:
+ vms.append(dom.name())
+ return vms
+
def network_lookup(self, name):
network = self._get_network(name)
xml = network.XMLDesc(0)
@@ -872,6 +886,7 @@ class Model(object):
'interface': interface,
'subnet': subnet,
'dhcp': dhcp,
+ 'vms': self._get_vms_attach_to_a_network(name),
'autostart': network.autostart() == 1,
'state': network.isActive() and "active" or "inactive"}
--
1.8.4.2
10 years, 11 months
[RESEND PATCH V5 0/1] Open 8000 and 8001 port by default for distro packages
by taget@linux.vnet.ibm.com
From: Eli Qiao <taget(a)linux.vnet.ibm.com>
V5 - V4 changes:
1. Add cover-letter. (Aline)
2. Move clean up rules into if condition. (Aline)
3. Use with_systemd condition to check if use firewalld rules. (Aline)
4. Fix typo (Aline)
V4 - V3 changes:
1 Fix typo in firewalld.xml (Rodrigo)
V3 - V2 changes:
1.Rename kimchid.xml to firewalld.xml (Mark)
2.Remove firewalld from serivce require (Mark)
3.Fix typo
V2 - V1 changes:
1.Add firewalld sevice configure file kimchid.xml to help open iptables port (Mark)
2.Add Ubuntu iptables rule (Royce)
Eli Qiao (1):
spec: Open 8000 and 8001 port by default
contrib/DEBIAN/control.in | 3 ++-
contrib/DEBIAN/postinst | 2 ++
contrib/DEBIAN/postrm | 2 ++
contrib/kimchi.spec.fedora.in | 24 +++++++++++++++++++++---
contrib/kimchi.spec.suse.in | 10 ++++++++--
src/Makefile.am | 1 +
src/firewalld.xml | 7 +++++++
7 files changed, 43 insertions(+), 6 deletions(-)
create mode 100644 src/firewalld.xml
10 years, 11 months
[project-kimchi][PATCHv4 0/5] Storage server query support
by lvroyce@linux.vnet.ibm.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
v3>v4, fix inconsistency between doc and json schema
v1>v3, fix racing problem, fix style.
Add parameters to GET request so that we will query storage server as:
/storageservers?type=netfs
Royce Lv (5):
Support params for GET method
Add testcase for GET param
Storage server: Update API.md
storage server: update controller.py
storage server: Update model and mockmodel
docs/API.md | 13 +++++++++++++
src/kimchi/API.json | 11 +++++++++++
src/kimchi/controller.py | 26 ++++++++++++++++++++++++--
src/kimchi/mockmodel.py | 13 +++++++++++++
src/kimchi/model.py | 14 +++++++++++++-
src/kimchi/root.py | 1 +
tests/test_rest.py | 37 +++++++++++++++++++++++++++++++++++++
7 files changed, 112 insertions(+), 3 deletions(-)
--
1.8.1.2
10 years, 11 months
[Patch v2 1/4] Move configuration parsing to config.py
by Mark Wu
The configruation is also needed for other code except starting kimchi
server. So it should be moved to a separate module, config.py. Then the
configuration can be accessed directly by importing config module.
Signed-off-by: Mark Wu <wudxw(a)linux.vnet.ibm.com>
---
src/kimchi/config.py.in | 23 ++++++++++++++++++++---
src/kimchid.in | 20 +-------------------
2 files changed, 21 insertions(+), 22 deletions(-)
diff --git a/src/kimchi/config.py.in b/src/kimchi/config.py.in
index f3c408a..49d42db 100644
--- a/src/kimchi/config.py.in
+++ b/src/kimchi/config.py.in
@@ -25,11 +25,9 @@
import libvirt
import os
import platform
-
-
+from ConfigParser import SafeConfigParser
from glob import iglob
-
from kimchi.xmlutils import xpath_get_text
@@ -166,5 +164,24 @@ def get_plugin_tab_xml(name):
return os.path.join(_get_plugin_ui_dir(name), 'config/tab-ext.xml')
+CONFIG_FILE = "%s/kimchi.conf" % get_config_dir()
+DEFAULT_LOG_LEVEL = "debug"
+
+config = SafeConfigParser()
+config.add_section("server")
+config.set("server", "host", "0.0.0.0")
+config.set("server", "port", "8000")
+config.set("server", "ssl_port", "8001")
+config.set("server", "ssl_cert", "")
+config.set("server", "ssl_key", "")
+config.set("server", "environment", "development")
+config.add_section("logging")
+config.set("logging", "log_dir", get_default_log_dir())
+config.set("logging", "log_level", DEFAULT_LOG_LEVEL)
+
+if os.path.exists(CONFIG_FILE):
+ config.read(CONFIG_FILE)
+
+
if __name__ == '__main__':
print get_prefix()
diff --git a/src/kimchid.in b/src/kimchid.in
index 7865713..548fa52 100644
--- a/src/kimchid.in
+++ b/src/kimchid.in
@@ -33,31 +33,13 @@ import kimchi.config
if kimchi.config.without_installation():
sys.path.append(kimchi.config.get_prefix())
-from ConfigParser import SafeConfigParser
+from kimchi.config import config
from optparse import OptionParser
ACCESS_LOG = "kimchi-access.log"
ERROR_LOG = "kimchi-error.log"
-CONFIG_FILE = "%s/kimchi.conf" % kimchi.config.get_config_dir()
-DEFAULT_LOG_DIR = kimchi.config.get_default_log_dir()
-DEFAULT_LOG_LEVEL = "debug"
def main(options):
- config = SafeConfigParser()
- config.add_section("server")
- config.set("server", "host", "0.0.0.0")
- config.set("server", "port", "8000")
- config.set("server", "ssl_port", "8001")
- config.set("server", "ssl_cert", "")
- config.set("server", "ssl_key", "")
- config.set("server", "environment", "development")
- config.add_section("logging")
- config.set("logging", "log_dir", DEFAULT_LOG_DIR)
- config.set("logging", "log_level", DEFAULT_LOG_LEVEL)
-
- if os.path.exists(CONFIG_FILE):
- config.read(CONFIG_FILE)
-
host = config.get("server", "host")
port = config.get("server", "port")
ssl_port = config.get("server", "ssl_port")
--
1.8.3.1
10 years, 11 months
[PATCH] Issue #293: Resizing Issue When There Are Multiple Grids
by Hongliang Wang
Resizing function corrupts when there are more than one kimchi.widget.Grid
instances in a page.
Signed-off-by: Hongliang Wang <hlwang(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.grid.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/ui/js/src/kimchi.grid.js b/ui/js/src/kimchi.grid.js
index 6e5f1fe..022c4f5 100644
--- a/ui/js/src/kimchi.grid.js
+++ b/ui/js/src/kimchi.grid.js
@@ -308,6 +308,7 @@ kimchi.widget.Grid = function(params) {
left - leftmostOffset
);
fixTableLayout();
+ columnBeingResized = null;
};
var resizeColumnWidth = function(index, width) {
--
1.8.1.4
10 years, 11 months
[PATCHv2 0/3] Storage targets support
by lvroyce@linux.vnet.ibm.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
v1>v2, when showmount got no result, instead of fail the request,
return empty list to user.
NOTE: this patchset depends on storage server support patchset.
Tested in Fedora 19, due to libvirt bug, ubuntu 13.10 cannot be tested, fixing.
Usage:
GET /storageservers/<ip or hostname>/storagetargets?target_type=netfs
Royce Lv (3):
storage target: Update API.md
storage target: Update controller and json schema
storage target: Add model support
docs/API.md | 9 +++++++++
src/kimchi/API.json | 11 +++++++++++
src/kimchi/controller.py | 30 ++++++++++++++++++++++++++++--
src/kimchi/model.py | 40 ++++++++++++++++++++++++++++++++++++++++
4 files changed, 88 insertions(+), 2 deletions(-)
--
1.8.1.2
10 years, 11 months
[PATCH v4 0/5] Support Creating iSCSI storage pool
by Zhou Zheng Sheng
This patch series is about creating iSCSI storage pool.
After this patch, you can create an ISCSI storage pool as the following.
curl -u root -H 'Content-type: application/json' \
-H 'Accept: application/json' \
-d '{"source": {
"target": "iqn.2013-01.example.com.targetname",
"host": "192.168.X.X",
"port": 326X,
"auth": {"username": "testUser", "password": "123456"}},
"type": "iscsi",
"name": "testIscsiPool"}' \
http://127.0.0.1:8000/storagepools
Note the "port" and "auth" is optional.
Thanks the reviewers. I took most of reviewer advices and submit this
v4 patch series.
Tested the patch over LIO iSCSI target and libvirt-1.1.4-1.fc19.
http://linux-iscsi.org/wiki/ISCSI
v3 -> v4
storagepool: refactor _get_pool_xml()
Change StoragePoolDef.get_xml() into a cached property
StoragePoolDef.xml.
storagepool: rename and consolidate arguments of creating (front end)
No change.
storagepool: rename and consolidate arguments of creating (back end)
Update src/kimchi/API.json
storagepool: Support Creating iSCSI storagepool in model.py
Fix typo.
Give the iscsiadm wrapper class a friendly name TargetClient.
Update API.json.
Update RPM spec files and Debian control file.
iscsi.validate_iscsi_target() is now TargetClient.validate().
test_model: test creating iSCSI storage pool
Since the parent patch changed interface, the tests also change to
use StoragePoolDef.xml and TargetClient.validate(), no other change.
Zhou Zheng Sheng (5):
storagepool: refactor _get_pool_xml()
storagepool: rename and consolidate arguments of creating (back end)
storagepool: rename and consolidate arguments of creating (front end)
storagepool: Support Creating iSCSI storagepool in model.py
test_model: test creating iSCSI storage pool
Makefile.am | 2 +
contrib/DEBIAN/control.in | 3 +-
contrib/kimchi.spec.fedora.in | 1 +
contrib/kimchi.spec.suse.in | 1 +
docs/API.md | 28 ++--
src/kimchi/API.json | 69 ++++++++++
src/kimchi/Makefile.am | 1 +
src/kimchi/iscsi.py | 89 ++++++++++++
src/kimchi/model.py | 227 +++++++++++++++++++++++++------
tests/Makefile.am | 1 +
tests/test_model.py | 89 ++++++------
tests/test_storagepool.py | 156 +++++++++++++++++++++
ui/js/src/kimchi.storagepool_add_main.js | 13 +-
13 files changed, 590 insertions(+), 90 deletions(-)
create mode 100644 src/kimchi/iscsi.py
create mode 100644 tests/test_storagepool.py
--
1.7.11.7
10 years, 11 months
[PATCH V5 0/7] template supports networks
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
V4 -> V5:
rebase to the latest commit.
for "move RollbackContext..." merged.
V3 -> V4:
after template supports networks, we should change the test case accordingly
aline refactor controller, rebase to the latest commit.
V2 -> V3:
fix typo.
support creating a vm without network.
V1 -> V2:
update mockmodel and test case
add 'networks' option for template get/create/update
ShaoHe Feng (7):
template supports networks: let template xml support more networks
template supports networks: fix test case
template supports networks: update API
template supports networks: update controller and json schema
template supports networks: update model
template supports networks: update mockmodel
template supports networks: update test case
docs/API.md | 4 ++
src/kimchi/API.json | 12 ++++++
src/kimchi/control/templates.py | 3 +-
src/kimchi/mockmodel.py | 7 +++-
src/kimchi/model.py | 25 ++++++++-----
src/kimchi/osinfo.py | 5 ++-
src/kimchi/vmtemplate.py | 20 ++++++++--
tests/test_model.py | 82 ++++++++++++++++++++++++++++++++---------
tests/test_osinfo.py | 2 +-
tests/test_rest.py | 56 ++++++++++++++++++++++++++++
tests/test_vmtemplate.py | 6 +--
11 files changed, 182 insertions(+), 40 deletions(-)
--
1.8.4.2
10 years, 11 months
[PATCH V2 0/2] move RollbackContext from tests/utils to src/kimchi/rollbackcontext
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
V1 -> V2:
rebase
ShaoHe Feng (2):
move RollbackContext from tests/utils to src/kimchi/rollbackcontext
touch 4 files when move RollbackContext, fix pep8 on them
Makefile.am | 10 ++--
src/kimchi/Makefile.am | 59 +++++++++++------------
src/kimchi/rollbackcontext.py | 71 +++++++++++++++++++++++++++
tests/test_model.py | 108 +++++++++++++++++++++++++-----------------
tests/test_rest.py | 73 +++++++++++++++-------------
tests/utils.py | 59 ++++-------------------
6 files changed, 224 insertions(+), 156 deletions(-)
create mode 100644 src/kimchi/rollbackcontext.py
--
1.8.4.2
10 years, 12 months
[PATCH V4 0/7] template supports networks
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
V3 -> V4:
after template supports networks, we should change the test case accordingly
aline refactor controller, rebase on the latest commit.
V2 -> V3:
fix typo.
support creating a vm without network.
V1 -> V2:
update mockmodel and test case
add 'networks' option for template get/create/update
ShaoHe Feng (7):
template supports networks: let template xml support more networks
template supports networks: fix test case
template supports networks: update API
template supports networks: update controller and json schema
template supports networks: update model
template supports networks: update mockmodel
template supports networks: update test case
docs/API.md | 4 ++
src/kimchi/API.json | 12 ++++++
src/kimchi/control/templates.py | 3 +-
src/kimchi/mockmodel.py | 7 +++-
src/kimchi/model.py | 25 +++++++-----
src/kimchi/osinfo.py | 5 ++-
src/kimchi/vmtemplate.py | 20 ++++++++--
tests/test_model.py | 86 ++++++++++++++++++++++++++++++++---------
tests/test_osinfo.py | 2 +-
tests/test_rest.py | 56 +++++++++++++++++++++++++++
tests/test_vmtemplate.py | 6 +--
11 files changed, 185 insertions(+), 41 deletions(-)
--
1.8.4.2
10 years, 12 months