diff options
Diffstat (limited to 'nova/virt')
| -rw-r--r-- | nova/virt/disk/api.py | 59 | ||||
| -rw-r--r-- | nova/virt/disk/nbd.py | 16 | ||||
| -rw-r--r-- | nova/virt/firewall.py | 12 | ||||
| -rw-r--r-- | nova/virt/libvirt/connection.py | 135 | ||||
| -rw-r--r-- | nova/virt/libvirt/utils.py | 11 | ||||
| -rw-r--r-- | nova/virt/libvirt/vif.py | 10 | ||||
| -rw-r--r-- | nova/virt/vmwareapi/vim.py | 16 | ||||
| -rw-r--r-- | nova/virt/vmwareapi/vmops.py | 11 | ||||
| -rw-r--r-- | nova/virt/vmwareapi_conn.py | 53 | ||||
| -rw-r--r-- | nova/virt/xenapi/vif.py | 10 | ||||
| -rw-r--r-- | nova/virt/xenapi/vm_utils.py | 19 | ||||
| -rw-r--r-- | nova/virt/xenapi/vmops.py | 34 | ||||
| -rw-r--r-- | nova/virt/xenapi_conn.py | 128 |
13 files changed, 301 insertions, 213 deletions
diff --git a/nova/virt/disk/api.py b/nova/virt/disk/api.py index 1cd697347..0f0b13b7f 100644 --- a/nova/virt/disk/api.py +++ b/nova/virt/disk/api.py @@ -29,6 +29,7 @@ import json import os import tempfile +from nova.common import cfg from nova import exception from nova import flags from nova import log as logging @@ -37,35 +38,41 @@ from nova.virt.disk import guestfs from nova.virt.disk import loop from nova.virt.disk import nbd + LOG = logging.getLogger('nova.compute.disk') -FLAGS = flags.FLAGS -flags.DEFINE_string('injected_network_template', - utils.abspath('virt/interfaces.template'), - 'Template file for injected network') -flags.DEFINE_list('img_handlers', ['loop', 'nbd', 'guestfs'], - 'Order of methods used to mount disk images') +disk_opts = [ + cfg.StrOpt('injected_network_template', + default=utils.abspath('virt/interfaces.template'), + help='Template file for injected network'), + cfg.ListOpt('img_handlers', + default=['loop', 'nbd', 'guestfs'], + help='Order of methods used to mount disk images'), + + # NOTE(yamahata): ListOpt won't work because the command may include a + # comma. For example: + # + # mkfs.ext3 -O dir_index,extent -E stride=8,stripe-width=16 + # --label %(fs_label)s %(target)s + # + # list arguments are comma separated and there is no way to + # escape such commas. + # + cfg.MultiStrOpt('virt_mkfs', + default=[ + 'default=mkfs.ext3 -L %(fs_label)s -F %(target)s', + 'linux=mkfs.ext3 -L %(fs_label)s -F %(target)s', + 'windows=' + 'mkfs.ntfs --fast --label %(fs_label)s %(target)s', + # NOTE(yamahata): vfat case + #'windows=mkfs.vfat -n %(fs_label)s %(target)s', + ], + help='mkfs commands for ephemeral device. ' + 'The format is <os_type>=<mkfs command>'), + ] -# NOTE(yamahata): DEFINE_list() doesn't work because the command may -# include ','. For example, -# mkfs.ext3 -O dir_index,extent -E stride=8,stripe-width=16 -# --label %(fs_label)s %(target)s -# -# DEFINE_list() parses its argument by -# [s.strip() for s in argument.split(self._token)] -# where self._token = ',' -# No escape nor exceptional handling for ','. -# DEFINE_list() doesn't give us what we need. -flags.DEFINE_multistring('virt_mkfs', - ['windows=mkfs.ntfs --fast --label %(fs_label)s ' - '%(target)s', - # NOTE(yamahata): vfat case - #'windows=mkfs.vfat -n %(fs_label)s %(target)s', - 'linux=mkfs.ext3 -L %(fs_label)s -F %(target)s', - 'default=mkfs.ext3 -L %(fs_label)s -F %(target)s'], - 'mkfs commands for ephemeral device. The format is' - '<os_type>=<mkfs command>') - +FLAGS = flags.FLAGS +FLAGS.add_options(disk_opts) _MKFS_COMMAND = {} _DEFAULT_MKFS_COMMAND = None diff --git a/nova/virt/disk/nbd.py b/nova/virt/disk/nbd.py index 55b287ebb..19904d694 100644 --- a/nova/virt/disk/nbd.py +++ b/nova/virt/disk/nbd.py @@ -18,15 +18,23 @@ import os import time +from nova.common import cfg from nova import flags from nova import utils from nova.virt.disk import mount + +nbd_opts = [ + cfg.IntOpt('timeout_nbd', + default=10, + help='time to wait for a NBD device coming up'), + cfg.IntOpt('max_nbd_devices', + default=16, + help='maximum number of possible nbd devices'), + ] + FLAGS = flags.FLAGS -flags.DEFINE_integer('timeout_nbd', 10, - 'time to wait for a NBD device coming up') -flags.DEFINE_integer('max_nbd_devices', 16, - 'maximum number of possible nbd devices') +FLAGS.add_options(nbd_opts) class Mount(mount.Mount): diff --git a/nova/virt/firewall.py b/nova/virt/firewall.py index ed60051d9..604aa101a 100644 --- a/nova/virt/firewall.py +++ b/nova/virt/firewall.py @@ -17,6 +17,7 @@ # License for the specific language governing permissions and limitations # under the License. +from nova.common import cfg from nova import context from nova import db from nova import flags @@ -24,11 +25,16 @@ from nova import log as logging from nova import utils from nova.virt import netutils + LOG = logging.getLogger("nova.virt.firewall") + +allow_same_net_traffic_opt = \ + cfg.BoolOpt('allow_same_net_traffic', + default=True, + help='Whether to allow network traffic from same network') + FLAGS = flags.FLAGS -flags.DEFINE_bool('allow_same_net_traffic', - True, - 'Whether to allow network traffic from same network') +FLAGS.add_option(allow_same_net_traffic_opt) class FirewallDriver(object): diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py index df0cd5725..edd2c4741 100644 --- a/nova/virt/libvirt/connection.py +++ b/nova/virt/libvirt/connection.py @@ -54,6 +54,7 @@ from xml.etree import ElementTree from nova.auth import manager from nova import block_device +from nova.common import cfg from nova.compute import instance_types from nova.compute import power_state from nova import context as nova_context @@ -75,70 +76,84 @@ Template = None LOG = logging.getLogger('nova.virt.libvirt_conn') +libvirt_opts = [ + cfg.StrOpt('rescue_image_id', + default=None, + help='Rescue ami image'), + cfg.StrOpt('rescue_kernel_id', + default=None, + help='Rescue aki image'), + cfg.StrOpt('rescue_ramdisk_id', + default=None, + help='Rescue ari image'), + cfg.StrOpt('libvirt_xml_template', + default=utils.abspath('virt/libvirt.xml.template'), + help='Libvirt XML Template'), + cfg.StrOpt('libvirt_type', + default='kvm', + help='Libvirt domain type (valid options are: ' + 'kvm, lxc, qemu, uml, xen)'), + cfg.StrOpt('libvirt_uri', + default='', + help='Override the default libvirt URI ' + '(which is dependent on libvirt_type)'), + cfg.BoolOpt('use_cow_images', + default=True, + help='Whether to use cow images'), + cfg.StrOpt('ajaxterm_portrange', + default='10000-12000', + help='Range of ports that ajaxterm should try to bind'), + cfg.StrOpt('cpuinfo_xml_template', + default=utils.abspath('virt/cpuinfo.xml.template'), + help='CpuInfo XML Template (Used only live migration now)'), + cfg.StrOpt('live_migration_uri', + default="qemu+tcp://%s/system", + help='Define protocol used by live_migration feature'), + cfg.StrOpt('live_migration_flag', + default='VIR_MIGRATE_UNDEFINE_SOURCE, VIR_MIGRATE_PEER2PEER', + help='Define live migration behavior.'), + cfg.StrOpt('block_migration_flag', + default='VIR_MIGRATE_UNDEFINE_SOURCE, VIR_MIGRATE_PEER2PEER, ' + 'VIR_MIGRATE_NON_SHARED_INC', + help='Define block migration behavior.'), + cfg.IntOpt('live_migration_bandwidth', + default=0, + help='Define live migration behavior'), + cfg.StrOpt('snapshot_image_format', + default=None, + help='Snapshot image format (valid options are : ' + 'raw, qcow2, vmdk, vdi). ' + 'Defaults to same as source image'), + cfg.StrOpt('libvirt_vif_type', + default='bridge', + help='Type of VIF to create.'), + cfg.StrOpt('libvirt_vif_driver', + default='nova.virt.libvirt.vif.LibvirtBridgeDriver', + help='The libvirt VIF driver to configure the VIFs.'), + cfg.ListOpt('libvirt_volume_drivers', + default=[ + 'iscsi=nova.virt.libvirt.volume.LibvirtISCSIVolumeDriver', + 'local=nova.virt.libvirt.volume.LibvirtVolumeDriver', + 'fake=nova.virt.libvirt.volume.LibvirtFakeVolumeDriver', + 'rbd=nova.virt.libvirt.volume.LibvirtNetVolumeDriver', + 'sheepdog=nova.virt.libvirt.volume.LibvirtNetVolumeDriver' + ], + help='Libvirt handlers for remote volumes.'), + cfg.BoolOpt('libvirt_use_virtio_for_bridges', + default=False, + help='Use virtio for bridge interfaces'), + cfg.StrOpt('libvirt_disk_prefix', + default=None, + help='Override the default disk prefix for the devices attached' + ' to a server, which is dependent on libvirt_type. ' + '(valid options are: sd, xvd, uvd, vd)'), + ] FLAGS = flags.FLAGS +FLAGS.add_options(libvirt_opts) + flags.DECLARE('live_migration_retry_count', 'nova.compute.manager') flags.DECLARE('vncserver_proxyclient_address', 'nova.vnc') -# TODO(vish): These flags should probably go into a shared location -flags.DEFINE_string('rescue_image_id', None, 'Rescue ami image') -flags.DEFINE_string('rescue_kernel_id', None, 'Rescue aki image') -flags.DEFINE_string('rescue_ramdisk_id', None, 'Rescue ari image') -flags.DEFINE_string('libvirt_xml_template', - utils.abspath('virt/libvirt.xml.template'), - 'Libvirt XML Template') -flags.DEFINE_string('libvirt_type', - 'kvm', - 'Libvirt domain type (valid options are: ' - 'kvm, lxc, qemu, uml, xen)') -flags.DEFINE_string('libvirt_uri', - '', - 'Override the default libvirt URI (which is dependent' - ' on libvirt_type)') -flags.DEFINE_bool('use_cow_images', - True, - 'Whether to use cow images') -flags.DEFINE_string('ajaxterm_portrange', - '10000-12000', - 'Range of ports that ajaxterm should randomly try to bind') -flags.DEFINE_string('cpuinfo_xml_template', - utils.abspath('virt/cpuinfo.xml.template'), - 'CpuInfo XML Template (Used only live migration now)') -flags.DEFINE_string('live_migration_uri', - "qemu+tcp://%s/system", - 'Define protocol used by live_migration feature') -flags.DEFINE_string('live_migration_flag', - "VIR_MIGRATE_UNDEFINE_SOURCE, VIR_MIGRATE_PEER2PEER", - 'Define live migration behavior.') -flags.DEFINE_string('block_migration_flag', - "VIR_MIGRATE_UNDEFINE_SOURCE, VIR_MIGRATE_PEER2PEER, " - "VIR_MIGRATE_NON_SHARED_INC", - 'Define block migration behavior.') -flags.DEFINE_integer('live_migration_bandwidth', 0, - 'Define live migration behavior') -flags.DEFINE_string('snapshot_image_format', None, - 'Snapshot image format (valid options are : ' - 'raw, qcow2, vmdk, vdi).' - 'Defaults to same as source image') -flags.DEFINE_string('libvirt_vif_type', 'bridge', - 'Type of VIF to create.') -flags.DEFINE_string('libvirt_vif_driver', - 'nova.virt.libvirt.vif.LibvirtBridgeDriver', - 'The libvirt VIF driver to configure the VIFs.') -flags.DEFINE_list('libvirt_volume_drivers', - ['iscsi=nova.virt.libvirt.volume.LibvirtISCSIVolumeDriver', - 'local=nova.virt.libvirt.volume.LibvirtVolumeDriver', - 'fake=nova.virt.libvirt.volume.LibvirtFakeVolumeDriver', - 'rbd=nova.virt.libvirt.volume.LibvirtNetVolumeDriver', - 'sheepdog=nova.virt.libvirt.volume.LibvirtNetVolumeDriver'], - 'Libvirt handlers for remote volumes.') -flags.DEFINE_bool('libvirt_use_virtio_for_bridges', - False, - 'Use virtio for bridge interfaces') -flags.DEFINE_string('libvirt_disk_prefix', - None, - 'Override the default disk prefix for the devices ' - 'attached to a server, which is dependent on ' - 'libvirt_type. (valid options are: sd, xvd, uvd, vd)') def get_connection(read_only): diff --git a/nova/virt/libvirt/utils.py b/nova/virt/libvirt/utils.py index c21b003bb..51fd9044f 100644 --- a/nova/virt/libvirt/utils.py +++ b/nova/virt/libvirt/utils.py @@ -23,16 +23,21 @@ import os import random import shutil +from nova.common import cfg from nova import exception from nova import flags from nova import utils from nova.virt.disk import api as disk from nova.virt import images -FLAGS = flags.FLAGS -flags.DEFINE_string('qemu_img', 'qemu-img', - 'binary to use for qemu-img commands') +qemu_img_opt = \ + cfg.StrOpt('qemu_img', + default='qemu-img', + help='binary to use for qemu-img commands') + +FLAGS = flags.FLAGS +FLAGS.add_option(qemu_img_opt) def execute(*args, **kwargs): diff --git a/nova/virt/libvirt/vif.py b/nova/virt/libvirt/vif.py index d4375f6da..503c33d0f 100644 --- a/nova/virt/libvirt/vif.py +++ b/nova/virt/libvirt/vif.py @@ -19,6 +19,7 @@ """VIF drivers for libvirt.""" +from nova.common import cfg from nova import exception from nova import flags from nova import log as logging @@ -30,10 +31,13 @@ from nova.virt.vif import VIFDriver LOG = logging.getLogger('nova.virt.libvirt.vif') -FLAGS = flags.FLAGS +libvirt_ovs_bridge_opt = \ + cfg.StrOpt('libvirt_ovs_bridge', + default='br-int', + help='Name of Integration Bridge used by Open vSwitch') -flags.DEFINE_string('libvirt_ovs_bridge', 'br-int', - 'Name of Integration Bridge used by Open vSwitch') +FLAGS = flags.FLAGS +FLAGS.add_option(libvirt_ovs_bridge_opt) class LibvirtBridgeDriver(VIFDriver): diff --git a/nova/virt/vmwareapi/vim.py b/nova/virt/vmwareapi/vim.py index 9a0647b28..0ce1be645 100644 --- a/nova/virt/vmwareapi/vim.py +++ b/nova/virt/vmwareapi/vim.py @@ -26,6 +26,7 @@ try: except ImportError: suds = None +from nova.common import cfg from nova import flags from nova.virt.vmwareapi import error_util @@ -33,13 +34,16 @@ RESP_NOT_XML_ERROR = 'Response is "text/html", not "text/xml"' CONN_ABORT_ERROR = 'Software caused connection abort' ADDRESS_IN_USE_ERROR = 'Address already in use' +vmwareapi_wsdl_loc_opt = \ + cfg.StrOpt('vmwareapi_wsdl_loc', + default=None, + help='VIM Service WSDL Location ' + 'e.g http://<server>/vimService.wsdl. ' + 'Due to a bug in vSphere ESX 4.1 default wsdl. ' + 'Refer readme-vmware to setup') + FLAGS = flags.FLAGS -flags.DEFINE_string('vmwareapi_wsdl_loc', - None, - 'VIM Service WSDL Location' - 'e.g http://<server>/vimService.wsdl' - 'Due to a bug in vSphere ESX 4.1 default wsdl' - 'Refer readme-vmware to setup') +FLAGS.add_option(vmwareapi_wsdl_loc_opt) if suds: diff --git a/nova/virt/vmwareapi/vmops.py b/nova/virt/vmwareapi/vmops.py index 780caa65b..172936def 100644 --- a/nova/virt/vmwareapi/vmops.py +++ b/nova/virt/vmwareapi/vmops.py @@ -26,6 +26,7 @@ import urllib import urllib2 import uuid +from nova.common import cfg from nova.compute import power_state from nova import exception from nova import flags @@ -36,10 +37,14 @@ from nova.virt.vmwareapi import vm_util from nova.virt.vmwareapi import vmware_images from nova.virt.vmwareapi import network_utils + +vmware_vif_driver_opt = \ + cfg.StrOpt('vmware_vif_driver', + default='nova.virt.vmwareapi.vif.VMWareVlanBridgeDriver', + help='The VMWare VIF driver to configure the VIFs.') + FLAGS = flags.FLAGS -flags.DEFINE_string('vmware_vif_driver', - 'nova.virt.vmwareapi.vif.VMWareVlanBridgeDriver', - 'The VMWare VIF driver to configure the VIFs.') +FLAGS.add_option(vmware_vif_driver_opt) LOG = logging.getLogger("nova.virt.vmwareapi.vmops") diff --git a/nova/virt/vmwareapi_conn.py b/nova/virt/vmwareapi_conn.py index 620407c78..d71b922c9 100644 --- a/nova/virt/vmwareapi_conn.py +++ b/nova/virt/vmwareapi_conn.py @@ -36,6 +36,7 @@ import time from eventlet import event +from nova.common import cfg from nova import context from nova import db from nova import exception @@ -51,31 +52,35 @@ from nova.virt.vmwareapi.vmops import VMWareVMOps LOG = logging.getLogger("nova.virt.vmwareapi_conn") +vmwareapi_opts = [ + cfg.StrOpt('vmwareapi_host_ip', + default=None, + help='URL for connection to VMWare ESX host.Required if ' + 'connection_type is vmwareapi.'), + cfg.StrOpt('vmwareapi_host_username', + default=None, + help='Username for connection to VMWare ESX host. ' + 'Used only if connection_type is vmwareapi.'), + cfg.StrOpt('vmwareapi_host_password', + default=None, + help='Password for connection to VMWare ESX host. ' + 'Used only if connection_type is vmwareapi.'), + cfg.FloatOpt('vmwareapi_task_poll_interval', + default=5.0, + help='The interval used for polling of remote tasks. ' + 'Used only if connection_type is vmwareapi'), + cfg.FloatOpt('vmwareapi_api_retry_count', + default=10, + help='The number of times we retry on failures, e.g., ' + 'socket error, etc. ' + 'Used only if connection_type is vmwareapi'), + cfg.StrOpt('vmwareapi_vlan_interface', + default='vmnic0', + help='Physical ethernet adapter name for vlan networking'), + ] + 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') +FLAGS.add_options(vmwareapi_opts) TIME_BETWEEN_API_CALL_RETRIES = 2.0 diff --git a/nova/virt/xenapi/vif.py b/nova/virt/xenapi/vif.py index b53b456f1..80278e8c6 100644 --- a/nova/virt/xenapi/vif.py +++ b/nova/virt/xenapi/vif.py @@ -19,15 +19,21 @@ """VIF drivers for XenAPI.""" +from nova.common import cfg from nova import flags from nova import log as logging from nova.virt.vif import VIFDriver from nova.virt.xenapi.network_utils import NetworkHelper from nova.virt.xenapi.vm_utils import VMHelper + +xenapi_ovs_integration_bridge_opt = \ + cfg.StrOpt('xenapi_ovs_integration_bridge', + default='xapi1', + help='Name of Integration Bridge used by Open vSwitch') + FLAGS = flags.FLAGS -flags.DEFINE_string('xenapi_ovs_integration_bridge', 'xapi1', - 'Name of Integration Bridge used by Open vSwitch') +FLAGS.add_option(xenapi_ovs_integration_bridge_opt) LOG = logging.getLogger("nova.virt.xenapi.vif") diff --git a/nova/virt/xenapi/vm_utils.py b/nova/virt/xenapi/vm_utils.py index 75ff011b3..4c7ece9c5 100644 --- a/nova/virt/xenapi/vm_utils.py +++ b/nova/virt/xenapi/vm_utils.py @@ -33,6 +33,7 @@ import uuid from decimal import Decimal from xml.dom import minidom +from nova.common import cfg from nova import exception from nova import flags from nova.image import glance @@ -47,12 +48,20 @@ from nova.virt.xenapi import volume_utils LOG = logging.getLogger("nova.virt.xenapi.vm_utils") +xenapi_vm_utils_opts = [ + cfg.StrOpt('default_os_type', + default='linux', + help='Default OS type'), + cfg.IntOpt('block_device_creation_timeout', + default=10, + help='time to wait for a block device to be created'), + cfg.IntOpt('max_kernel_ramdisk_size', + default=16 * 1024 * 1024, + help='maximum size in bytes of kernel or ramdisk images'), + ] + FLAGS = flags.FLAGS -flags.DEFINE_string('default_os_type', 'linux', 'Default OS type') -flags.DEFINE_integer('block_device_creation_timeout', 10, - 'time to wait for a block device to be created') -flags.DEFINE_integer('max_kernel_ramdisk_size', 16 * 1024 * 1024, - 'maximum size in bytes of kernel or ramdisk images') +FLAGS.add_options(xenapi_vm_utils_opts) XENAPI_POWER_STATE = { 'Halted': power_state.SHUTDOWN, diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index f681aceef..cb07bd255 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -30,6 +30,7 @@ import uuid from eventlet import greenthread import M2Crypto +from nova.common import cfg from nova.compute import api as compute from nova.compute import power_state from nova import context as nova_context @@ -49,21 +50,28 @@ VMHelper = vm_utils.VMHelper XenAPI = None LOG = logging.getLogger("nova.virt.xenapi.vmops") +xenapi_vmops_opts = [ + cfg.IntOpt('agent_version_timeout', + default=300, + help='number of seconds to wait for agent ' + 'to be fully operational'), + cfg.IntOpt('xenapi_running_timeout', + default=60, + help='number of seconds to wait for instance ' + 'to go to running state'), + cfg.StrOpt('xenapi_vif_driver', + default='nova.virt.xenapi.vif.XenAPIBridgeDriver', + help='The XenAPI VIF driver using XenServer Network APIs.'), + cfg.BoolOpt('xenapi_generate_swap', + default=False, + help='Whether to generate swap ' + '(False means fetching it from OVA)'), + ] + FLAGS = flags.FLAGS +FLAGS.add_options(xenapi_vmops_opts) + flags.DECLARE('vncserver_proxyclient_address', 'nova.vnc') -flags.DEFINE_integer('agent_version_timeout', 300, - 'number of seconds to wait for agent to be fully ' - 'operational') -flags.DEFINE_integer('xenapi_running_timeout', 60, - 'number of seconds to wait for instance to go to ' - 'running state') -flags.DEFINE_string('xenapi_vif_driver', - 'nova.virt.xenapi.vif.XenAPIBridgeDriver', - 'The XenAPI VIF driver using XenServer Network APIs.') -flags.DEFINE_bool('xenapi_generate_swap', - False, - 'Whether to generate swap (False means fetching it' - ' from OVA)') RESIZE_TOTAL_STEPS = 5 diff --git a/nova/virt/xenapi_conn.py b/nova/virt/xenapi_conn.py index 42f035217..6b67b8b88 100644 --- a/nova/virt/xenapi_conn.py +++ b/nova/virt/xenapi_conn.py @@ -70,6 +70,7 @@ from eventlet import queue from eventlet import tpool from eventlet import timeout +from nova.common import cfg from nova import context from nova import db from nova import exception @@ -84,69 +85,74 @@ from nova.virt.xenapi.volumeops import VolumeOps LOG = logging.getLogger("nova.virt.xenapi") +xenapi_opts = [ + cfg.StrOpt('xenapi_connection_url', + default=None, + help='URL for connection to XenServer/Xen Cloud Platform. ' + 'Required if connection_type=xenapi.'), + cfg.StrOpt('xenapi_connection_username', + default='root', + help='Username for connection to XenServer/Xen Cloud Platform. ' + 'Used only if connection_type=xenapi.'), + cfg.StrOpt('xenapi_connection_password', + default=None, + help='Password for connection to XenServer/Xen Cloud Platform. ' + 'Used only if connection_type=xenapi.'), + cfg.IntOpt('xenapi_connection_concurrent', + default=5, + help='Maximum number of concurrent XenAPI connections. ' + 'Used only if connection_type=xenapi.'), + cfg.FloatOpt('xenapi_task_poll_interval', + default=0.5, + help='The interval used for polling of remote tasks ' + '(Async.VM.start, etc). ' + 'Used only if connection_type=xenapi.'), + cfg.FloatOpt('xenapi_vhd_coalesce_poll_interval', + default=5.0, + help='The interval used for polling of coalescing vhds. ' + 'Used only if connection_type=xenapi.'), + cfg.IntOpt('xenapi_vhd_coalesce_max_attempts', + default=5, + help='Max number of times to poll for VHD to coalesce. ' + 'Used only if connection_type=xenapi.'), + cfg.StrOpt('xenapi_agent_path', + default='usr/sbin/xe-update-networking', + help='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. ' + 'Used if connection_type=xenapi and flat_injected=True'), + cfg.StrOpt('xenapi_sr_base_path', + default='/var/run/sr-mount', + help='Base path to the storage repository'), + cfg.BoolOpt('xenapi_log_instance_actions', + default=False, + help='Log all instance calls to XenAPI in the database.'), + cfg.StrOpt('target_host', + default=None, + help='iSCSI Target Host'), + cfg.StrOpt('target_port', + default='3260', + help='iSCSI Target Port, 3260 Default'), + cfg.StrOpt('iqn_prefix', + default='iqn.2010-10.org.openstack', + help='IQN Prefix'), + # NOTE(sirp): This is a work-around for a bug in Ubuntu Maverick, + # when we pull support for it, we should remove this + cfg.BoolOpt('xenapi_remap_vbd_dev', + default=False, + help='Used to enable the remapping of VBD dev ' + '(Works around an issue in Ubuntu Maverick)'), + cfg.StrOpt('xenapi_remap_vbd_dev_prefix', + default='sd', + help='Specify prefix to remap VBD dev to ' + '(ex. /dev/xvdb -> /dev/sdb)'), + cfg.IntOpt('xenapi_login_timeout', + default=10, + help='Timeout in seconds for XenAPI login.'), + ] FLAGS = flags.FLAGS - -flags.DEFINE_string('xenapi_connection_url', - None, - 'URL for connection to XenServer/Xen Cloud Platform.' - ' 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' - ' Used only if connection_type=xenapi.' - ' and flat_injected=True') -flags.DEFINE_string('xenapi_sr_base_path', '/var/run/sr-mount', - 'Base path to the storage repository') -flags.DEFINE_bool('xenapi_log_instance_actions', False, - 'Log all instance calls to XenAPI in the database.') -flags.DEFINE_string('target_host', - None, - 'iSCSI Target Host') -flags.DEFINE_string('target_port', - '3260', - 'iSCSI Target Port, 3260 Default') -flags.DEFINE_string('iqn_prefix', - 'iqn.2010-10.org.openstack', - 'IQN Prefix') -# NOTE(sirp): This is a work-around for a bug in Ubuntu Maverick, when we pull -# support for it, we should remove this -flags.DEFINE_bool('xenapi_remap_vbd_dev', False, - 'Used to enable the remapping of VBD dev ' - '(Works around an issue in Ubuntu Maverick)') -flags.DEFINE_string('xenapi_remap_vbd_dev_prefix', 'sd', - 'Specify prefix to remap VBD dev to ' - '(ex. /dev/xvdb -> /dev/sdb)') -flags.DEFINE_integer('xenapi_login_timeout', - 10, - 'Timeout in seconds for XenAPI login.') +FLAGS.add_options(xenapi_opts) def get_connection(_): |
