diff --git a/test_set/cvp-spt/README.md b/test_set/cvp-spt/README.md
index 00a200a..125521f 100644
--- a/test_set/cvp-spt/README.md
+++ b/test_set/cvp-spt/README.md
@@ -1,5 +1,12 @@
 # cvp-spt
 Environment variables
 --
-* Set *keystone_api_version* to required keystone API version (like keystone_api_version=2)
-Or it will be set to '3' otherwise
+
+* Set IMAGE_SIZE_MB env variable to have specific image size in cvp-spt/test_glance.py tests
+
+* *cvp-spt.test_glance*   Error may happen while executing images.upload:
+```python
+CommunicationError: Error finding address for http://os-ctl-vip.<>.local:9292/v2/images/8bce33dd-9837-4646-b747-7f7f5ce01092/file:
+Unable to establish connection to http://os-ctl-vip.<>.local:9292/v2/images/8bce33dd-9837-4646-b747-7f7f5ce01092/file: [Errno 32] Broken pipe
+```
+This may happen because of low disk space on ctl node or old cryptography package (will be fixed after upgrading to Python3)
\ No newline at end of file
diff --git a/test_set/cvp-spt/fixtures/base.py b/test_set/cvp-spt/fixtures/base.py
index 5c4b72d..a79d39d 100644
--- a/test_set/cvp-spt/fixtures/base.py
+++ b/test_set/cvp-spt/fixtures/base.py
@@ -56,8 +56,7 @@
 
     os_images_list = [image.id for image in openstack_clients.image.images.list(filters={'name': image_name})]
     if os_images_list.__len__() == 0:
-        print "No images with name {}. This name can be redefined with 'image_name' env var ".format(image_name)
-        exit()
+        pytest.skip("No images with name {}. This name can be redefined with 'image_name' env var ".format(image_name))
 
     os_resource['image_id'] = str(os_images_list[0])
 
diff --git a/test_set/cvp-spt/global_config.yaml b/test_set/cvp-spt/global_config.yaml
index 51af102..f55a2a6 100644
--- a/test_set/cvp-spt/global_config.yaml
+++ b/test_set/cvp-spt/global_config.yaml
@@ -27,3 +27,4 @@
 CMP_HOSTS: []
 nova_timeout: 30
 iperf_prep_string: "sudo /bin/bash -c 'echo \"91.189.88.161        archive.ubuntu.com\" >> /etc/hosts'"
+IMAGE_SIZE_MB: 2000
\ No newline at end of file
diff --git a/test_set/cvp-spt/tests/test_glance.py b/test_set/cvp-spt/tests/test_glance.py
index ab4fe64..5514944 100644
--- a/test_set/cvp-spt/tests/test_glance.py
+++ b/test_set/cvp-spt/tests/test_glance.py
@@ -1,54 +1,88 @@
 import pytest
 import time
 import subprocess
-import  utils
+import utils
+
+
+def is_parsable(value, to):
+    """
+    Check if value can be converted into some type
+    :param value:  input value that should be converted
+    :param to: type of output value like int, float. It's not a string!
+    :return: bool
+    """
+    try:
+        to(value)
+    except:
+        return False
+    return True
 
 
 @pytest.fixture
 def create_image():
-    line = 'echo "Executing dd on $(hostname -f)"; ' \
-           'dd if=/dev/zero of=/tmp/image_mk_framework.dd bs=1M count=9000 ;' \
-           'echo "Free space :" ; ' \
-           'df -H / '
+    image_size_megabytes = utils.get_configuration().get("IMAGE_SIZE_MB")
+    create_file_cmdline = 'dd if=/dev/zero of=/tmp/image_mk_framework.dd bs=1M count={image_size}'.format(
+        image_size=image_size_megabytes)
 
-    subprocess.call(line.split())
-    yield
+    is_cmd_successful = subprocess.call(create_file_cmdline.split()) == 0
+    yield is_cmd_successful
     # teardown
-    subprocess.call('rm /tmp/image_mk_framework.dd'.split())
-    subprocess.call('rm /tmp/image_mk_framework.download'.split())
+    subprocess.call('rm -f /tmp/image_mk_framework.dd'.split())
+    subprocess.call('rm -f /tmp/image_mk_framework.download'.split())
 
 
 def test_speed_glance(create_image, openstack_clients, record_property):
     """
-    Simplified Performance Tests Download / upload lance
-    1. Step download image
-    2. Step upload image
+    Simplified Performance Tests Download / upload Glance
+    1. Create file with random data (dd)
+    2. Upload data as image to glance.
+    3. Download image.
+    4. Measure download/upload speed and print them into stdout
     """
-    image = openstack_clients.image.images.create(
-        name="test_image",
-        disk_format='iso',
-        container_format='bare')
+    image_size_megabytes = utils.get_configuration().get("IMAGE_SIZE_MB")
+    if not is_parsable(image_size_megabytes, int):
+        pytest.fail("Can't convert IMAGE_SIZE_MB={} to 'int'".format(image_size_megabytes))
+    image_size_megabytes = int(image_size_megabytes)
+    if not create_image:
+        pytest.skip("Can't create image, maybe there is lack of disk space to create file {}MB".
+                    format(image_size_megabytes))
+    try:
+        image = openstack_clients.image.images.create(
+            name="test_image",
+            disk_format='iso',
+            container_format='bare')
+    except BaseException as e:
+        pytest.fail("Can't create image in Glance. Occurred error: {}".format(e))
 
+    # FIXME: Error may happens while executing images.upload:
+    #  CommunicationError: Error finding address for
+    #  http://os-ctl-vip.harhipova-cicd-os-test.local:9292/v2/images/8bce33dd-9837-4646-b747-7f7f5ce01092/file: Unable to establish connection to http://os-ctl-vip.harhipova-cicd-os-test.local:9292/v2/images/8bce33dd-9837-4646-b747-7f7f5ce01092/file: [Errno 32] Broken pipe
+    # This may happen because of low disk space on ctl node or old cryptography package
+    # (will be fixed after upgrading to Python3)
     start_time = time.time()
-    openstack_clients.image.images.upload(
-        image.id,
-        image_data=open("/tmp/image_mk_framework.dd", 'rb'))
+    try:
+        openstack_clients.image.images.upload(
+            image.id,
+            image_data=open("/tmp/image_mk_framework.dd", 'rb'))
+    except BaseException as e:
+        pytest.fail("Can't upload image in Glance. Occurred error: {}".format(e))
     end_time = time.time()
 
-    speed_upload = 9000 / (end_time - start_time)
+    speed_upload = image_size_megabytes / (end_time - start_time)
 
     start_time = time.time()
+    # it creates new file /tmp/image_mk_framework.download . It should be removed in teardown
     with open("/tmp/image_mk_framework.download", 'wb') as image_file:
         for item in openstack_clients.image.images.data(image.id):
             image_file.write(item)
     end_time = time.time()
 
-    speed_download = 9000 / (end_time - start_time)
+    speed_download = image_size_megabytes / (end_time - start_time)
 
     openstack_clients.image.images.delete(image.id)
     record_property("Upload", speed_upload)
     record_property("Download", speed_download)
 
-    print "++++++++++++++++++++++++++++++++++++++++"
-    print 'upload - {} Mb/s'.format(speed_upload)
-    print 'download - {} Mb/s'.format(speed_download)
+    print("++++++++++++++++++++++++++++++++++++++++")
+    print('upload - {} Mb/s'.format(speed_upload))
+    print('download - {} Mb/s'.format(speed_download))
diff --git a/test_set/cvp-spt/tests/test_vm2vm.py b/test_set/cvp-spt/tests/test_vm2vm.py
index 4c2ec98..fc93347 100644
--- a/test_set/cvp-spt/tests/test_vm2vm.py
+++ b/test_set/cvp-spt/tests/test_vm2vm.py
@@ -7,7 +7,7 @@
 from utils import ssh
 
 
-def test_vm2vm (openstack_clients, pair, os_resources, record_property):
+def test_vm2vm(openstack_clients, pair, os_resources, record_property):
     os_actions = os_client.OSCliActions(openstack_clients)
     config = utils.get_configuration()
     timeout = int(config.get('nova_timeout', 30))
@@ -52,7 +52,7 @@
             fips.append(fip.id)
             status = openstack_clients.compute.servers.get(vms[i]).status
             if status != 'ACTIVE':
-                print "VM #{0} {1} is not ready. Status {2}".format(i,vms[i].id,status)
+                print("VM #{0} {1} is not ready. Status {2}".format(i,vms[i].id,status))
                 time.sleep(timeout)
                 status = openstack_clients.compute.servers.get(vms[i]).status
             if status != 'ACTIVE':
@@ -63,39 +63,44 @@
             try:
                 ssh.prepare_iperf(fip.ip,private_key=os_resources['keypair'].private_key)
             except Exception as e:
-                print e
-                print "ssh.prepare_iperf was not successful, retry after {} sec".format(timeout)
+                print(e)
+                print("ssh.prepare_iperf was not successful, retry after {} sec".format(timeout))
                 time.sleep(timeout)
                 ssh.prepare_iperf(fip.ip,private_key=os_resources['keypair'].private_key)
-            vm_info.append({'vm': vms[i], 'fip': fip.ip, 'private_address': private_address})   
-        
+            vm_info.append({'vm': vms[i], 'fip': fip.ip, 'private_address': private_address})
+
         transport1 = ssh.SSHTransport(vm_info[0]['fip'], 'ubuntu', password='dd', private_key=os_resources['keypair'].private_key)
 
         result1 = transport1.exec_command('iperf -c {} -t 60 | tail -n 1'.format(vm_info[1]['private_address']))
-        print ' '.join(result1.split()[-2::])
+        print(' '.join(result1.split()[-2::]))
+
         record_property("same {0}-{1}".format(zone1[0],zone2[0]), ' '.join(result1.split()[-2::]))
         result2 = transport1.exec_command('iperf -c {} -t 60 | tail -n 1'.format(vm_info[2]['private_address']))
-        print ' '.join(result2.split()[-2::])
+        print(' '.join(result2.split()[-2::]))
+
         record_property("diff host {0}-{1}".format(zone1[0],zone2[0]), ' '.join(result2.split()[-2::]))
         result3 = transport1.exec_command('iperf -c {} -P 10 -t 60 | tail -n 1'.format(vm_info[2]['private_address']))
-        print ' '.join(result3.split()[-2::])
+        print(' '.join(result3.split()[-2::]))
+
         record_property("dif host 10 threads {0}-{1}".format(zone1[0],zone2[0]), ' '.join(result3.split()[-2::]))
         result4 = transport1.exec_command('iperf -c {} -t 60 | tail -n 1'.format(vm_info[2]['fip']))
-        print ' '.join(result4.split()[-2::])
+        print(' '.join(result4.split()[-2::]))
+
         record_property("diff host fip {0}-{1}".format(zone1[0],zone2[0]), ' '.join(result4.split()[-2::]))
         result5 = transport1.exec_command('iperf -c {} -t 60 | tail -n 1'.format(vm_info[3]['private_address']))
-        print ' '.join(result5.split()[-2::])
+        print(' '.join(result5.split()[-2::]))
+
         record_property("diff host, diff net {0}-{1}".format(zone1[0],zone2[0]), ' '.join(result5.split()[-2::]))
 
-        print "Remove VMs"
+        print("Remove VMs")
         for vm in vms:
             openstack_clients.compute.servers.delete(vm)
-        print "Remove FIPs"
+        print("Remove FIPs")
         for fip in fips:
             openstack_clients.compute.floating_ips.delete(fip)
     except Exception as e:
-        print e
-        print "Something went wrong"
+        print(e)
+        print("Something went wrong")
         for vm in vms:
             openstack_clients.compute.servers.delete(vm)
         for fip in fips:
