Skip to content

Instantly share code, notes, and snippets.

@meteorfox
Created October 12, 2015 02:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meteorfox/2de16488361ae8b1c014 to your computer and use it in GitHub Desktop.
Save meteorfox/2de16488361ae8b1c014 to your computer and use it in GitHub Desktop.
From c7991ce6f78d5c6d34ac4e246d86313c041622d5 Mon Sep 17 00:00:00 2001
From: "Carlos L. Torres" <carlos.torres@rackspace.com>
Date: Sun, 11 Oct 2015 21:13:40 -0500
Subject: [PATCH] rackspace: Fix to allow for benchmark_config_files
Signed-off-by: Carlos L. Torres <carlos.torres@rackspace.com>
---
perfkitbenchmarker/rackspace/rackspace_network.py | 2 +-
.../rackspace/rackspace_virtual_machine.py | 21 +++------------------
2 files changed, 4 insertions(+), 19 deletions(-)
diff --git a/perfkitbenchmarker/rackspace/rackspace_network.py b/perfkitbenchmarker/rackspace/rackspace_network.py
index bf86c4d..7603a51 100644
--- a/perfkitbenchmarker/rackspace/rackspace_network.py
+++ b/perfkitbenchmarker/rackspace/rackspace_network.py
@@ -41,7 +41,7 @@ SSH_PORT = 22
class RackspaceSecurityGroup(network.BaseFirewall):
"""An object representing the Rackspace Security Group."""
- def __init__(self, project):
+ def __init__(self):
"""Initialize Rackspace security group class."""
self._lock = threading.Lock()
self.firewall_names = set()
diff --git a/perfkitbenchmarker/rackspace/rackspace_virtual_machine.py b/perfkitbenchmarker/rackspace/rackspace_virtual_machine.py
index 8d24fc9..1c20097 100644
--- a/perfkitbenchmarker/rackspace/rackspace_virtual_machine.py
+++ b/perfkitbenchmarker/rackspace/rackspace_virtual_machine.py
@@ -83,10 +83,6 @@ class RackspaceVirtualMachine(virtual_machine.BaseVirtualMachine):
# Subclasses should override the default image.
DEFAULT_IMAGE = None
- count = 1
- _lock = threading.Lock()
- has_keypair = False
-
"Object representing a Rackspace Virtual Machine"
def __init__(self, vm_spec, network, firewall):
"""Initialize Rackspace virtual machine
@@ -98,11 +94,6 @@ class RackspaceVirtualMachine(virtual_machine.BaseVirtualMachine):
"""
super(RackspaceVirtualMachine, self).__init__(vm_spec, network, firewall)
- with RackspaceVirtualMachine._lock:
- self.name = 'perfkit-%s-%s' % (FLAGS.run_uri,
- RackspaceVirtualMachine.count)
- self.device_id = RackspaceVirtualMachine.count
- RackspaceVirtualMachine.count += 1
self.id = ''
self.ip_address6 = ''
@@ -122,7 +113,7 @@ class RackspaceVirtualMachine(virtual_machine.BaseVirtualMachine):
raise errors.Error(
'There was a problem while retrieving machine_type'
' information from the cloud provider.')
- vm_spec.image = self.image or self.DEFAULT_IMAGE
+ self.image = self.image or self.DEFAULT_IMAGE
def CreateKeyPair(self):
"""Imports the public keyfile to Rackspace."""
@@ -150,17 +141,11 @@ class RackspaceVirtualMachine(virtual_machine.BaseVirtualMachine):
def _CreateDependencies(self):
"""Create VM dependencies."""
- with RackspaceVirtualMachine._lock:
- if not RackspaceVirtualMachine.has_keypair:
- self.CreateKeyPair()
- RackspaceVirtualMachine.has_keypair = True
+ self.CreateKeyPair()
def _DeleteDependencies(self):
"""Delete VM dependencies."""
- with RackspaceVirtualMachine._lock:
- if RackspaceVirtualMachine.has_keypair:
- self.DeleteKeyPair()
- RackspaceVirtualMachine.has_keypair = False
+ self.DeleteKeyPair()
def _Create(self):
"""Create a Rackspace instance."""
--
2.1.4
@meteorfox
Copy link
Author

This is a git patch, to apply simply do this:

git am --signoff < rackspace_config_bug_fixes.patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment