[PATCH] Setup VM's boot order.
by Paulo Vital
In order to prevent the VM to boot *only* by virtual disk during the
first boot, setup the boot order to: 1st option: disk; 2nd option: cdrom.
This configuration guarantees that the virtual firmware will boot by
cdrom after check there is no boot section on default disk.
Signed-off-by: Paulo Vital <pvital(a)linux.vnet.ibm.com>
---
src/kimchi/vmtemplate.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py
index 37994c2..999473c 100644
--- a/src/kimchi/vmtemplate.py
+++ b/src/kimchi/vmtemplate.py
@@ -277,6 +277,8 @@ class VMTemplate(object):
<vcpu>%(cpus)s</vcpu>
<os>
<type arch='%(arch)s'>hvm</type>
+ <boot dev='hd'/>
+ <boot dev='cdrom'/>
</os>
<features>
<acpi/>
--
1.8.3.1
10 years, 10 months
[PATCH] bug fix: fix python syntax error
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
the dict the key and value should be separated by colon
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
src/kimchi/mockmodel.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py
index bde6a5c..988683f 100644
--- a/src/kimchi/mockmodel.py
+++ b/src/kimchi/mockmodel.py
@@ -264,7 +264,7 @@ class MockModel(object):
try:
file_target = glob.glob(file_pattern)[0]
except IndexError:
- raise NotFoundError("KCHDR0001E", {'name', name})
+ raise NotFoundError("KCHDR0001E", {'name': name})
ctime = os.stat(file_target).st_ctime
ctime = time.strftime("%Y-%m-%d-%H:%M:%S", time.localtime(ctime))
@@ -282,7 +282,7 @@ class MockModel(object):
try:
file_target = glob.glob(file_pattern)[0]
except IndexError:
- raise NotFoundError("KCHDR0001E", {'name', name})
+ raise NotFoundError("KCHDR0001E", {'name': name})
os.remove(file_target)
--
1.8.4.2
10 years, 10 months
[PATCH 0/3] Documentation improvements
by Leonardo Garcia
From: Leonardo Garcia <lagarcia(a)br.ibm.com>
Leonardo Garcia (3):
Add hypervisor information on README.md.
Limit README.md to 80 columns.
Add mailing list information.
CONTRIBUTE.md | 6 +++---
docs/README.md | 31 +++++++++++++++++++++++--------
2 files changed, 26 insertions(+), 11 deletions(-)
--
1.8.5.3
10 years, 10 months
[PATCH] bug fix: make install miss ifaces.py
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
use wildcard in the install list.
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
src/kimchi/control/vm/Makefile.am | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/kimchi/control/vm/Makefile.am b/src/kimchi/control/vm/Makefile.am
index 17340af..c42a6cd 100644
--- a/src/kimchi/control/vm/Makefile.am
+++ b/src/kimchi/control/vm/Makefile.am
@@ -22,9 +22,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-vm_PYTHON = \
- __init__.py
-
+vm_PYTHON = *.py
vmdir = $(pythondir)/kimchi/control/vm
--
1.8.4.2
10 years, 10 months
[PATCH v5 0/5] CDROM Management
by Daniel Barboza
From: Daniel Henrique Barboza <danielhb(a)linux.vnet.ibm.com>
This patch set implements host storage devices management.
It implements full CDROM device add, remove and update functionality.
It implements basic Disk functionalities.
Changelog:
v5:
- Addressed Aline's comments from her review in v4
v4:
- Imports fix, author fix, pep8 fixes
- Cut off HDD support
- lxml changes in model/vms.py
- test_model.py changes - add, update and remove cdroms
- existing device name verification in model/vms.py
- changed the code to use the new exception model
V3:
- Using lxml to parse the XML information in model/vms.py
- Addressed comments/suggestions from the ML in other files
V2:
- Add devices to mockmodel and add test cases to rest API
- Assign name automatically to new devices, if not passed by user
- Fix minor errors
To test this contribution:
- get info of all storages (cdrom and disks) of a VM
curl -u <user> -H "Content-Type: application/json" -H "Accept: application/json" http://localhost:8000/vms/<vm_name>/storages -X GET
- add a new cdrom to a VM
curl -u <user> -H "Content-Type: application/json" -H "Accept: application/json" http://localhost:8000/vms/<vm_name>/storages -X POST -d'{"type": "cdrom", "path": "<path_to_iso>"}'
- get specific info from cdrom device
curl -u <user> -H "Content-Type: application/json" -H "Accet: application/json" http://localhost:8000/vms/<vm_name>/storages/<dev_name> -X GET
- delete a cdrom device from a VM
curl -u <user> -H "Content-Type: application/json" -H "Accet: application/json" http://localhost:8000/vms/<vm_name>/storages/<dev_name> -X DELETE
- update a cdrom device from a VM
curl -u <user> -H "Content-Type: application/json" -H "Accet: application/json" http://localhost:8000/vms/<vm_name>/storages/<dev_name> -X PUT -d '{"path":<path_to_iso>}'
Daniel Henrique Barboza (2):
CDROM Management: API.md and externalized error messages
CDROM Management: changes in tests/test_model.py
Rodrigo Trujillo (3):
CDROM Management: Update controller and API.json for guest storages
CDROM Management: Devices management model implementation
CDROM Management: Guest vm storage devices mockmodel and rest api test
cases
docs/API.md | 21 +++++
src/kimchi/API.json | 37 ++++++++
src/kimchi/control/vm/storages.py | 49 +++++++++++
src/kimchi/i18n.py | 11 +++
src/kimchi/mockmodel.py | 63 ++++++++++++++
src/kimchi/model/vms.py | 173 +++++++++++++++++++++++++++++++++++++-
src/kimchi/xmlutils.py | 2 +-
tests/test_model.py | 56 ++++++++++++
tests/test_rest.py | 56 ++++++++++++
9 files changed, 465 insertions(+), 3 deletions(-)
create mode 100644 src/kimchi/control/vm/storages.py
--
1.8.3.1
10 years, 10 months
[RFC]Attatch Disk to VM
by Royce Lv
This RFC is to illustrate how attach disk to vm works and what the API
looks like.
Use case:
1. Guest wants to attach a volume which contains data.
2. Guest is running out of storage space, attach an empty volume to
extend storage space.
Flow:
1. Create a **float** volume in a storage pool.(float means this
volume will not be deleted when vm's deleted, it is independent from vm)
Only **float** volume can be attached to vm.(to solve volume
ref count problem), All volumes created from storage tab is float ones,
because embedded storage is created when vm's created.
POST /storagepools/pool-1/storagevolumes/
{'float': True, 'size':10G, 'name': 'a-float-volume'}
GET /storagepools/pool-1/storagevolumes/a-float-volume
{'float': True, 'ref_count':0, ...}
2. On vm tab, list all availabe float volumes, currently only
support ref_count=0 volumes, select one and attach it to vm.
GET /storagepools/pool-1/storagevolumes?float=True&ref_count=0
GET /storagepools/pool-2/storagevolumes?float=True&ref_count=0
...
POST /vms/vm-1/storages/
{'storagepool': 'pool-1', 'storagevolume':'a-float-volume',
'dev': 'hda', 'type':'disk'}
3. Detaching a disk from a vm, NOTE: this will make no change to
content in the volume, just make it isolated from vm, if you want to
delete storage, go to storage tab.
DELETE /vms/vm-1/storages/hda
NOTE:
This means we support disks from different storagepool,
Temporarily we don't support share disk (in the future it will be
handled in a single feature).
VM deletion will not involve float disk.
As PCI hotplug already supported, we can add disk to a running vm.
Thanks to Mark Wu to contribute idea of float to solve volume life cycle
problem. Part of the inner implementation already be done by Rodrigo and
Daniel, I will try to extend their implementation for hard disk.
10 years, 10 months
[PATCH v4 0/6] CDROM Management
by Daniel Barboza
From: Daniel Henrique Barboza <danielhb(a)linux.vnet.ibm.com>
This patch set implements host storage devices management.
It implements full CDROM device add, remove and update functionality.
It implements basic Disk functionalities.
Changelog:
v4:
- Imports fix, author fix, pep8 fixes
- Cut off HDD support
- lxml changes in model/vms.py
- test_model.py changes - add, update and remove cdroms
- existing device name verification in model/vms.py
- changed the code to use the new exception model
V3:
- Using lxml to parse the XML information in model/vms.py
- Addressed comments/suggestions from the ML in other files
V2:
- Add devices to mockmodel and add test cases to rest API
- Assign name automatically to new devices, if not passed by user
- Fix minor errors
To test this contribution:
- get info of all storages (cdrom and disks) of a VM
curl -u <user> -H "Content-Type: application/json" -H "Accept: application/json" http://localhost:8000/vms/<vm_name>/storages -X GET
- add a new cdrom to a VM
curl -u <user> -H "Content-Type: application/json" -H "Accept: application/json" http://localhost:8000/vms/<vm_name>/storages -X POST -d'{"type": "cdrom", "path": "<path_to_iso>"}'
- get specific info from cdrom device
curl -u <user> -H "Content-Type: application/json" -H "Accet: application/json" http://localhost:8000/vms/<vm_name>/storages/<dev_name> -X GET
- delete a cdrom device from a VM
curl -u <user> -H "Content-Type: application/json" -H "Accet: application/json" http://localhost:8000/vms/<vm_name>/storages/<dev_name> -X DELETE
- update a cdrom device from a VM
curl -u <user> -H "Content-Type: application/json" -H "Accet: application/json" http://localhost:8000/vms/<vm_name>/storages/<dev_name> -X PUT -d '{"path":<path_to_iso>}'
Daniel Henrique Barboza (2):
CDROM Management: changes in tests/test_model.py
CDROM Management: externalized error messages
Rodrigo Trujillo (4):
CDROM Management: Add storage sub-collection to sub-resource to guest
resource
CDROM Management: Update controller and API.json for guest storages
CDROM Management: Devices management model implementation
CDROM Management: Guest vm storage devices mockmodel and rest api test
cases
docs/API.md | 21 +++++
src/kimchi/API.json | 37 ++++++++
src/kimchi/control/vm/storages.py | 49 +++++++++++
src/kimchi/i18n.py | 11 +++
src/kimchi/mockmodel.py | 63 ++++++++++++++
src/kimchi/model/vms.py | 173 +++++++++++++++++++++++++++++++++++++-
src/kimchi/xmlutils.py | 8 +-
tests/test_model.py | 56 ++++++++++++
tests/test_rest.py | 56 ++++++++++++
9 files changed, 471 insertions(+), 3 deletions(-)
create mode 100644 src/kimchi/control/vm/storages.py
--
1.8.3.1
10 years, 10 months
[PATCH V2] Fix debug report - NEED TESTS
by Rodrigo Trujillo
In Fedora 20, the sosreport tool saves the report file in /var/tmp, which
crashes kimchi. The --tmp-dir options should be the right approach but it
is crashing in Fedora 20 (RHEL works). While waiting sosreport fix, this
patch searches report file in /var/tmp too.
This code works on Fedora 20. Need more tests in Ubuntu(s), RHEL and older
Fedora.
Rodrigo Trujillo (1):
Fix host debug report for Fedora 20
src/kimchi/model/debugreports.py | 61 ++++++++++++++++++++++++++--------------
1 file changed, 40 insertions(+), 21 deletions(-)
--
1.8.5.3
10 years, 10 months
[PATCH V4] Fix host debug report for Fedora 20
by Rodrigo Trujillo
The tool sosreport does not save the report file in /tmp in F20, this
causes a error in Kimchi, which has /tmp hardcoded. This fixes this
problem searching report files in /var/tmp too.
Notice that is possible to pass --tmp-dir as the directory to save the
report file, but this option is crashing in Fedora 20, so the code is
not using it.
This patch also improves the logging and uses new i18n translation
system for exception error messages.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
src/kimchi/i18n.py | 2 +-
src/kimchi/model/debugreports.py | 58 +++++++++++++++++++++++++---------------
2 files changed, 37 insertions(+), 23 deletions(-)
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index 03d1052..cd06264 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -164,7 +164,7 @@ messages = {
"KCHDR0001E": _("Debug report %(name)s does not exist"),
"KCHDR0002E": _("Debug report tool not found in system"),
"KCHDR0003E": _("Unable to create debug report %(name)s. Details: %(err)s."),
- "KCHDR0004E": _("Can not find generated debug report named %(name)s"),
+ "KCHDR0004E": _("Can not find any generated debug report matching name %(name)s"),
"KCHDR0005E": _("Unable to generate debug report %(name)s. Details: %(err)s"),
"KCHSR0001E": _("Storage server %(server)s was not used by Kimchi"),
diff --git a/src/kimchi/model/debugreports.py b/src/kimchi/model/debugreports.py
index 2c5b13a..dc27eee 100644
--- a/src/kimchi/model/debugreports.py
+++ b/src/kimchi/model/debugreports.py
@@ -32,6 +32,7 @@ from kimchi import config
from kimchi.exception import NotFoundError, OperationFailed
from kimchi.model.tasks import TaskModel
from kimchi.utils import add_task, kimchi_log
+from kimchi.utils import run_command
class DebugReportsModel(object):
@@ -63,38 +64,51 @@ class DebugReportsModel(object):
@staticmethod
def sosreport_generate(cb, name):
- command = 'sosreport --batch --name "%s"' % name
try:
- retcode = subprocess.call(command, shell=True,
- stdout=subprocess.PIPE)
+ command = ['sosreport', '--batch', '--name=%s' % name]
+ output, error, retcode = run_command(command)
+
if retcode < 0:
raise OperationFailed("KCHDR0003E", {'name': name,
'err': retcode})
elif retcode > 0:
raise OperationFailed("KCHDR0003E", {'name': name,
'err': retcode})
- pattern = '/tmp/sosreport-%s-*' % name
- for reportFile in glob.glob(pattern):
- if not fnmatch.fnmatch(reportFile, '*.md5'):
- output = reportFile
+
+ # SOSREPORT might create file in /tmp or /var/tmp
+ # FIXME: The right way should be passing the tar.xz file directory
+ # though the parameter '--tmp-dir', but it is failing in Fedora 20
+ patterns = ['/tmp/sosreport-%s-*', '/var/tmp/sosreport-%s-*']
+ reports = []
+ reportFile = None
+ for p in patterns:
+ reports = reports + [f for f in glob.glob(p % name)]
+ for f in reports:
+ if not fnmatch.fnmatch(f, '*.md5'):
+ reportFile = f
break
- else:
- # sosreport tends to change the name mangling rule and
- # compression file format between different releases.
- # It's possible to fail to match a report file even sosreport
- # runs successfully. In future we might have a general name
- # mangling function in kimchi to format the name before passing
- # it to sosreport. Then we can delete this exception.
- raise OperationFailed("KCHDR0004E", {'name': pattern})
-
- ext = output.split('.', 1)[1]
+ # Some error in sosreport happened
+ if reportFile is None:
+ kimchi_log.error('Debug report file not found. See sosreport '
+ 'output for detail:\n%s', output)
+ raise OperationFailed('KCHDR0004E',
+ {'name': (patterns[0] % name).split('/')[-1]})
+
+ md5_report_file = reportFile + '.md5'
+ report_file_extension = '.' + reportFile.split('.', 1)[1]
path = config.get_debugreports_path()
- target = os.path.join(path, name)
- target_file = '%s.%s' % (target, ext)
- shutil.move(output, target_file)
- os.remove('%s.md5' % output)
+ target = os.path.join(path, name + report_file_extension)
+ # Moving report
+ msg = 'Moving debug report file "%s" to "%s"' % (reportFile, target)
+ kimchi_log.info(msg)
+ shutil.move(reportFile, target)
+ # Deleting md5
+ msg = 'Deleting report md5 file: "%s"' % (md5_report_file)
+ kimchi_log.info(msg)
+ md5 = open(md5_report_file).read().strip()
+ kimchi_log.info('Md5 file content: "%s"', md5)
+ os.remove(md5_report_file)
cb('OK', True)
-
return
except OSError:
--
1.8.5.3
10 years, 10 months
[PATCH v6 (BACKEND) 0/5] Storagepool SCSI/FC
by Rodrigo Trujillo
V6:
- Fix minor issues from previous reviews
- Change code to use new i18n translation system for exception error messages
V5:
- Add entries to API.md related to host pci devices API
- Fix issues with wwpn and wwnn fields in lookup returns
- Fix issues in mock model
- Fix UI minor issues
- Add UI strings to i18n
- Refactored code accordig to code review suggestions
V4:
- Implements mockmodel and tests
- Fix UI
- Fix other minor issues
V3:
- Changed API to only receive the scsi host name when creating new pool
- Changed API to require LUN when creating new VM on SCSI pool
- Created feature test and removed libvirt test function
- Rebased with new model structure
- Added error function handlers to UIs
- Fixed LUN selection window
V2:
- Implements Fibre Channel devices discover in the host
- Allow vms_create receive a volume to create the disk (if pool is SCSI)
- Create basic UI to select SCSI Host when creating SCSI FC pool
- Draft of UI to select LUN to create new VM when template has a SCSI
pool configured. (Need help of UI guys here!)
Rodrigo Trujillo (5):
Storagepool SCSI/FC: Implement node devices API backend
Storagepool SCSI/FC: API.md entries related to host pci devices
Storagepool SCSI/FC: Backend implementation
Storagepool SCSI/FC: Modifies mockmodel and implements tests for FC
pool
Storagepool SCSI/FC: Modify backend errors messages to use i18n system
docs/API.md | 33 +++++++++++++++++-
src/kimchi/API.json | 16 +++++++--
src/kimchi/control/host.py | 16 +++++++++
src/kimchi/featuretests.py | 29 ++++++++++++++++
src/kimchi/i18n.py | 4 +++
src/kimchi/mockmodel.py | 56 +++++++++++++++++++++++++++---
src/kimchi/model/config.py | 2 ++
src/kimchi/model/host.py | 55 ++++++++++++++++++++++++++++++
src/kimchi/model/libvirtstoragepool.py | 48 ++++++++++++++++++++++++--
src/kimchi/model/storagepools.py | 30 +++++++++++++---
src/kimchi/model/templates.py | 5 +++
src/kimchi/model/vms.py | 27 +++++++++++++--
src/kimchi/vmtemplate.py | 31 ++++++++++++++++-
tests/test_rest.py | 62 ++++++++++++++++++++++++++++++++++
tests/test_storagepool.py | 21 ++++++++++++
15 files changed, 417 insertions(+), 18 deletions(-)
--
1.8.5.3
10 years, 10 months