[ARVADOS] updated: 5467f4df22cadc04e0dedd28efbf59b8aedf13b9

Git user git at public.curoverse.com
Tue Jun 20 10:25:14 EDT 2017


Summary of changes:
 services/nodemanager/arvnodeman/computenode/driver/ec2.py |  7 +++++--
 services/nodemanager/tests/test_computenode_driver_ec2.py | 13 +++++++++++++
 services/nodemanager/tests/testutil.py                    |  3 ++-
 3 files changed, 20 insertions(+), 3 deletions(-)

       via  5467f4df22cadc04e0dedd28efbf59b8aedf13b9 (commit)
      from  495c902b59cebb965c610b7bec7fca64831c6e3a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 5467f4df22cadc04e0dedd28efbf59b8aedf13b9
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Tue Jun 20 10:25:09 2017 -0400

    8186: Round up ec2 ebs volume sizes.  Warn if size is out of range.  Add test
    for creating ec2 instance with ebs storage.

diff --git a/services/nodemanager/arvnodeman/computenode/driver/ec2.py b/services/nodemanager/arvnodeman/computenode/driver/ec2.py
index b256eca..39c7d19 100644
--- a/services/nodemanager/arvnodeman/computenode/driver/ec2.py
+++ b/services/nodemanager/arvnodeman/computenode/driver/ec2.py
@@ -70,13 +70,16 @@ class ComputeNodeDriver(BaseComputeNodeDriver):
         kw = {'name': self.create_cloud_name(arvados_node),
                 'ex_userdata': self._make_ping_url(arvados_node)}
         # libcloud/ec2 disk sizes are in GB, Arvados/SLURM "scratch" value is in MB
-        scratch = size.scratch / 1000
+        scratch = int(size.scratch / 1000) + 1
         if scratch > size.disk:
+            volsize = scratch - size.disk
+            if volsize < 1 or volsize > 16384:
+                self._logger.warn("Requested VolumeSize is %i GB, which is outside the range (1, 16384), node create request is likely to fail", volsize)
             kw["ex_blockdevicemappings"] = [{
                 "DeviceName": "/dev/xvdt",
                 "Ebs": {
                     "DeleteOnTermination": True,
-                    "VolumeSize": scratch - size.disk,
+                    "VolumeSize": volsize,
                     "VolumeType": "gp2"
                 }}]
         return kw
diff --git a/services/nodemanager/tests/test_computenode_driver_ec2.py b/services/nodemanager/tests/test_computenode_driver_ec2.py
index 14df360..3823a78 100644
--- a/services/nodemanager/tests/test_computenode_driver_ec2.py
+++ b/services/nodemanager/tests/test_computenode_driver_ec2.py
@@ -96,3 +96,16 @@ class EC2ComputeNodeDriverTestCase(testutil.DriverTestMixin, unittest.TestCase):
         node = testutil.cloud_node_mock()
         node.name = name
         self.assertEqual(name, ec2.ComputeNodeDriver.node_fqdn(node))
+
+    def test_create_ebs_volume(self):
+        arv_node = testutil.arvados_node_mock()
+        driver = self.new_driver()
+        # libcloud/ec2 "disk" sizes are in GB, Arvados/SLURM "scratch" value is in MB
+        size = testutil.MockSize(1)
+        size.disk=5
+        size.scratch=20000
+        driver.create_node(size, arv_node)
+        create_method = self.driver_mock().create_node
+        self.assertTrue(create_method.called)
+        self.assertEqual(16,
+                      create_method.call_args[1].get('ex_blockdevicemappings')[0]["Ebs"]["VolumeSize"])
diff --git a/services/nodemanager/tests/testutil.py b/services/nodemanager/tests/testutil.py
index 41f4ed1..1ee7690 100644
--- a/services/nodemanager/tests/testutil.py
+++ b/services/nodemanager/tests/testutil.py
@@ -79,7 +79,8 @@ class MockSize(object):
         self.id = 'z{}.test'.format(factor)
         self.name = self.id
         self.ram = 128 * factor
-        self.disk = 100 * factor
+        self.disk = factor   # GB
+        self.scratch = 1000 * factor # MB
         self.bandwidth = 16 * factor
         self.price = float(factor)
         self.extra = {}

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list