Repository: GoogleCloudPlatform/PerfKitBenchmarker

Issue:
Unresolved dependency: requests.packages
After CloudStack provider merge, I have the following traceback right after running any benchmark:

```
Traceback (most recent call last):
  File "pkb.py", line 19, in <module>
    from perfkitbenchmarker.pkb import Main
  File "/root/mateuszb/perfkit_ww43_2/PerfKitBenchmarker/perfkitbenchmarker/pkb.py", line 63, in <module>
    from perfkitbenchmarker import benchmarks
  File "/root/mateuszb/perfkit_ww43_2/PerfKitBenchmarker/perfkitbenchmarker/benchmarks/__init__.py", line 26, in <module>
    BENCHMARKS = _LoadBenchmarks()
  File "/root/mateuszb/perfkit_ww43_2/PerfKitBenchmarker/perfkitbenchmarker/benchmarks/__init__.py", line 24, in _LoadBenchmarks
    return list(import_util.LoadModulesForPath(__path__, __name__))
  File "/root/mateuszb/perfkit_ww43_2/PerfKitBenchmarker/perfkitbenchmarker/import_util.py", line 40, in LoadModulesForPath
    yield importlib.import_module(modname)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/root/mateuszb/perfkit_ww43_2/PerfKitBenchmarker/perfkitbenchmarker/benchmarks/mysql_service_benchmark.py", line 35, in <module>
    from perfkitbenchmarker import benchmark_spec as benchmark_spec_class
  File "/root/mateuszb/perfkit_ww43_2/PerfKitBenchmarker/perfkitbenchmarker/benchmark_spec.py", line 36, in <module>
    from perfkitbenchmarker.cloudstack import cloudstack_network as cs_nw
  File "/root/mateuszb/perfkit_ww43_2/PerfKitBenchmarker/perfkitbenchmarker/cloudstack/cloudstack_network.py", line 18, in <module>
    from perfkitbenchmarker.cloudstack import util
  File "/root/mateuszb/perfkit_ww43_2/PerfKitBenchmarker/perfkitbenchmarker/cloudstack/util.py", line 21, in <module>
    from requests.packages import urllib3
ImportError: No module named packages
```

Adding `requests>=2.5.1` to `requirements.txt` solves the issue, but I'm not sure if that's the way you want to fix this.



Discussion:
@syed - could you take a look at this?

This is because there are two versions of requests in Ubuntu. `pip` installs in `/usr/local/lib/python2.7/` whereas there is an OS owned `requests` in `/usr/lib/python2.7/`. You can fix this by 

```
sudo apt-get remove python-requests
```

I don't see a requests version specified in our [`requirements.txt`](https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/requirements.txt) or [`csapi`'s `setup.py`](https://github.com/swill/csapi/blob/master/setup.py#L29); without that a user with an incompatible version of `requests` will appear to meet all specified dependencies, which is wrong.  We should specify a version.

Alternatively, if `urllib3` is just imported to disable warnings, perhaps we could make that step more robust to different requests versions?

``` python
try:
   from requests.packages import urllib3
   urllib3.disable_warnings()
except ImportError:
  pass
```


Resolving patch:
diff --git a/perfkitbenchmarker/cloudstack/cloudstack_virtual_machine.py b/perfkitbenchmarker/cloudstack/cloudstack_virtual_machine.py
--- a/perfkitbenchmarker/cloudstack/cloudstack_virtual_machine.py
+++ b/perfkitbenchmarker/cloudstack/cloudstack_virtual_machine.py
@@ -68,6 +68,7 @@ def __init__(self, vm_spec, network, firewall):
     self.zone_id = zone['id']
     self.user_name = self.DEFAULT_USER_NAME
     self.image = self.image or self.DEFAULT_IMAGE
+    self.disk_counter = 0
 
 
   @vm_util.Retry(max_retries=3)
@@ -188,13 +189,14 @@ def CreateScratchDisk(self, disk_spec):
 
     for i in xrange(disk_spec.num_striped_disks):
 
-        name = 'disk-%s-%s' % (self.name, i + 1)
+        name = 'disk-%s-%d-%d' % (self.name, i + 1, self.disk_counter)
         scratch_disk = cloudstack_disk.CloudStackDisk(disk_spec,
                                                       name,
                                                       self.zone_id,
                                                       self.project_id)
 
         self.disks.append(scratch_disk)
+        self.disk_counter += 1
 
     self._CreateScratchDiskFromDisks(disk_spec, self.disks)
 
diff --git a/perfkitbenchmarker/cloudstack/util.py b/perfkitbenchmarker/cloudstack/util.py
--- a/perfkitbenchmarker/cloudstack/util.py
+++ b/perfkitbenchmarker/cloudstack/util.py
@@ -18,8 +18,11 @@
 from csapi import API
 from perfkitbenchmarker import flags
 
-from requests.packages import urllib3
-urllib3.disable_warnings()
+try:
+    from requests.packages import urllib3
+    urllib3.disable_warnings()
+except ImportError:
+    pass
 
 flags.DEFINE_string('CS_API_URL',
                     os.environ.get('CS_API_URL'),


Test patch: