예제 #1
0
 def __init__(self, pool):
     self.__nclient = utils.NovaClient()
     # TODO(meteorfox) Is this lock needed? Callers to these methods seem
     # to be using a lock already. Should we make callers use a lock, or
     # should this object handle the lock?
     self.__floating_ip_lock = threading.Lock()
     self.ip_pool_name = pool
    def __init__(self, vm_spec):
        """Initialize an OpenStack virtual machine.

        Args:
          vm_spec: virtual_machine.BaseVirtualMachineSpec object of the vm.
        """
        super(OpenStackVirtualMachine, self).__init__(vm_spec)
        self.firewall = os_network.OpenStackFirewall.GetFirewall()
        self.firewall.AllowICMP(self)
        self.firewall.AllowPort(self, 1, os_network.MAX_PORT)
        self.name = 'perfkit_vm_%d_%s' % (self.instance_number, FLAGS.run_uri)
        self.key_name = 'perfkit_key_%d_%s' % (self.instance_number,
                                               FLAGS.run_uri)
        self.client = os_utils.NovaClient()
        # FIXME(meteorfox): Remove --openstack_public_network and
        # --openstack_private_network once depreciation time has expired
        self.network_name = (FLAGS.openstack_network
                             or FLAGS.openstack_private_network)
        self.floating_ip_pool_name = (FLAGS.openstack_floating_ip_pool
                                      or FLAGS.openstack_public_network)
        self.public_network = os_network.OpenStackPublicNetwork(
            FLAGS.openstack_floating_ip_pool)
        self.id = None
        self.pk = None
        self.user_name = FLAGS.openstack_image_username
        self.boot_wait_time = None
        self.image = self.image or self.DEFAULT_IMAGE
        self.public_net = None
        self.private_net = None
        self.floating_ip = None
예제 #3
0
 def __init__(self, disk_spec, name, zone, image=None):
     super(OpenStackDisk, self).__init__(disk_spec)
     self.__nclient = os_utils.NovaClient()
     self.attached_vm_name = None
     self.attached_vm_id = -1
     self.image = image
     self.name = name
     self.zone = zone
     self.device = ""
     self._disk = None
예제 #4
0
    def __init__(self):
        self.sec_group_rules_set = set()
        self.__nclient = utils.NovaClient()

        with self._lock:
            if not (self.__nclient.security_groups.findall(
                    name='perfkit_sc_group')):
                self.sec_group = self.__nclient.security_groups.create(
                    'perfkit_sc_group',
                    'Firewall configuration for Perfkit Benchmarker')
            else:
                self.sec_group = self.__nclient.security_groups.findall(
                    name='perfkit_sc_group')[0]
예제 #5
0
    def __init__(self):
        super(OpenStackFirewall, self).__init__()
        self.__nclient = utils.NovaClient()

        if not (self.__nclient.security_groups.findall(
                name='perfkit_sc_group')):
            self.sec_group = self.__nclient.security_groups.create(
                'perfkit_sc_group',
                'Firewall configuration for Perfkit Benchmarker')
        else:
            self.sec_group = self.__nclient.security_groups.findall(
                name='perfkit_sc_group')[0]

        self.AllowPort(None, -1, protocol='icmp')
        self.AllowPort(None, 1, MAX_PORT)
예제 #6
0
    def __init__(self, vm_spec):
        """Initialize an OpenStack virtual machine.

        Args:
          vm_spec: virtual_machine.BaseVirtualMachineSpec object of the vm.
        """
        super(OpenStackVirtualMachine, self).__init__(vm_spec)
        self.firewall = os_network.OpenStackFirewall.GetFirewall()
        self.name = 'perfkit_vm_%d_%s' % (self.instance_number, FLAGS.run_uri)
        self.key_name = 'perfkit_key_%d_%s' % (self.instance_number,
                                               FLAGS.run_uri)
        self.client = os_utils.NovaClient()
        self.public_network = os_network.OpenStackPublicNetwork(
            FLAGS.openstack_public_network)
        self.id = None
        self.pk = None
        self.user_name = FLAGS.openstack_image_username
        self.boot_wait_time = None
        self.image = self.image or self.DEFAULT_IMAGE
예제 #7
0
 def __init__(self, pool):
     self.__nclient = utils.NovaClient()
     self.__floating_ip_lock = threading.Lock()
     self.ip_pool_name = pool