script for configuring a vif in Xen in non-bridged mode

Creates a new vif device without attaching it to a
bridge. Quantum Linux Bridge Agent will attach the
created device to the belonging bridge.

Change-Id: I1818a92a47882d98e384b57e0fa84a0fa09d40ea
Allow pinging own float when using fixed gateway

When pinging your own floating ip, the snat rule is not hit if
dnsmasq is set up to give out an external gateway.

Fixes bug 1096259

Change-Id: Ib71312bf37b3a890567cf6212acabb5821846ab8
Upgrade WebOb to 1.2.3

The version of WebOb being used in OpenStack was more than
1 year old. This change updates to the latest stable release.

Upgrading WebOb resolves a version conflict between OpenStack
and Pecan, the web framework used by the Ceilometer team for
version 2 of the ceilometer API.

Refer to http://docs.webob.org/en/latest/news.html
for the list of changes between 1.0.8 and 1.2.3.

bug 1092227

Change-Id: Ib5a005665a5b11198006ce2aa2432399a41fc3d9
Signed-off-by: Doug Hellmann <doug.hellmann@dreamhost.com>
xenapi: Remove dead code, moves, tests

Related to blueprint xenapi-volume-drivers

Some changes to improve the quality and readability of the existing
code, and to help introducing a clean volume driver concept.

remove:
    dead sm code
move:
    volumeops.introduce_sr -> volume_utils.introduce_sr_unless_present
    volumeops.forget_sr -> volume_utils.forget_sr_if_present
rename:
    volumeops.connect_volume -> _connect_volume
    (to communicate, that it is an internal method)
add tests:
    volumeops.disconnect_volume

Change-Id: Ie5457c3d7823ed77f7ad90252d0c16558e8cfb4f
Fix lintstack check for multi-patch reviews

Some patches in gerrit depend on other patches that are not yet
approved, i.e. not yet landed on master. In this patch lintstack
deals with these cases by currectly generating the right commit
to compare against to further reduce pylint errors.

Part of bp/lintstack

Change-Id: I77622a44949ad2b442d9f2cce6c807e1581830c7
Fix pyflakes issues in integrated tests

Change-Id: I8d483319d0a20a2c8fb7a5e0e22c83048b7399dc
Adds a flag to allow configuring a region

If multiple regions contain an endpoint, extract
the correct endpoint URL from the os_region_name parameter
in nova.conf

Fixes LP Bug #1087735

Change-Id: Id4e4f56f336cd2b092a173b3c8e695b173c76f2a
Added sample tests to FlavorSwap API.

Partially implements blueprint nova-api-samples
Fixes bug 1096653

Change-Id: I9a6ca8a023bf0f3404b3a9af635dd29a7a584aa3
Fix test cases in integrated.test_multiprocess_api

Fixes bug #1098043

Be patient in test_multiprocess_api while waiting service to be spawned or
killed, because:
    * Service spawning has a limit of one process a second.
    * A test server in the cloud might have limited resources,
      the time there might be several times slower.

Change-Id: If75e6dfa5d769985a6c1b46461f25485e2a996ad
Move libvirt VIF XML config into designer.py

There are a fixed set of sensible XML configurations for
network VIFs. Create some helper methods for configuring
these configurations. Then update the VIF drivers to call
these APIs. The 'designer.py' file will serve as a place
for any policy based XML configuration helpers, as distinct
from config.py which is purely dealing with XML parsing
and formatting

Blueprint: libvirt-vif-driver
Change-Id: I857607c15ed576c65f898df4eb7533505742324b
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Add some constants to the network model for drivers to use

Following on from

  commit 85f857e62a5edacbf467c19add6e51565ae3669f
  Author: Gary Kotton <gkotton@redhat.com>
  Date:   Sat Dec 8 08:54:16 2012 +0000

    Add vif_type to the VIF model

add some constants to nova.network.model to enumerate the valid
values for 'vif_type'. Also add a constant for max bridge name
length

