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
示例#2
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