Exemplo n.º 1
0
    ' Required if connection_type=xenapi.')
flags.DEFINE_string(
    'xenapi_connection_username', 'root',
    'Username for connection to XenServer/Xen Cloud Platform.'
    ' Used only if connection_type=xenapi.')
flags.DEFINE_string(
    'xenapi_connection_password', None,
    'Password for connection to XenServer/Xen Cloud Platform.'
    ' Used only if connection_type=xenapi.')
flags.DEFINE_integer(
    'xenapi_connection_concurrent', 5,
    'Maximum number of concurrent XenAPI connections.'
    ' Used only if connection_type=xenapi.')
flags.DEFINE_float(
    'xenapi_task_poll_interval', 0.5,
    'The interval used for polling of remote tasks '
    '(Async.VM.start, etc). Used only if '
    'connection_type=xenapi.')
flags.DEFINE_float(
    'xenapi_vhd_coalesce_poll_interval', 5.0,
    'The interval used for polling of coalescing vhds.'
    '  Used only if connection_type=xenapi.')
flags.DEFINE_integer(
    'xenapi_vhd_coalesce_max_attempts', 5,
    'Max number of times to poll for VHD to coalesce.'
    '  Used only if connection_type=xenapi.')
flags.DEFINE_string(
    'xenapi_agent_path', 'usr/sbin/xe-update-networking',
    'Specifies the path in which the xenapi guest agent'
    '  should be located. If the agent is present,'
    '  network configuration is not injected into the image'
Exemplo n.º 2
0
 def test_define_float(self):
     flags.DEFINE_float('float', 6.66, 'desc', flag_values=self.FLAGS)
     self.assertEqual(self.FLAGS.float, 6.66)
Exemplo n.º 3
0
LOG = logging.getLogger("nova.virt.vmwareapi_conn")

FLAGS = flags.FLAGS
flags.DEFINE_string(
    'vmwareapi_host_ip', None, 'URL for connection to VMWare ESX host.'
    'Required if connection_type is vmwareapi.')
flags.DEFINE_string(
    'vmwareapi_host_username', None,
    'Username for connection to VMWare ESX host.'
    'Used only if connection_type is vmwareapi.')
flags.DEFINE_string(
    'vmwareapi_host_password', None,
    'Password for connection to VMWare ESX host.'
    'Used only if connection_type is vmwareapi.')
flags.DEFINE_float(
    'vmwareapi_task_poll_interval', 5.0,
    'The interval used for polling of remote tasks '
    'Used only if connection_type is vmwareapi')
flags.DEFINE_float(
    'vmwareapi_api_retry_count', 10,
    'The number of times we retry on failures, '
    'e.g., socket error, etc.'
    'Used only if connection_type is vmwareapi')
flags.DEFINE_string('vmwareapi_vlan_interface', 'vmnic0',
                    'Physical ethernet adapter name for vlan networking')

TIME_BETWEEN_API_CALL_RETRIES = 2.0


class Failure(Exception):
    """Base Exception class for handling task failures."""
    def __init__(self, details):
Exemplo n.º 4
0
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

from nova import flags
from nova import log as logging
from nova.scheduler.filters import abstract_filter

LOG = logging.getLogger('nova.scheduler.filter.core_filter')

FLAGS = flags.FLAGS
flags.DEFINE_float('cpu_allocation_ratio', 16.0,
                   'Virtual CPU to Physical CPU allocation ratio')


class CoreFilter(abstract_filter.AbstractHostFilter):
    """CoreFilter filters based on CPU core utilization."""
    def host_passes(self, host_state, filter_properties):
        """Return True if host has sufficient CPU cores."""
        instance_type = filter_properties.get('instance_type')
        if host_state.topic != 'compute' or not instance_type:
            return True

        if not host_state.vcpus_total:
            # Fail safe
            LOG.warning(_("VCPUs not set; assuming CPU collection broken"))
            return True
Exemplo n.º 5
0
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

from nova import flags
from nova import log as logging
from nova.scheduler.filters import abstract_filter

LOG = logging.getLogger('nova.scheduler.filter.ram_filter')

FLAGS = flags.FLAGS
flags.DEFINE_float("ram_allocation_ratio", 1.0,
                   "virtual ram to physical ram allocation ratio")


class RamFilter(abstract_filter.AbstractHostFilter):
    """Ram Filter with over subscription flag"""
    def host_passes(self, host_state, filter_properties):
        """Only return hosts with sufficient available RAM."""
        instance_type = filter_properties.get('instance_type')
        requested_ram = instance_type['memory_mb']
        free_ram_mb = host_state.free_ram_mb
        return free_ram_mb * FLAGS.ram_allocation_ratio >= requested_ram
Exemplo n.º 6
0
"""

from nova import flags
from nova import log as logging
from nova import exception

LOG = logging.getLogger('nova.scheduler.least_cost')

FLAGS = flags.FLAGS
flags.DEFINE_list('least_cost_functions',
                  ['nova.scheduler.least_cost.compute_fill_first_cost_fn'],
                  'Which cost functions the LeastCostScheduler should use.')

# TODO(sirp): Once we have enough of these rules, we can break them out into a
# cost_functions.py file (perhaps in a least_cost_scheduler directory)
flags.DEFINE_float('noop_cost_fn_weight', 1.0,
                   'How much weight to give the noop cost function')
flags.DEFINE_float('compute_fill_first_cost_fn_weight', 1.0,
                   'How much weight to give the fill-first cost function')


class WeightedHost(object):
    """Reduced set of information about a host that has been weighed.
    This is an attempt to remove some of the ad-hoc dict structures
    previously used."""
    def __init__(self, weight, host=None, blob=None, zone=None, hostinfo=None):
        self.weight = weight
        self.blob = blob
        self.host = host
        self.zone = zone

        # Local members. These are not returned outside of the Zone.