Blueprint: libvirt-vif-driver
Change-Id: I47949c06fee732681bf0b547577f22a319d4e408
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Make nova network manager fill in vif_type

Make the Nova network manager impl fill in the 'vif_type' parameter
in the VIF configuration for instances. This is hardcoded to
VIF_TYPE_BRIDGE, since that's all Nova network supports.

Blueprint: libvirt-vif-driver
Change-Id: I46d1f0edc820ccc198e5a5c876ea25644ebedd86
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Make Quantum plugin fill in the 'bridge' name

There is a comment in the quantum driver code that says it
ignores the 'bridge' name field. This is misleading, because
the bridge name is still required by any virt drivers when
configuring VIFs so they know how to connect them.

Currently the libvirt Bridge driver invents a bridge name
based on 'qbr' and network['id'], while the OVS drivers
use the libvirt_ovs_bridge config. Move this logic into
the Quantum driver, renaming the config option to
quantum_ovs_bridge. The config option should go away completely
once Quantum can pass across the name, as it does for vif_type

Blueprint: libvirt-vif-driver
Change-Id: Ib043e1e6af5712ae1d1665cdca2e9fdbc89d4351
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Expand quota logging

Change-Id: Ied8bdbe2b15aebb313868b65f7660ba7ad0cb3c8
Make it clearer that network.api.API is nova-network specific.

This may save confusion for new folk, as the indirection to rpcapi
isn't intended to be used to plug quantum in - instead the whole API
object is replaced.

Change-Id: Ib3680826b2ab1e18d249f447828fd1ac9e81132f
Adding configdrive to xenapi.

This version implements a configdrive v2 for xenapi as discussed
in the xenapi IRC meetings.

 - the config drive is now iso9660
 - the admin password is injected (if we know it)
 - vbd's are not reused
 - review comments have been addressed

Progresses blueprint xenapi-config-drive. DocImpact.

(Dear documentation people, if using config drive with xenapi,
the user should consider disabling the agent as well with
xenapi_disable_agent. This mostly depends on if they want to
support post-boot password updates still.)

Change-Id: Ib23d117ad4cd5dc92298a0812eb468f7d557417c
Correct the calculating of disk size when using lvm disk backend.

Currently, disk space size calculating in nova doesn't consider the
situation when lvm is used as disk backend. Thus both used and total
disk size are not correct when we use lvm to create instance. This
patch fixes this problem by using 'vgs' to get disk size in such case.

Fixes LP #1098116.

Change-Id: I0e86649cfde83a154d0a4c034ca52abe73384e73
Fix quota updating when admin deletes common user's instance

Add 'project_id=None' optional argument in QUOTAS related methods.

There are two problems when admin deletes instances of common user
before fixing this bug:
Firstly, It will get tenant quotas using context.project_id which
results in getting admin's quotas not common user's.
Secondly, It will also get wrong quota usages using context.project_id
when updating common user's quota_usages.

So we could pass into QUOTAS related methods an optional argument to
specify the tenant ID to be affected. And if it's not set, then we
default to drawing the tenant ID from the context.

Fixes: bug 1078668
Change-Id: I59bc240d6547122d803a3ed3e1eeef26fc78f4f0
Remove more unused opts from nova.scheduler.driver

libvirt_type is unused here since 5b85997

instances_path is unused here since 30aec4a

Change-Id: Ic32775be84b3f46b1d4f117701ebb6e352f1f93c
Skip domains on libvirt errors in get_vcpu_used()

This commit is to avoid a race condition between deletes
and creates. It is possible for a delete to remove a domain
from the list returned by _conn.listDomainsID() while
get_vcpu_used() is looping over the list. If this happens
libVirt raises a LibVirtError and sets the instance to the
ERROR state. To avoid this LibVirtError is caught and the loop
continues instead of raising the exception.

Change-Id: I3206142e36726936013bb27ccd4359de4f94b3a3