[PATCH] Choose available address for ide disk
by lvroyce@linux.vnet.ibm.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
Tested:
1.make check
2.adding more than 4 cdroms report error
3.less than 4 cdroms successful boot and see all cdroms.
4.When a vm does not have cdrom, adding succeed.
Now when just pass source and target type, bus information,
libvirt may generate another controller for ide disk appending,
this will be conflict with libvirt's limitation of 1 ide controller.
This patch choose available bus_id and unit_id for ide disk
to make sure we can reach the limit of 4 cdroms per vm.
Signed-off-by: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
---
src/kimchi/i18n.py | 1 +
src/kimchi/model/vmstorages.py | 56 +++++++++++++++++++++++++++++++-----------
2 files changed, 43 insertions(+), 14 deletions(-)
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index 86ab5d6..4ca83d9 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -230,6 +230,7 @@ messages = {
"KCHCDROM0011E": _("Do not support guest CDROM hot plug attachment"),
"KCHCDROM0012E": _("Specify type and path to add a new virtual machine disk"),
"KCHCDROM0013E": _("Specify path to update virtual machine disk"),
+ "KCHCDROM0014E": _("Controller type %(type)s limitation %(limit)s reached"),
"KCHREPOS0001E": _("YUM Repository ID must be one word only string."),
"KCHREPOS0002E": _("Repository URL must be an http://, ftp:// or file:// URL."),
diff --git a/src/kimchi/model/vmstorages.py b/src/kimchi/model/vmstorages.py
index 3b5f99e..b3f22db 100644
--- a/src/kimchi/model/vmstorages.py
+++ b/src/kimchi/model/vmstorages.py
@@ -37,6 +37,16 @@ DEV_TYPE_SRC_ATTR_MAP = {'file': 'file',
'block': 'dev'}
+def _get_device_xml(dom, dev_name):
+ # Get VM xml and then devices xml
+ xml = dom.XMLDesc(0)
+ devices = objectify.fromstring(xml).devices
+ disk = devices.xpath("./disk/target[@dev='%s']/.." % dev_name)
+ if not disk:
+ return None
+ return disk[0]
+
+
def _get_storage_xml(params):
src_type = params.get('src_type')
disk = E.disk(type=src_type, device=params.get('type'))
@@ -56,6 +66,12 @@ def _get_storage_xml(params):
disk.append(source)
disk.append(E.target(dev=params.get('dev'), bus=params.get('bus', 'ide')))
+ if params.get('address'):
+ print params['address']
+ disk.append(E.address(
+ type='drive', controller=params['address']['controller'],
+ bus=params['address']['bus'], target='0',
+ unit=params['address']['unit']))
return ET.tostring(disk)
@@ -89,6 +105,27 @@ class VMStoragesModel(object):
def __init__(self, **kargs):
self.conn = kargs['conn']
+ def _get_available_ide_address(self, vm_name):
+ dom = VMModel.get_vm(vm_name, self.conn)
+ disks = self.get_list(vm_name)
+ valid_id = [('0', '0'), ('0', '1'), ('1', '0'), ('1', '1')]
+ controller_id = '0'
+ for dev_name in disks:
+ disk = _get_device_xml(dom, dev_name)
+ if disk.target.attrib['bus'] == 'ide':
+ controller_id = disk.address.attrib['controller']
+ bus_id = disk.address.attrib['bus']
+ unit_id = disk.address.attrib['unit']
+ if (bus_id, unit_id) in valid_id:
+ valid_id.remove((bus_id, unit_id))
+ continue
+ if not valid_id:
+ raise OperationFailed('KCHCDROM0014E', {'type': 'ide', 'limit': 4})
+ else:
+ address = {'controller': controller_id,
+ 'bus': valid_id[0][0], 'unit': valid_id[0][1]}
+ return dict(address=address)
+
def create(self, vm_name, params):
dom = VMModel.get_vm(vm_name, self.conn)
if DOM_STATE_MAP[dom.info()[0]] != 'shutoff':
@@ -109,8 +146,7 @@ class VMStoragesModel(object):
path = params['path']
params['src_type'] = _check_cdrom_path(path)
- # Check if path is an url
-
+ params.update(self._get_available_ide_address(vm_name))
# Add device to VM
dev_xml = _get_storage_xml(params)
try:
@@ -147,19 +183,10 @@ class VMStorageModel(object):
def __init__(self, **kargs):
self.conn = kargs['conn']
- def _get_device_xml(self, vm_name, dev_name):
- # Get VM xml and then devices xml
- dom = VMModel.get_vm(vm_name, self.conn)
- xml = dom.XMLDesc(0)
- devices = objectify.fromstring(xml).devices
- disk = devices.xpath("./disk/target[@dev='%s']/.." % dev_name)
- if not disk:
- return None
- return disk[0]
-
def lookup(self, vm_name, dev_name):
# Retrieve disk xml and format return dict
- disk = self._get_device_xml(vm_name, dev_name)
+ dom = VMModel.get_vm(vm_name, self.conn)
+ disk = _get_device_xml(dom, dev_name)
if disk is None:
raise NotFoundError("KCHCDROM0007E", {'dev_name': dev_name,
'vm_name': vm_name})
@@ -188,7 +215,8 @@ class VMStorageModel(object):
def delete(self, vm_name, dev_name):
# Get storage device xml
- disk = self._get_device_xml(vm_name, dev_name)
+ dom = VMModel.get_vm(vm_name, self.conn)
+ disk = _get_device_xml(dom, dev_name)
if disk is None:
raise NotFoundError("KCHCDROM0007E",
{'dev_name': dev_name,
--
1.8.3.2
10 years, 8 months
[PATCH] Fix pyparted dependency problem
by lvroyce@linux.vnet.ibm.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
On opensuse, libvirt and python-parted depend on same lib
of different versions, working this problem around
by using parted command instead of python-parted library.
Signed-off-by: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
---
docs/README.md | 6 +++---
src/kimchi/disks.py | 49 +++++++++++++++++++++++++++++++++++--------------
2 files changed, 38 insertions(+), 17 deletions(-)
diff --git a/docs/README.md b/docs/README.md
index 8b8b181..a3e1403 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -53,7 +53,7 @@ Install Dependencies
PyPAM m2crypto python-jsonschema rpm-build \
qemu-kvm python-psutil python-ethtool sos \
python-ipaddr python-lxml nfs-utils \
- iscsi-initiator-utils libxslt pyparted
+ iscsi-initiator-utils libxslt
# If using RHEL6, install the following additional packages:
$ sudo yum install python-unittest2 python-ordereddict
# Restart libvirt to allow configuration changes to take effect
@@ -75,7 +75,7 @@ for more information on how to configure your system to access this repository.
python-pam python-m2crypto python-jsonschema \
qemu-kvm libtool python-psutil python-ethtool \
sosreport python-ipaddr python-lxml nfs-common \
- open-iscsi lvm2 xsltproc python-parted
+ open-iscsi lvm2 xsltproc
Packages version requirement:
python-jsonschema >= 1.3.0
@@ -89,7 +89,7 @@ for more information on how to configure your system to access this repository.
python-pam python-M2Crypto python-jsonschema \
rpm-build kvm python-psutil python-ethtool \
python-ipaddr python-lxml nfs-client open-iscsi \
- libxslt-tools python-xml python-parted
+ libxslt-tools python-xml
Packages version requirement:
python-psutil >= 0.6.0
diff --git a/src/kimchi/disks.py b/src/kimchi/disks.py
index 5f004b3..1611459 100644
--- a/src/kimchi/disks.py
+++ b/src/kimchi/disks.py
@@ -20,11 +20,8 @@
import re
import subprocess
-from parted import Device as PDevice
-from parted import Disk as PDisk
-
from kimchi.exception import OperationFailed
-from kimchi.utils import kimchi_log
+from kimchi.utils import kimchi_log, run_command, parse_cmd_output
def _get_friendly_dm_path(maj_min):
@@ -92,15 +89,19 @@ def _is_dev_leaf(devNodePath):
return childrenCount == 0
-def _is_dev_extended_partition(devType, devNodePath):
- if devType != 'part':
- return False
- diskPath = devNodePath.rstrip('0123456789')
- device = PDevice(diskPath)
- extended_part = PDisk(device).getExtendedPartition()
- if extended_part and extended_part.path == devNodePath:
- return True
- return False
+def _get_disks():
+ disks = list()
+ output, error, returncode = run_command(['lsblk', '--nodeps'])
+ if returncode != 0:
+ raise OperationFailed('Cannot retrieve block info')
+
+ targets = parse_cmd_output(output,
+ output_items=['name', 'magic', 'rm', 'size', 'ro', 'type'])
+ for target in targets:
+ if target['type'] == 'disk':
+ disks.append('/dev/%s' % target['name'])
+
+ return disks
def _parse_lsblk_output(output, keys):
@@ -134,11 +135,31 @@ def _get_vgname(devNodePath):
return re.findall(r"LVM2_VG_NAME='([^\']*)'", out)[0]
+def _get_extended_partitions():
+ disks = _get_disks()
+ extended_parts = list()
+
+ for disk in disks:
+ output, error, returncode = run_command(['parted', disk, 'print'])
+ if returncode != 0:
+ kimchi_log.error('Cannot get partition info of %s', disk)
+
+ outs = output.partition('File system Flags')
+ partitions = parse_cmd_output(outs[2],
+ output_items=['number', 'start', 'end', 'size', 'type', 'fs', 'flags'])
+ for partition in partitions:
+ if partition['type'] == 'extended':
+ extended_parts.append('%s%s' % (disk.lstrip('/dev/'), partition['number']))
+
+ return extended_parts
+
+
def get_partitions_names():
names = set()
keys = ["NAME", "TYPE", "FSTYPE", "MOUNTPOINT", "MAJ:MIN"]
# output is on format key="value",
# where key can be NAME, TYPE, FSTYPE, MOUNTPOINT
+ extended_parts = _get_extended_partitions()
for dev in _get_lsblk_devs(keys):
# split()[0] to avoid the second part of the name, after the
# whiteline
@@ -153,7 +174,7 @@ def get_partitions_names():
dev['mountpoint'] == "" and
_get_vgname(devNodePath) == "" and
_is_dev_leaf(devNodePath) and
- not _is_dev_extended_partition(dev['type'], devNodePath)):
+ name not in extended_parts):
continue
names.add(name)
--
1.8.3.2
10 years, 8 months
[PATCH V2 0/2]
by Rodrigo Trujillo
V2
- Address Aline's comments
- Creates rest API function to retrieve specific storage volume
V1
- Show storagepool + volume name correctly in storagepool field after
saving
- Show disk size according to storagepool or storagepool/volume selected
- Block disk size input box when disk is type volume (iscsi/scsi volumes
cannot be changed)
Rodrigo Trujillo (2):
Issue #363: Add new rest api function - getStoragePoolVolume
Issue #363: Fix data/information consistence in edit template window
ui/js/src/kimchi.api.js | 13 +++++++++++++
ui/js/src/kimchi.template_edit_main.js | 33 +++++++++++++++++++++++++++++++--
2 files changed, 44 insertions(+), 2 deletions(-)
--
1.8.5.3
10 years, 8 months
[PATCH] [UI] Software Update: Make Update Progress Area Collapsible
by Hongliang Wang
Take advantage of jQuery UI to make update progress area collapsible.
Signed-off-by: Hongliang Wang <hlwang(a)linux.vnet.ibm.com>
---
ui/css/theme-default/host.css | 4 +++-
ui/js/src/kimchi.host.js | 3 +++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/ui/css/theme-default/host.css b/ui/css/theme-default/host.css
index 0f8b941..e1e83ee 100644
--- a/ui/css/theme-default/host.css
+++ b/ui/css/theme-default/host.css
@@ -248,8 +248,10 @@
.host-panel #software-updates-progress-textarea {
border: 1px solid #ddd;
+ box-sizing: border-box;
height: 100px;
+ padding: .2em .5em;
resize: vertical;
- width: 846px;
+ width: 852px;
}
/* End of Software Updates */
diff --git a/ui/js/src/kimchi.host.js b/ui/js/src/kimchi.host.js
index 6300f37..f9696ea 100644
--- a/ui/js/src/kimchi.host.js
+++ b/ui/js/src/kimchi.host.js
@@ -276,6 +276,9 @@ kimchi.host_main = function() {
initSoftwareUpdatesGrid();
kimchi.topic('kimchi/softwareUpdated')
.subscribe(listSoftwareUpdates);
+ $('#software-updates-progress-container').accordion({
+ collapsible: true
+ });
}
if(capabilities['system_report_tool']) {
--
1.8.1.4
10 years, 8 months
[PATCH 1/3] UI: add a api to get an storagevolume info
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
Now we have support scsi/iscsi pool in template.
We need to shoe some infomation of the storagevolume of scsi/iscsi pool
in template edit page.
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.api.js | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
index 0c5c790..9f722cd 100644
--- a/ui/js/src/kimchi.api.js
+++ b/ui/js/src/kimchi.api.js
@@ -381,6 +381,18 @@ var kimchi = {
});
},
+ listStorageVolume : function(poolName, volumeName, suc, err) {
+ $.ajax({
+ url : kimchi.url + 'storagepools/' + encodeURIComponent(poolName) + '/storagevolumes/' + encodeURIComponent(volumeName),
+ // url : kimchi.url + 'storagepools/' + encodeURIComponent(poolName) + '/storagevolumes/' + volumeName,
+ type : 'GET',
+ contentType : 'application/json',
+ dataType : 'json',
+ success : suc,
+ error : err
+ });
+ },
+
listIsos : function(suc, err) {
kimchi.requestJSON({
url : kimchi.url + 'storagepools/kimchi_isos/storagevolumes',
--
1.8.5.3
10 years, 8 months
[PATCH] Set virt_use_nfs when NFS pool is added.
by Christy Perez
selinux has a special boolean to make it easier for disk images
to be managedi by libvirt. Set this to true when a user
adds an NFS storage pool.
Most virtualzation documentation recommends that this be set
to true. For example:
http://www.ovirt.org/Troubleshooting_NFS_Storage_Issues
http://fedoraproject.org/wiki/How_to_debug_Virtualization_problems
This will leave it set to true, even if
the user removes NFS storage pools. It is not a security risk, and
we should not set it to False in case it had already been set by the
user for another non-kimchi use.
Signed-off-by: Christy Perez <christy(a)linux.vnet.ibm.com>
---
src/kimchi/model/storagepools.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/kimchi/model/storagepools.py b/src/kimchi/model/storagepools.py
index 5af33b7..1ec6e99 100644
--- a/src/kimchi/model/storagepools.py
+++ b/src/kimchi/model/storagepools.py
@@ -126,6 +126,13 @@ class StoragePoolsModel(object):
kimchi_log.error("Problem creating Storage Pool: %s", e)
raise OperationFailed("KCHPOOL0007E",
{'name': name, 'err': e.get_error_message()})
+ if params['type'] == 'netfs':
+ output, error, returncode = run_command(['setsebool', '-P',
+ 'virt_use_nfs=1'])
+ if error or returncode:
+ kimchi_log.error('Unable to set virt_use_nfs=1. If you use
+ SELinux, this may prevent NFS pools from
+ being used.')
return name
def _clean_scan(self, pool_name):
--
1.9.0
10 years, 8 months
[PATCH] Set virt_use_nfs when NFS pool is added.
by Christy Perez
selinux has a special boolean to make it easier for disk images
to be stored on a remote NFS server. Set this to true when a user
adds an NFS storage pool.
Most virtualzation documentation recommends that this be set
to true. For example:
http://www.ovirt.org/Troubleshooting_NFS_Storage_Issues
http://fedoraproject.org/wiki/How_to_debug_Virtualization_problems
This will leave it set to true, even if
the user removes NFS storage pools. It is not a security risk, and
we should not set it to False in case it had already been set by the
user for another non-kimchi use.
Signed-off-by: Christy Perez <christy(a)linux.vnet.ibm.com>
---
src/kimchi/i18n.py | 2 ++
src/kimchi/model/storagepools.py | 5 +++++
2 files changed, 7 insertions(+)
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index d45f607..8ade7d7 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -144,6 +144,8 @@ messages = {
"KCHPOOL0034E": _("Unable to deactivate pool %(name)s as it is associated with some templates"),
"KCHPOOL0035E": _("Unable to delete pool %(name)s as it is associated with some templates"),
"KCHPOOL0036E": _("A volume group named '%(name)s' already exists. Please, choose another name to create the logical pool."),
+ "KCHPOOL0037E": _("Unable to set selinux bool virt_use_nfs for NFS pool usage. Depending on \
+ your NFS config, this may prevent the pool from being used."),
"KCHVOL0001E": _("Storage volume %(name)s already exists"),
"KCHVOL0002E": _("Storage volume %(name)s does not exist in storage pool %(pool)s"),
diff --git a/src/kimchi/model/storagepools.py b/src/kimchi/model/storagepools.py
index 92b2496..d279ffa 100644
--- a/src/kimchi/model/storagepools.py
+++ b/src/kimchi/model/storagepools.py
@@ -126,6 +126,11 @@ class StoragePoolsModel(object):
kimchi_log.error("Problem creating Storage Pool: %s", e)
raise OperationFailed("KCHPOOL0007E",
{'name': name, 'err': e.get_error_message()})
+ if params['type'] == 'netfs':
+ output, error, returncode = run_command(['setsebool', '-P',
+ 'virt_use_nfs=1'])
+ if error or returncode:
+ kimchi_log.error('KCHPOOL0037E')
return name
def _clean_scan(self, pool_name):
--
1.8.5.3
10 years, 8 months
[PATCH 0/3] VM Edit CPU/Memory
by Rodrigo Trujillo
This patch set implements backend side of feature "Edit VM CPU/Memory".
You can use curl to test:
curl -X PUT -u <USER> -H 'Content-type: application/json'
-H 'Accept: application/json' http://localhost:8000/vms/<VM_NAME>
-d '{ "cpus": <NUM>, "memory": <NUM>}'
Rodrigo Trujillo (3):
VM Edit CPU/Memory: (Backend) Changes API.md, API.json and i18n.py
VM Edit CPU/Memory: (Backend) Changes VM control and model
VM Edit CPU/Memory: (Backend) Changes mockmodel and tests
docs/API.md | 3 +++
src/kimchi/API.json | 12 ++++++++++++
src/kimchi/control/vms.py | 4 ++--
src/kimchi/i18n.py | 3 ++-
src/kimchi/mockmodel.py | 30 +++++++++++++++++-------------
src/kimchi/model/vms.py | 43 +++++++++++++++++++++++++++----------------
tests/test_mockmodel.py | 5 +++--
tests/test_model.py | 25 ++++++++++++++++++++-----
tests/test_rest.py | 32 +++++++++++++++++++++++++++++---
9 files changed, 115 insertions(+), 42 deletions(-)
--
1.8.5.3
10 years, 8 months
[PATCH] Packaging: Discover and Build Plugins Automatically
by zhshzhou@linux.vnet.ibm.com
From: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
Though Kimchi can automatically discover and load plugin Python modules
when kimchid starts, the packaging subsystem is not as smart. Downstream
plugin developers have to insert entries in Kimchi configure.ac and
contrib/kimchi.spec.*.in to compile and package plugin files. This is
not scalable.
This patch proposes a mechanism to make packaging scripts smarter to
discover and build plugins dynamically, so that the plugin code is
actually "plugable" to the packaging subsystem. The plugin developer
just places the pluginX code to plugins/pluginX, then uses
"./autogen.sh --with-plugins=pluginX" to generate the packaging scripts
for pluginX. We no longer have to change upstream Kimchi configure.ac,
Makefile.am and kimchi.spec.*.in.
To compile with plugins, use the following command.
./autogen.sh --with-plugins=plugin1,plugin2,... && make
To build kimchi-plugin1.rpm, kimchi-plugin2.rpm and kimchi.rpm, use the
following command.
./autogen.sh --system --with-plugins=plugin1,plugin2 && make && make rpm
To build only kimchi.rpm, use the following command
./autogen.sh --system && make && make rpm
This patch makes use of the "include" functions in autoconf and RPM
spec. The basic idea is that each plugin provides two files as follow.
plugins/PLUGIN_NAME/configure.m4
plugins/PLUGIN_NAME/plugin.spec
Then autogen.sh catenates all plugins/{enabled_plugins}/configure.m4
into one big plugins/plugins.m4. In configure.ac, it includes
plugins/plugins.m4. When we invoke "make rpm", the Makefil scripts does
the similar catenation of plugins/{enabled_plugins}/plugin.spec into
plugins/plugins.spec, and have kimchi.spec include this file.
Since the Debian packaging system is a different story, future patches
shall be submitted to make Kimchi deb packaging code plugable.
Signed-off-by: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
---
.gitignore | 2 ++
Makefile.am | 14 ++++++++------
autogen.sh | 13 +++++++++++++
configure.ac | 7 ++++---
contrib/kimchi.spec.fedora.in | 4 ++++
contrib/kimchi.spec.suse.in | 4 ++++
plugins/Makefile.am | 17 +++++++++++++++--
plugins/sample/Makefile.am | 14 +++++++++++++-
plugins/sample/configure.m4 | 26 ++++++++++++++++++++++++++
plugins/sample/plugin.spec | 17 +++++++++++++++++
plugins/sample/ui/config/Makefile.am | 6 +++++-
11 files changed, 111 insertions(+), 13 deletions(-)
create mode 100644 plugins/sample/configure.m4
create mode 100644 plugins/sample/plugin.spec
diff --git a/.gitignore b/.gitignore
index 67878e2..324325b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,6 +20,8 @@ contrib/DEBIAN/control
contrib/kimchi.spec.fedora
contrib/kimchi.spec.suse
contrib/make-deb.sh
+plugins/plugins.m4
+plugins/plugins.spec
*.min.css
*.min.js
*.gmo
diff --git a/Makefile.am b/Makefile.am
index 6831b5d..b6a864c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -35,9 +35,7 @@ EXTRA_DIST = \
# When fixing a file to conform with pep8, add it to the WL here.
# So it will be checked from now on.
PEP8_WHITELIST = \
- plugins/__init__.py \
- plugins/sample/__init__.py \
- plugins/sample/model.py \
+ plugins \
src/kimchi/asynctask.py \
src/kimchi/auth.py \
src/kimchi/cachebust.py \
@@ -122,10 +120,14 @@ kimchi.spec: contrib/kimchi.spec.fedora contrib/kimchi.spec.suse
/bin/false ; \
fi
-rpm: dist kimchi.spec
+plugins/plugins.spec:
+ cd plugins; \
+ make plugins.spec
+
+rpm: dist kimchi.spec plugins/plugins.spec
$(MKDIR_P) rpm/BUILD rpm/RPMS rpm/SOURCES rpm/SPECS rpm/SRPMS
cp $(top_srcdir)/kimchi.spec rpm/SPECS/kimchi.spec
- cp $(DIST_ARCHIVES) rpm/SOURCES
+ cp $(DIST_ARCHIVES) plugins/plugins.spec rpm/SOURCES
rpmbuild -ba --define "_topdir `pwd`/rpm" rpm/SPECS/kimchi.spec
fedora-rpm: contrib/kimchi.spec.fedora
@@ -146,7 +148,7 @@ VERSION:
git describe --abbrev=0 > $@; \
fi
-.PHONY: deb install-deb rpm fedora-rpm suse-rpm ChangeLog VERSION
+.PHONY: deb install-deb rpm fedora-rpm suse-rpm ChangeLog VERSION plugins/plugins.spec
clean-local:
rm -rf mo rpm
diff --git a/autogen.sh b/autogen.sh
index 0f22dba..75d85aa 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,5 +1,18 @@
#!/bin/bash
+plugins_list=""
+for opts in "$@" ; do
+ if [[ "$opts" == "--with-plugins="* ]] ; then
+ plugins_list=${opts#--with-plugins=}
+ plugins_list=$(sed -e "s/,/ /g" <<< ${plugins_list})
+ fi
+done
+
+echo "" > plugins/plugins.m4
+for plugin in ${plugins_list}; do
+ cat plugins/${plugin}/configure.m4 >> plugins/plugins.m4
+done
+
aclocal
automake --add-missing
autoreconf
diff --git a/configure.ac b/configure.ac
index a625f35..75be00d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,6 +48,10 @@ if test "x$PYFLAKES" = "x"; then
AC_MSG_WARN([pyflakes not found])
fi
+m4_include([plugins/plugins.m4])
+
+AC_SUBST([enabled_plugins], ["${enabled_plugins}"])
+
AC_CONFIG_FILES([
po/Makefile.in
@@ -61,9 +65,6 @@ AC_CONFIG_FILES([
src/kimchi/control/vm/Makefile
src/kimchi/model/Makefile
plugins/Makefile
- plugins/sample/Makefile
- plugins/sample/ui/Makefile
- plugins/sample/ui/config/Makefile
ui/Makefile
ui/css/Makefile
ui/css/novnc/Makefile
diff --git a/contrib/kimchi.spec.fedora.in b/contrib/kimchi.spec.fedora.in
index bf80104..12b5f42 100644
--- a/contrib/kimchi.spec.fedora.in
+++ b/contrib/kimchi.spec.fedora.in
@@ -10,6 +10,7 @@ BuildRoot: %{_topdir}/BUILD/%{name}-%{version}-%{release}
Group: System Environment/Base
License: LGPL/ASL2
Source0: %{name}-%{version}.tar.gz
+Source1: plugins.spec
Requires: qemu-kvm
Requires: gettext-devel
Requires: libvirt
@@ -140,6 +141,7 @@ rm -rf $RPM_BUILD_ROOT
%{python_sitelib}/kimchi/control/*.py*
%{python_sitelib}/kimchi/control/vm/*.py*
%{python_sitelib}/kimchi/model/*.py*
+%{python_sitelib}/kimchi/plugins/*.py*
%{python_sitelib}/kimchi/API.json
%{_datadir}/kimchi/doc/API.md
%{_datadir}/kimchi/doc/README.md
@@ -192,6 +194,8 @@ rm -rf $RPM_BUILD_ROOT
%{_initrddir}/kimchid
%endif
+%include %{SOURCE1}
+
%changelog
* Tue Feb 11 2014 Crístian Viana <vianac(a)linux.vnet.ibm.com> 1.1.0
- Add help pages and XSLT dependency
diff --git a/contrib/kimchi.spec.suse.in b/contrib/kimchi.spec.suse.in
index cba0899..8432dab 100644
--- a/contrib/kimchi.spec.suse.in
+++ b/contrib/kimchi.spec.suse.in
@@ -6,6 +6,7 @@ BuildRoot: %{_topdir}/BUILD/%{name}-%{version}-%{release}
Group: System Environment/Base
License: LGPL/ASL2
Source0: %{name}-%{version}.tar.gz
+Source1: plugins.spec
Requires: kvm
Requires: gettext-tools
Requires: libvirt
@@ -66,6 +67,7 @@ rm -rf $RPM_BUILD_ROOT
%{python_sitelib}/kimchi/control/*.py*
%{python_sitelib}/kimchi/control/vm/*.py*
%{python_sitelib}/kimchi/model/*.py*
+%{python_sitelib}/kimchi/plugins/*.py*
%{python_sitelib}/kimchi/API.json
%{_datadir}/kimchi/doc/API.md
%{_datadir}/kimchi/doc/README.md
@@ -108,6 +110,8 @@ rm -rf $RPM_BUILD_ROOT
%{_sysconfdir}/kimchi/distros.d/gentoo.json
%{_initrddir}/kimchid
+%include %{SOURCE1}
+
%changelog
* Tue Feb 11 2014 Crístian Viana <vianac(a)linux.vnet.ibm.com> 1.1.0
- Add help pages and XSLT dependency
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 2ceedae..2ec958f 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -17,6 +17,19 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-SUBDIRS = sample
+SUBDIRS = $(enabled_plugins)
-EXTRA_DIST = __init__.py
+plugins_PYTHON = \
+ __init__.py
+
+pluginsdir = $(pythondir)/kimchi/plugins
+
+plugins.spec: $(SUBDIRS:%=%/plugin.spec) Makefile
+ echo "" > plugins.spec
+ for plugin in $(SUBDIRS); do \
+ cat $$plugin/plugin.spec >> plugins.spec; \
+ done
+
+CLEANFILES = \
+ plugins.spec \
+ $(NULL)
diff --git a/plugins/sample/Makefile.am b/plugins/sample/Makefile.am
index e03a4c0..1d595c2 100644
--- a/plugins/sample/Makefile.am
+++ b/plugins/sample/Makefile.am
@@ -19,4 +19,16 @@
SUBDIRS = ui
-EXTRA_DIST = API.json sample.conf $(wildcard *.py)
+sampledir = $(pythondir)/kimchi/plugins/sample
+
+confdir = $(sysconfdir)/kimchi/plugins.d
+
+sample_PYTHON = $(wildcard *.py)
+
+dist_conf_DATA = sample.conf
+
+EXTRA_DIST = API.json
+
+install-data-local:
+ $(MKDIR_P) $(DESTDIR)$(sampledir)
+ $(INSTALL_DATA) API.json $(DESTDIR)$(sampledir)/API.json
diff --git a/plugins/sample/configure.m4 b/plugins/sample/configure.m4
new file mode 100644
index 0000000..b5d65f9
--- /dev/null
+++ b/plugins/sample/configure.m4
@@ -0,0 +1,26 @@
+#
+# Kimchi
+#
+# Copyright IBM Corp, 2014
+#
+# 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
+
+enabled_plugins="${enabled_plugins} sample"
+
+AC_CONFIG_FILES([
+ plugins/sample/Makefile
+ plugins/sample/ui/Makefile
+ plugins/sample/ui/config/Makefile
+])
diff --git a/plugins/sample/plugin.spec b/plugins/sample/plugin.spec
new file mode 100644
index 0000000..9b6b03f
--- /dev/null
+++ b/plugins/sample/plugin.spec
@@ -0,0 +1,17 @@
+%package sample
+Summary: Sample plugin for Kimchi.
+Requires: %{name} = %{version}-%{release}
+
+%description sample
+Kimchi is a web server application application to manage KVM/Qemu
+virtual machines. Kimchi-sample is a sample plugin to demo how to write
+plugin for Kimchi.
+
+
+%files sample
+%attr(-,root,root)
+%{python_sitelib}/kimchi/plugins/sample/*.py*
+%{python_sitelib}/kimchi/plugins/sample/API.json
+%{_datadir}/kimchi/plugins/sample/ui/config/tab-ext.xml
+%{_sysconfdir}/kimchi/plugins.d/sample.conf
+
diff --git a/plugins/sample/ui/config/Makefile.am b/plugins/sample/ui/config/Makefile.am
index cf9e09e..eb05920 100644
--- a/plugins/sample/ui/config/Makefile.am
+++ b/plugins/sample/ui/config/Makefile.am
@@ -17,5 +17,9 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-EXTRA_DIST = tab-ext.xml
+xmldir = $(datadir)/kimchi/plugins/sample/ui/config
+
+dist_xml_DATA = \
+ tab-ext.xml \
+ $(NULL)
--
1.8.5.3
10 years, 8 months