Commit 6d287f3a authored by Łukasz Nowak's avatar Łukasz Nowak

software/kvm: Enable downloadable images in cluster

The image-url-list parameter is passed-thru only if it's present in the
original request, as the default instance differentiates correctly between
parameter existence or emptiness (or being None).
parent 0d3e8749
......@@ -23,7 +23,7 @@ md5sum = aa734942801ac62eeccaba43926a0a27
filename =
md5sum = 73b09e75d617888f6d84d363c0ada9c5
md5sum = b91a0e8b083caa924699f601ca15729e
filename = instance-kvm-resilient.cfg.jinja2
......@@ -42,6 +42,12 @@
"type": "string",
"format": "uri",
"default": ""
"image-url-list": {
"title": "List of URLs images to download",
"description": "The list shall be list of direct URLs to images, followed by hash (#), then by image MD5SUM. Each image shall appear on newline, like: \"<newline>\". They will be provided in KVM image list according to the order on the list. After updating the list, the instance has to be restarted to refresh it. Amount of images is limited to 4, and one image can be maximum 5G. Image will be downloaded and checked against its MD5SUM 4 times, then it will be considered as impossible to download with given MD5SUM. Each image has to be downloaded in time shorter than 4 hours, so in case of very slow images to access, it can take up to 16 hours to download all of them. Note: The instance has to be restarted in order to update the list of available images in the VM.",
"type": "string",
"textarea": "true"
"type": "object"
......@@ -127,6 +127,10 @@ config-document-host = ${apache-conf:ip}
config-document-port = ${apache-conf:port}
config-document-path = ${hash-code:passwd}
config-keyboard-layout-language = {{ dumps(kvm_parameter_dict.get('keyboard-layout-language', 'fr')) }}
{%- if 'image-url-list' in kvm_parameter_dict %}
{#- play nice: if parameter was not constructed by the original request, do not send it at all #}
config-image-url-list = {{ kvm_parameter_dict['image-url-list'] }}
{%- endif %}
config-type = cluster
{% set bootstrap_script_url = slapparameter_dict.get('bootstrap-script-url', kvm_parameter_dict.get('bootstrap-script-url', '')) -%}
......@@ -672,3 +672,60 @@ class TestImageUrlList(InstanceTestCase):
class TestImageUrlListKvmCluster(InstanceTestCase):
__partition_reference__ = 'iulkc'
def getInstanceSoftwareType(cls):
return 'kvm-cluster'
fake_image, = (
fake_image_md5sum = "c98825aa1b6c8087914d2bfcafec3058"
fake_image2, = (
fake_image2_md5sum = "d4316a4d05f527d987b9d6e43e4c2bc6"
def getInstanceParameterDict(cls):
return {'_': json.dumps({
"kvm-partition-dict": {
"KVM0": {
"disable-ansible-promise": True,
"image-url-list": "%s#%s" % (
cls.fake_image, cls.fake_image_md5sum)
"KVM1": {
"disable-ansible-promise": True,
"image-url-list": "%s#%s" % (
cls.fake_image2, cls.fake_image2_md5sum)
def test(self):
# Note: As there is no way to introspect nicely where partition landed
# we assume ordering of the cluster requests
KVM0_config = os.path.join(
self.slap.instance_directory, self.__partition_reference__ + '1', 'etc',
KVM1_config = os.path.join(
self.slap.instance_directory, self.__partition_reference__ + '2', 'etc',
with open(KVM0_config, 'r') as fh:
"%s#%s" % (self.fake_image, self.fake_image_md5sum),
with open(KVM1_config, 'r') as fh:
"%s#%s" % (self.fake_image2, self.fake_image2_md5sum),
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment