[PATCH v2][Kimchi] Issue #931 Error when editing a template created using a disk image
by Ramon Medeiros
UI wasn't passing path to image disk when updating it, so the backend
was losing the disk.
Signed-off-by: Ramon Medeiros <ramonn(a)linux.vnet.ibm.com>
---
Changes:
v2:
Put result from isImageBasedTemplate() in a variable, instead of pass the pointer to the function
ui/js/src/kimchi.template_edit_main.js | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/ui/js/src/kimchi.template_edit_main.js b/ui/js/src/kimchi.template_edit_main.js
index de72452..bc3c2ef 100644
--- a/ui/js/src/kimchi.template_edit_main.js
+++ b/ui/js/src/kimchi.template_edit_main.js
@@ -20,6 +20,7 @@ kimchi.template_edit_main = function() {
var origDisks;
var origNetworks;
var templateDiskSize;
+ var baseImageTemplate;
$('#template-name', templateEditMain).val(kimchi.selectedTemplate);
$('#edit-template-tabs a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
$('.tab-content').css('overflow','hidden');
@@ -89,6 +90,7 @@ kimchi.template_edit_main = function() {
}
return false;
}
+ baseImageTemplate = isImageBasedTemplate();
enableSpice();
$('#template-edit-graphics').selectpicker();
@@ -342,6 +344,11 @@ kimchi.template_edit_main = function() {
'format' : $(diskEntity).find('.template-storage-disk-format').val()
};
+ // image based template: add base to dictionary
+ if ((baseImageTemplate) && (index == 0)) {
+ newDisk["base"] = $('#template-edit-vmimage-textbox').val();
+ }
+
var storageType = $(diskEntity).find('.template-storage-type').val();
if(storageType === 'iscsi' || storageType === 'scsi') {
newDisk['volume'] = newDisk['pool']['name'].split('/').pop();
--
2.5.5
8 years, 8 months
[PATCH][Kimchi] Fix typo and integer values validation in Guest edit UI
by Rodrigo Trujillo
- UI was measuring string values instead of integer values, this was
causing errors;
- Changes typo in error return: thEn by thAn.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.guest_edit_main.js | 4 ++--
ui/pages/i18n.json.tmpl | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js
index ef6d650..66edbcb 100644
--- a/ui/js/src/kimchi.guest_edit_main.js
+++ b/ui/js/src/kimchi.guest_edit_main.js
@@ -746,14 +746,14 @@ kimchi.guest_edit_main = function() {
}
// Test memory values before submit. Avoid requests we know are going to fail
- if ($('#guest-edit-memory-textbox').val() > $('#guest-edit-max-memory-textbox').val()) {
+ if (parseInt($('#guest-edit-memory-textbox').val()) > parseInt($('#guest-edit-max-memory-textbox').val())) {
wok.message.error(i18n['KCHVM0002E'], '#alert-modal-container');
$(saveButton).prop('disabled', false);
return;
}
// Test CPU values before submit. Avoid requests we know are going to fail
- if ($('#guest-edit-cores-textbox').val() > $('#guest-edit-max-processor-textbox').val()) {
+ if (parseInt($('#guest-edit-cores-textbox').val()) > parseInt($('#guest-edit-max-processor-textbox').val())) {
wok.message.error(i18n['KCHVM0003E'], '#alert-modal-container');
$(saveButton).prop('disabled', false);
return;
diff --git a/ui/pages/i18n.json.tmpl b/ui/pages/i18n.json.tmpl
index cb7b2a8..8da568a 100644
--- a/ui/pages/i18n.json.tmpl
+++ b/ui/pages/i18n.json.tmpl
@@ -66,8 +66,8 @@
"KCHVM6009M": "$_("This virtual machine is not persistent. Power Off will delete it. Continue?")",
"KCHVM0001E": "$_("Input is not a number")",
- "KCHVM0002E": "$_("Memory value cannot be higher then Max Memory value")",
- "KCHVM0003E": "$_("Current CPUs value cannot be higher then Max CPU value")",
+ "KCHVM0002E": "$_("Memory value cannot be higher than Max Memory value")",
+ "KCHVM0003E": "$_("Current CPUs value cannot be higher than Max CPU value")",
"KCHVMCD6001M": "$_("This CDROM will be detached permanently and you can re-attach it. Continue to detach it?")",
"KCHVMCD6003M": "$_("Attaching...")",
--
2.1.0
8 years, 8 months
[PATCH] [Kimchi] Bug fix: Convert CPU and memory values to number before doing any data validation
by Aline Manera
The value entered for CPUs must not be greater than maximum CPUs value;
and the value entered for memory must not be greater than the maximum
memory value.
But the input boxes return the data in string format which may cause
issues while doing data validation. So convert the inputed values to
number to do the input validation.
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.guest_edit_main.js | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js
index ef6d650..47c8422 100644
--- a/ui/js/src/kimchi.guest_edit_main.js
+++ b/ui/js/src/kimchi.guest_edit_main.js
@@ -746,17 +746,25 @@ kimchi.guest_edit_main = function() {
}
// Test memory values before submit. Avoid requests we know are going to fail
- if ($('#guest-edit-memory-textbox').val() > $('#guest-edit-max-memory-textbox').val()) {
- wok.message.error(i18n['KCHVM0002E'], '#alert-modal-container');
- $(saveButton).prop('disabled', false);
- return;
+ var memValue = Number($('#guest-edit-memory-textbox').val());
+ var maxmemValue = Number($('#guest-edit-max-memory-textbox').val());
+ if (memValue !== undefined && memValue !== "" && maxmemValue !== undefined && maxmemValue !== "") {
+ if (memValue > maxmemValue) {
+ wok.message.error(i18n['KCHVM0002E'], '#alert-modal-container');
+ $(saveButton).prop('disabled', false);
+ return;
+ }
}
// Test CPU values before submit. Avoid requests we know are going to fail
- if ($('#guest-edit-cores-textbox').val() > $('#guest-edit-max-processor-textbox').val()) {
- wok.message.error(i18n['KCHVM0003E'], '#alert-modal-container');
- $(saveButton).prop('disabled', false);
- return;
+ var coresValue = Number($('#guest-edit-cores-textbox').val());
+ var maxprocessorValue = Number($('#guest-edit-max-processor-textbox').val());
+ if (coresValue !== undefined && coresValue !== "" && maxprocessorValue !== undefined && maxprocessorValue !== "") {
+ if (coresValue > maxprocessorValue) {
+ wok.message.error(i18n['KCHVM0003E'], '#alert-modal-container');
+ $(saveButton).prop('disabled', false);
+ return;
+ }
}
if (data['vcpus'] !== undefined) {
--
2.5.5
8 years, 8 months
[PATCH][Wok] Return collection list without resource with lookup problems
by Rodrigo Trujillo
When a collection receives a GET request, it is going to fetch all
resources names, in a list, and perform a lookup for each resource,
building the return list with all data.
There is a potencial race condition problem in this approach. If a
given resource is removed between list of names creation and its
lookup call, wok is going to fail and the exception is not treated.
This patch fix this problem catching the exception, logging the problem
and completing the GET request. So, the resource with problem is
discarted and other resources are returned.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
src/wok/control/base.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/wok/control/base.py b/src/wok/control/base.py
index 7aeb844..f314d18 100644
--- a/src/wok/control/base.py
+++ b/src/wok/control/base.py
@@ -34,7 +34,7 @@ from wok.exception import InvalidOperation, InvalidParameter
from wok.exception import MissingParameter, NotFoundError
from wok.exception import OperationFailed, UnauthorizedError, WokException
from wok.reqlogger import RequestRecord
-from wok.utils import get_plugin_from_request, utf8_dict
+from wok.utils import get_plugin_from_request, utf8_dict, wok_log
# Default request log messages
@@ -364,7 +364,14 @@ class Collection(object):
# internal text, get_list changes ident to unicode for sorted
args = self.resource_args + [ident]
res = self.resource(self.model, *args)
- res.lookup()
+ try:
+ res.lookup()
+ except Exception as e:
+ # In case of errors when fetching a resource info, pass and
+ # log the error, so, other resources are returned
+ wok_log.error("Problem in lookup of resource '%s'. "
+ "Detail: %s" % (ident, e.message))
+ continue
res_list.append(res)
return res_list
except AttributeError:
--
2.1.0
8 years, 8 months
[PATCH] [Wok] Added utils method for handling locale based formating of number along with Measurement format.
by archus@linux.vnet.ibm.com
From: Archana Singh <archus(a)linux.vnet.ibm.com>
Added formatNumber method which set the passed locale
to method and does formatting of number, and revert back
the locale setting.
Added formatMeasurement method which format number
measurement also format as per locale.
Signed-off-by: Archana Singh <archus(a)linux.vnet.ibm.com>
---
src/wok/utils.py | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 88 insertions(+)
diff --git a/src/wok/utils.py b/src/wok/utils.py
index 0e8ec05..b37518f 100644
--- a/src/wok/utils.py
+++ b/src/wok/utils.py
@@ -33,6 +33,7 @@ import subprocess
import sys
import traceback
import xml.etree.ElementTree as ET
+import locale
from cherrypy.lib.reprconf import Parser
from datetime import datetime, timedelta
@@ -646,3 +647,90 @@ def decode_value(val):
if not isinstance(val, unicode):
val = val.decode('utf-8')
return val
+
+
+def formatMeasurement(number, settings):
+ '''
+ Refer to "Units of information" (
+ http://en.wikipedia.org/wiki/Units_of_information
+ ) for more information about measurement units.
+
+ @param number The number to be normalized.
+ @param settings
+ base Measurement base, accepts 2 or 10. defaults to 2.
+ unit The unit of the measurement, e.g., B, Bytes/s, bps, etc.
+ fixed The number of digits after the decimal point.
+ locale The locale for formating the number if not passed
+ format is done as per current locale.
+ @returns [object]
+ v The number part of the measurement.
+ s The suffix part of the measurement including multiple and unit.
+ e.g., kB/s means 1000B/s, KiB/s for 1024B/s.
+ '''
+ unitBaseMapping = {2: [{"us": 'Ki', "v": 1024},
+ {"us": 'Mi', "v": 1048576},
+ {"us": 'Gi', "v": 1073741824},
+ {"us": 'Ti', "v": 1099511627776},
+ {"us": 'Pi', "v": 1125899906842624}],
+ 10: [{"us": 'k', "v": 1000},
+ {"us": 'M', "v": 1000000},
+ {"us": 'G', "v": 1000000000},
+ {"us": 'T', "v": 1000000000000},
+ {"us": 'P', "v": 1000000000000000}]}
+
+ if(not number):
+ return number
+ settings = settings or {}
+ unit = settings['unit'] if 'unit' in settings else 'B'
+ base = settings['base'] if 'base' in settings else 2
+
+ new_locale = settings['locale'] if 'locale' in settings else ''
+
+ if(base != 2 and base != 10):
+ return encode_value(number) + unit
+
+ fixed = settings['fixed']
+
+ unitMapping = unitBaseMapping[base]
+ for mapping in reversed(unitMapping):
+ suffix = mapping['us']
+ startingValue = mapping['v']
+ if(number < startingValue):
+ continue
+
+ formatted = float(number) / startingValue
+ formatted = formatNumber(formatted, fixed, new_locale)
+ return formatted + suffix + unit
+
+ formatted_number = formatNumber(number, fixed, new_locale)
+ return formatted_number+unit
+
+
+def formatNumber(number, fixed, format_locale):
+ '''
+ Format the number based on format_locale passed.
+ '''
+
+ # get the current locale
+ current_locale = locale.getlocale()
+ new_locale = ''
+ # set passed locale and set new_locale to same value.
+ if format_locale:
+ new_locale = locale.setlocale(locale.LC_ALL, format_locale)
+
+ # Based on type of number use the correct formatter
+ if isinstance(number, float):
+ if fixed:
+ formatted = locale.format('%' + '.%df' % fixed, number, True)
+ else:
+ formatted = locale.format('%f', number, True)
+ if isinstance(number, int):
+ formatted = locale.format('%d', number, True)
+ # After formatting is done as per locale, reset the locale if changed.
+ if (new_locale and not current_locale[0] and not current_locale[1]):
+ locale.setlocale(locale.LC_ALL, 'C')
+ elif (new_locale):
+ locale.setlocale(locale.LC_ALL, current_locale[0] + "." +
+ current_locale[1])
+
+ return formatted
--
2.5.0
8 years, 8 months
[RFC] [Kimchi] Add support to edit virtual networks
by Lucio Correia
Edit virtual network feature
Pre-requisite:
- Virtual network is stopped
- Virtual network "default" is not editable
*** BACKEND ***
### Resource: Network
**URI:** /plugins/kimchi/networks/*:name*
**Methods:**
* **UPDATE**: Update a Network
* name: The name of the 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.
* end: end boundary of a pool of addresses to be provided to
DHCP clients.
* interfaces: An array of bridge network interfaces that belongs to
this network
All traffic on this network will be bridged through
the first
interface. The interface is a bridge or
ethernet/bonding device.
* vlan ID
Not all attributes are required for all networks types.
*** FRONTEND ***
* Add new option Edit to Actions menu under Virtualization/Network tab,
enabled only for stopped networks
* When clicked, this option will open a new window for editing that
virtual network, with the following fields. Based on network type, some
of below fields may be disabled:
Type: just a label describing the network type, not changeable.
Name: all types of virtual network can be renamed
Interfaces: attach/detach interfaces (enabled for VEPA) or change
interface (for macvtap, bridged)
Subnet/DHCP range: two IP fields: start, end (enabled for NAT, isolated)
VLAN id: integer field (enabled for bridged networks)
--
Lucio Correia
Software Engineer
IBM LTC Brazil
8 years, 8 months
[PATCH V4] [Kimchi 0/3] Issue #372: Add support to netboot installation.
by pvital@linux.vnet.ibm.com
From: Paulo Vital <pvital(a)linux.vnet.ibm.com>
V4:
* Changed API of source_media to be a dictionary with type and path
* Adapted source code to the new API
V3:
* set network as third default option to boot order
V2:
* Adapted patch to new template API (automatic detection of cdrom)
V1:
This patchset adds support in backend to create templates and guests to netboot
without setting a cdrom path or URL as image to install. Once created a guest
to boot via network, the guest will request DHCP/TFTP/(NFS/HTTP/FTP) network
installation servers to download the configured images and start the install.
Reference: http://miud.in/1Ht3
To test, use the curl commands (look the parameters used):
$ curl -k -u test -H "Content-Type: application/json" -H \
"Accept: application/json" 'https://localhost:8001/plugins/kimchi/templates' \
-X POST -d '{"name": "test-netboot", "source_media": {"type": "netboot", "path": "/var/lib/libvirt/images/netboot"}}'
Enter host password for user 'test':
{
"cpu_info":{
"maxvcpus":1,
"vcpus":1
},
"graphics":{
"type":"vnc",
"listen":"127.0.0.1"
},
"cdrom":null,
"networks":[
"default"
],
"icon":"plugins/kimchi/images/icon-vm.png",
"os_distro":"unknown",
"name":"test-netboot",
"disks":[
{
"index":0,
"format":"qcow2",
"pool":{
"type":"dir",
"name":"/plugins/kimchi/storagepools/default"
},
"size":10
}
],
"invalid":{},
"os_version":"unknown",
"memory":{
"current":1024,
"maxmemory":1024
},
"folder":[]
}
$ curl -k -u test -H "Content-Type: application/json" -H \
"Accept: application/json" 'https://localhost:8001/plugins/kimchi/vms' -X POST \
-d '{"name":"1netboot-test","template":"/plugins/kimchi/templates/test-netboot"}'
Enter host password for user 'test':
{
"status":"running",
"message":"Provisioning storages for new VM",
"id":"1",
"target_uri":"/plugins/kimchi/vms/1netboot-test"
}
$ sudo virsh dumpxml 1netboot-test
<domain type='kvm'>
<name>1netboot-test</name>
<uuid>5c9fa5b3-3203-4c93-92d6-2b4103fe7b40</uuid>
<metadata>
<kimchi:metadata xmlns:kimchi="https://github.com/kimchi-project/kimchi">
<kimchi:os version="unknown" distro="unknown"/>
</kimchi:metadata>
</metadata>
<memory unit='KiB'>1048576</memory>
<currentMemory unit='KiB'>1048576</currentMemory>
<memtune>
<hard_limit unit='KiB'>2097152</hard_limit>
</memtune>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='pc-i440fx-2.4'>hvm</type>
<boot dev='hd'/>
<boot dev='cdrom'/>
<boot dev='network'/>
</os>
<acpi/>
<apic/>
<pae/>
</features>
<cpu>
<numa>
<cell id='0' cpus='0' memory='1048576' unit='KiB'/>
</numa>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='none'/>
<source file='/var/lib/libvirt/images/5c9fa5b3-3203-4c93-92d6-2b4103fe7b40-0.img'/>
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<controller type='usb' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<controller type='pci' index='0' model='pci-root'/>
<controller type='ide' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<interface type='network'>
<mac address='52:54:00:ea:7e:ad'/>
<source network='default'/>
<model type='e1000'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'>
<listen type='address' address='127.0.0.1'/>
</graphics>
<sound model='ich6'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<video>
<model type='cirrus' vram='16384' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</memballoon>
</devices>
</domain>
Paulo Vital (3):
Add support to create netboot templates.
Add support to create guests to netboot.
Update test cases to support netboot.
API.json | 18 +++++++++++----
i18n.py | 1 +
model/templates.py | 27 ++++++++++++++++++++---
tests/test_authorization.py | 4 +++-
tests/test_mockmodel.py | 15 ++++++++-----
tests/test_model.py | 43 +++++++++++++++++++++---------------
tests/test_rest.py | 37 +++++++++++++++++++++----------
tests/test_template.py | 53 ++++++++++++++++++++++++++++++++++-----------
tests/test_vmtemplate.py | 18 +++++++++++++++
vmtemplate.py | 28 ++++++++++++++++--------
xmlutils/bootorder.py | 39 +++++++++++++++++++++++++++++++++
11 files changed, 219 insertions(+), 64 deletions(-)
create mode 100644 xmlutils/bootorder.py
--
2.5.5
8 years, 8 months
[PATCH][Kimchi] Add error message when empty disks list is passed in Template edit API
by Rodrigo Trujillo
If user gives an empty disk list "[]" when editing a Template, the json
schema is going to return a standard error that has not useful meaning
to end user. This patch adds a more meaningful error message.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
API.json | 3 ++-
i18n.py | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/API.json b/API.json
index 5ef4f55..380ed19 100644
--- a/API.json
+++ b/API.json
@@ -714,7 +714,8 @@
}
},
"minItems": 1,
- "uniqueItems": true
+ "uniqueItems": true,
+ "error": "KCHTMPL0033E"
},
"networks": {
"description": "list of which networks will be assigned to the new VM.",
diff --git a/i18n.py b/i18n.py
index 9a3f4a1..39f5e57 100644
--- a/i18n.py
+++ b/i18n.py
@@ -183,6 +183,7 @@ messages = {
"KCHTMPL0030E": _("Memory expects an object with one or both parameters: 'current' and 'maxmemory'"),
"KCHTMPL0031E": _("Memory value (%(mem)sMiB) must be equal or lesser than maximum memory value (%(maxmem)sMiB)"),
"KCHTMPL0032E": _("Unable to update template due error: %(err)s"),
+ "KCHTMPL0033E": _("Parameter 'disks' requires at least one disk object"),
"KCHPOOL0001E": _("Storage pool %(name)s already exists"),
"KCHPOOL0002E": _("Storage pool %(name)s does not exist"),
--
2.1.0
8 years, 8 months
[PATCH] [Kimchi] Move capabilities to model constructor
by Jose Ricardo Ziviani
- This commit moves the capabilities to the class constructor to
improve the speed. Only capabilities that depends on the server
up will be left on cherrypy subscription.
Signed-off-by: Jose Ricardo Ziviani <joserz(a)linux.vnet.ibm.com>
---
model/config.py | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/model/config.py b/model/config.py
index f5d2792..39e4efa 100644
--- a/model/config.py
+++ b/model/config.py
@@ -56,10 +56,12 @@ class CapabilitiesModel(object):
self.nm_running = False
self.mem_hotplug_support = False
+ # run feature tests
+ self._set_capabilities()
+
# Subscribe function to set host capabilities to be run when cherrypy
- # server is up
- # It is needed because some features tests depends on the server
- cherrypy.engine.subscribe('start', self._set_capabilities)
+ # server is up for features that depends on the server
+ cherrypy.engine.subscribe('start', self._set_depend_capabilities)
# Subscribe function to clean any Kimchi leftovers
cherrypy.engine.subscribe('stop', self._clean_leftovers)
@@ -83,21 +85,27 @@ class CapabilitiesModel(object):
FeatureTests.enable_libvirt_error_logging()
- def _set_capabilities(self):
- wok_log.info("*** Running feature tests ***")
+ def _set_depend_capabilities(self):
+ wok_log.info("*** Running dependable feature tests ***")
conn = self.conn.get()
self.qemu_stream = FeatureTests.qemu_supports_iso_stream()
- self.nfs_target_probe = FeatureTests.libvirt_support_nfs_probe(conn)
- self.fc_host_support = FeatureTests.libvirt_support_fc_host(conn)
- self.kernel_vfio = FeatureTests.kernel_support_vfio()
- self.nm_running = FeatureTests.is_nm_running()
- self.mem_hotplug_support = FeatureTests.has_mem_hotplug_support(conn)
self.libvirt_stream_protocols = []
for p in ['http', 'https', 'ftp', 'ftps', 'tftp']:
if FeatureTests.libvirt_supports_iso_stream(conn, p):
self.libvirt_stream_protocols.append(p)
+ wok_log.info("*** Dependable feature tests completed ***")
+ _set_depend_capabilities.priority = 90
+
+ def _set_capabilities(self):
+ wok_log.info("*** Running feature tests ***")
+ conn = self.conn.get()
+ self.nfs_target_probe = FeatureTests.libvirt_support_nfs_probe(conn)
+ self.fc_host_support = FeatureTests.libvirt_support_fc_host(conn)
+ self.kernel_vfio = FeatureTests.kernel_support_vfio()
+ self.nm_running = FeatureTests.is_nm_running()
+ self.mem_hotplug_support = FeatureTests.has_mem_hotplug_support(conn)
wok_log.info("*** Feature tests completed ***")
_set_capabilities.priority = 90
--
1.9.1
8 years, 8 months
[PATCH] [Kimchi] Change nfs host from localhost to 127.0.0.1
by Jose Ricardo Ziviani
- Using localhost was making the feature test too slow, due to use IPv6
by default in systems that has IPv6 enabled but not properly
configured. For example, strace shows several attempts to send data
to a socket, being droped when timed out:
sendto(4, "W\34\326\267\0\0\0\0\0\0\0\2\0\1\206\240\0\0\0\4\0\0\0\3\0\0\0\0\0\0\0\0"..., 84, 0, {sa_family=AF_INET6, sin6_port=htons(111), inet_pton(AF_INET6, "::1", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 84
poll([{fd=4, events=POLLIN}], 1, 15000) = 0 (Timeout)
sendto(4, "W\34\326\267\0\0\0\0\0\0\0\2\0\1\206\240\0\0\0\4\0\0\0\3\0\0\0\0\0\0\0\0"..., 84, 0, {sa_family=AF_INET6, sin6_port=htons(111), inet_pton(AF_INET6, "::1", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 84
poll([{fd=4, events=POLLIN}], 1, 15000) = 0 (Timeout)
sendto(4, "W\34\326\267\0\0\0\0\0\0\0\2\0\1\206\240\0\0\0\4\0\0\0\3\0\0\0\0\0\0\0\0"..., 84, 0, {sa_family=AF_INET6, sin6_port=htons(111), inet_pton(AF_INET6, "::1", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 84
poll([{fd=4, events=POLLIN}], 1, 15000) = 0 (Timeout)
sendto(4, "W\34\326\267\0\0\0\0\0\0\0\2\0\1\206\240\0\0\0\4\0\0\0\3\0\0\0\0\0\0\0\0"..., 84, 0, {sa_family=AF_INET6, sin6_port=htons(111), inet_pton(AF_INET6, "::1", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 84
poll([{fd=4, events=POLLIN}], 1, 15000) = 0 (Timeout)
Both cases are similar:
* showmount --no-headers --exports localhost
* showmount --no-headers --exports ::1
So, passing 127.0.0.1 we are explicitly requiring a IPv4 connection
and that will speed up the feature test *as well as* return the
correct result, not a simply timeout:
sendto(4, "W\37\256\365\0\0\0\0\0\0\0\2\0\1\206\240\0\0\0\2\0\0\0\3\0\0\0\0\0\0\0\0"..., 56, 0, {sa_family=AF_INET, sin_port=htons(111), sin_addr=inet_addr("127.0.0.1")}, 16) = 56
poll([{fd=4, events=POLLIN}], 1, 15000) = 1 ([{fd=4, revents=POLLERR}])
recvmsg(4, {msg_name(16)={sa_family=AF_INET, sin_port=htons(111), sin_addr=inet_addr("127.0.0.1")}, msg_iov(1)=[{"W\37\256\365\0\0\0\0\0\0\0\2\0\1\206\240\0\0\0\2\0\0\0\3\0\0\0\0\0\0\0\0"..., 56}], msg_controllen=48, [{cmsg_len=48, cmsg_level=SOL_IP, cmsg_type=IP_RECVERR, {ee_errno=111, ee_origin=2, ee_type=3, ee_code=3, ee_info=0, ee_data=0, offender={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("127.0.0.1")}}}], msg_flags=MSG_ERRQUEUE}, MSG_ERRQUEUE) = 56
Signed-off-by: Jose Ricardo Ziviani <joserz(a)linux.vnet.ibm.com>
---
model/featuretests.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/model/featuretests.py b/model/featuretests.py
index 23e7eeb..2b680c3 100644
--- a/model/featuretests.py
+++ b/model/featuretests.py
@@ -148,7 +148,7 @@ class FeatureTests(object):
@staticmethod
def libvirt_support_nfs_probe(conn):
def _get_xml():
- obj = E.source(E.host(name='localhost'), E.format(type='nfs'))
+ obj = E.source(E.host(name='127.0.0.1'), E.format(type='nfs'))
xml = ET.tostring(obj)
return xml
try:
--
1.9.1
8 years, 8 months