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 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
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
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
Don't make nova-compute depend on iSCSI

Because not all volume drivers require iSCSI it makes sense to not
set the initiator in the connector and let the volume drivers
return an error if iSCSI is required.

bug #1007084

Change-Id: I5da472e5013fdc0c733ecb12b919c1068873bdc6
Refactor conf sample generator script

Optimized grep calls to not create a grep process per file.
Defined variables to enhance readability.

Change-Id: Ic873f2c3b600a737ce54444dec973720c8813285
Refactors qemu image info parsing logic

The _parse method is using position information on a list
which is not intuitive. Removed position info and did a clean up
addressing python conventions.

Change-Id: I412d62f9f5a045773b65ed38230eddec48c91e1b
Add missing tests for provider_fw_rule_* methods

There was no tests in test_db_api for provider_fw_rule_*
methods.

Add tests to ensure that all works.

blueprint db-api-tests

Change-Id: Ia137ffcfcba3f663a177386775147a25d6716980