translates empty remote_ip_prefix to valid cidr for nova

Quantum allows empty remote_ip_prefix to mean "any host"
but Nova uses a CIDR as part of each rule.

Fixes bug 1180828

Change-Id: I4983515ccd0cc621491d63e59d6ab6ac4dd74b6a
Removed session from reservation_create()

Removed session objects from public reservation_create() function
in nova/db/sqlalchemy/api module. Minor code refactoring.

blueprint db-session-cleanup

Change-Id: Ib87dd407328b0208a92a7e50bf4117e85fc512fb
Fix VMwareVCdriver reporting incorrect stats

fix bug #1180779

VMware nova compute drivers VMwareESXDriver and VMwareVCDriver
currently report stats for the column local_gb in MB instead of in GB
The fix would be to modify vmwareapi/host.py to ensure the values
reported for disk space are calculated in GB instead of MB.
Fix is done by further dividing the existing MB value by 1024 to
convert to GB.
The unit tests to check for capacity and freespace have been modified
to check for GB.

Change-Id: I0610047ee2bddefe0ccb46568c0f48de4c0941af
hardcode pbr and d2to1 versions

Hard code pbr to d2to1 to >=0.2.10,<0.3 and
pbr to >=0.5,<0.6 for consistency across projects.

Change-Id: I7163bef37934856e5f80df336044f8ebcb690797
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Fix quota checks while resizing up by admin

Fixes LP 1184594

Fixing a bug when admin issues a resize up for a user, it checks for
admin's quota instead of user's quota.

Change-Id: Ida5db9039396df0a08c699711b72882e2ef136f8
Don't snat all traffic when force_snat_range set

When using /proc/sys/net/bridge/bridge-nf-call-iptables=1, bridged
traffic gets snatted even though it is being bridged out to an
external gateway. This can lead to asymmetric routes where traffic
goes out the fixed network and comes back on the float network
and can lead to packets being blocked by firewalls. Work around
this problem by only fallback snatting when the traffic is
going to one of the force_snat_ranges. If force_snat_range is not
set it defaults to the existing behavior of snatting all traffic
that doesn't hit an earlier rule.

Fixes bug 1182143

Change-Id: If496dad2308a68a6a4a9fd43d695943bc5034ac4
Some libvirt driver lookups lacks proper exception handling

Add error handling to list_instance_uuids() and get_memory_mb_used().
While fixing list_instance_uuids, this change also removes an
unnecessary extra lookup for every running instance.

Improve test coverage for list_instances() and list_instance_uuids().

Change-Id: I0cabe5f38d19143a3eb7b2ebce1ea6ea63f36929
Replace functions in utils with oslo.fileutils

The following functions have moved to oslo.
remove_path_on_error
file_open
delete_if_exists

Replaced/removed overlapping functions with the ones in fileutils

Change-Id: I41a19d76a777b6f899843bb0cc0582630accbd5c
Fix to disallow server name with all blank spaces

* Nova CLI allows server name to be created with all blank characters.
  This fix will disallow a server name with all blank spaces during
  server/instance creation as well as while updating/renaming a server
* Adding unit tests to test the above scenarios (create & rename
  server with blank spaces)

Fixes bug 1175956

Change-Id: I58af207c4a6b8579bb172d4bb612e0aa2aa6b498
Remove redundant architecture property update in powervm snapshot

During an instance snapshot if the architecture property is defined
in the image it is updated twice in the snapshot image.
The snapshot is created with the metadata values from the
"instance_system_metadata" table and then, if defined, the architecture
property is updated from the value in the base image in that moment.

There is no reason to treat this property differently from others.
Also, it didn't respect the "non_inheritable_image_properties" option.

This change removes the special behavior for the architecture property
in the powervm driver during a snapshot.

Fixes bug 1189969

Change-Id: I05ebcaef7b75387827917b5b223868794d98e0aa
Remove explicit distribute depend.

Causes issues with the recent re-merge with setuptools. Advice from
upstream is to stop doing explicit depends.

Change-Id: Ib2c68618368c766e7444e45074bddb01b29752d3
Remove unused db api call.

There is unused db api call in NetworkManager
setup_networks_on_host() method, results from
this call not used, no specific exception raised,
this patch just remove it.

Change-Id: Icf898dcdda635a3a78c92e76ec0e19c6ab075ce1
update_dns() method optimization.

update_dns() method in NetworkManager rewrited,
in new version used only one db api call.

Change-Id: Ib56c642d53e7a80439875bc304c4874d6ef4dcca
Quantum API _get_floating_ip_by_address mismatch with Nova-Net

_get_floating_ip_by_address() has a unspecified behavior when
IP address is empty and only one floating IP is allocated in
the pool. It should return a 404 Not found like Nova-Net does
but instead returns the only IP in the pool.

Fix bug #1190242

Change-Id: Id4843edda8e66ccabab5e9d053c595a1cd247770
Update to the latest stevedore

Use a version of stevedore that does not try to
install distribute.

The requirements change is in
https://review.openstack.org/#/c/32738/

Change-Id: I277a282ed86743a25138c431045af1f0ccb11b39
Signed-off-by: Doug Hellmann <doug.hellmann@dreamhost.com>
Naming instance directory by uuid in VMware Hyper.

Like Libvirt Hyper, Using EC2 template for naming instance
directory may cause conflict. we follow what Libvirt does to use
instance uuid instead of EC2 template naming. To keep backwards
compability, when fails to find a instance by uuid, fall back to use
EC2 name.

Fix bug #1186944

Change-Id: Iaba099225a9b3b0390cae4c5fbd82d7e6c11f0e0
Allow confirm_resize if instance is in 'deleting' status

Deleting an instance puts it into 'deleting' task_state.
If the instance is in 'resized' vm_status, this tries a
confirm_resize on the instance. confirm_resize currently expects
the task_state to be None. It should instead expect
None/deleting task_state.

Fixes bug: 1189391

Change-Id: I6a3f82eab9ed2242bfd38bc1ac760dbb4b3d8c4a
Don't advertise mute cells capabilities upwards

Fixes bug 1190473

Change-Id: Ic61b549869b1434df81407e499ec8b00ba8f328f
Fix VMware Hyper can't honor hw_vif_model image property.

Support setting instance vif model through image property,
change default vif model to e1000. Available vif model options
for VMware Hyperv is "VirtualE1000, VirtualPCNet32, VirtualVmxnet".

DocImpact
Fix bug #1183192

Change-Id: I3a98bc26df7e2252bf043a71acbba2a158e213b8
Enhance the validation of the quotas update

Need check whether the already used and reserved exceeds the new quota
before update it.

DocImpact
Implements a validation to validate whether already used and reserved
quota exceeds the new quota when run 'nova quota-update', it will throw
error if the quota exceeds. This check will be ignored if admin want to
force update when run 'nova quota-update' with additional option
'--force'.
This validation help admin to be aware of whether the quotas are
oversold when they try to update quota and also provide an option
'--force' to allow admin force update the quotas.

Fix bug 1160749

Change-Id: Iba3cee0f0d92cf2e6d64bc83830b0091992d1ee9