summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/api_samples/OS-FLV-DISABLED/flavor-detail-get-resp.json4
-rw-r--r--doc/api_samples/OS-FLV-DISABLED/flavor-detail-get-resp.xml4
-rw-r--r--doc/api_samples/OS-FLV-DISABLED/flavor-show-get-resp.json4
-rw-r--r--doc/api_samples/OS-FLV-DISABLED/flavor-show-get-resp.xml4
-rw-r--r--doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.json4
-rw-r--r--doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.xml4
-rw-r--r--doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.json4
-rw-r--r--doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.xml4
-rw-r--r--doc/api_samples/all_extensions/flavor-get-resp.json2
-rw-r--r--doc/api_samples/all_extensions/flavor-get-resp.xml4
-rw-r--r--doc/api_samples/flavor-get-resp.json4
-rw-r--r--doc/api_samples/flavor-get-resp.xml4
-rw-r--r--doc/api_samples/os-flavor-access/flavor-access-detail-resp.json4
-rw-r--r--doc/api_samples/os-flavor-access/flavor-access-detail-resp.xml4
-rw-r--r--doc/api_samples/os-flavor-access/flavor-access-show-resp.json4
-rw-r--r--doc/api_samples/os-flavor-access/flavor-access-show-resp.xml4
-rw-r--r--doc/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.json4
-rw-r--r--doc/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.xml4
-rw-r--r--doc/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.json4
-rw-r--r--doc/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.xml4
-rw-r--r--doc/api_samples/os-flavor-swap/flavor-swap-get-resp.json4
-rw-r--r--doc/api_samples/os-flavor-swap/flavor-swap-get-resp.xml4
-rw-r--r--doc/api_samples/os-flavor-swap/flavor-swap-list-resp.json4
-rw-r--r--doc/api_samples/os-flavor-swap/flavor-swap-list-resp.xml4
-rw-r--r--doc/api_samples/os-simple-tenant-usage/simple-tenant-usage-get-specific.json6
-rw-r--r--doc/api_samples/os-simple-tenant-usage/simple-tenant-usage-get-specific.xml6
-rw-r--r--doc/api_samples/os-simple-tenant-usage/simple-tenant-usage-get.json4
-rw-r--r--doc/api_samples/os-simple-tenant-usage/simple-tenant-usage-get.xml4
-rw-r--r--nova/db/sqlalchemy/api.py2
-rw-r--r--nova/db/sqlalchemy/migrate_repo/versions/133_folsom.py2
-rw-r--r--nova/openstack/common/jsonutils.py8
-rw-r--r--nova/openstack/common/log.py18
-rw-r--r--nova/openstack/common/processutils.py2
-rw-r--r--nova/openstack/common/service.py333
-rw-r--r--nova/openstack/common/threadgroup.py121
-rw-r--r--nova/tests/integrated/api_samples/OS-FLV-DISABLED/flavor-detail-get-resp.json.tpl2
-rw-r--r--nova/tests/integrated/api_samples/OS-FLV-DISABLED/flavor-detail-get-resp.xml.tpl2
-rw-r--r--nova/tests/integrated/api_samples/OS-FLV-DISABLED/flavor-show-get-resp.json.tpl2
-rw-r--r--nova/tests/integrated/api_samples/OS-FLV-DISABLED/flavor-show-get-resp.xml.tpl2
-rw-r--r--nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.json.tpl2
-rw-r--r--nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.xml.tpl2
-rw-r--r--nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.json.tpl2
-rw-r--r--nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.xml.tpl2
-rw-r--r--nova/tests/integrated/api_samples/all_extensions/flavor-get-resp.json.tpl4
-rw-r--r--nova/tests/integrated/api_samples/all_extensions/flavor-get-resp.xml.tpl2
-rw-r--r--nova/tests/integrated/api_samples/flavor-get-resp.json.tpl2
-rw-r--r--nova/tests/integrated/api_samples/flavor-get-resp.xml.tpl2
-rw-r--r--nova/tests/integrated/api_samples/flavors-list-resp.json.tpl2
-rw-r--r--nova/tests/integrated/api_samples/os-flavor-access/flavor-access-detail-resp.json.tpl2
-rw-r--r--nova/tests/integrated/api_samples/os-flavor-access/flavor-access-detail-resp.xml.tpl2
-rw-r--r--nova/tests/integrated/api_samples/os-flavor-access/flavor-access-show-resp.json.tpl2
-rw-r--r--nova/tests/integrated/api_samples/os-flavor-access/flavor-access-show-resp.xml.tpl2
-rw-r--r--nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.json.tpl2
-rw-r--r--nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.xml.tpl2
-rw-r--r--nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.json.tpl2
-rw-r--r--nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.xml.tpl2
-rw-r--r--nova/tests/integrated/api_samples/os-flavor-swap/flavor-swap-get-resp.json.tpl2
-rw-r--r--nova/tests/integrated/api_samples/os-flavor-swap/flavor-swap-get-resp.xml.tpl2
-rw-r--r--nova/tests/integrated/api_samples/os-flavor-swap/flavor-swap-list-resp.json.tpl2
-rw-r--r--nova/tests/integrated/api_samples/os-flavor-swap/flavor-swap-list-resp.xml.tpl2
-rw-r--r--nova/tests/integrated/api_samples/os-simple-tenant-usage/simple-tenant-usage-get-specific.json.tpl4
-rw-r--r--nova/tests/integrated/api_samples/os-simple-tenant-usage/simple-tenant-usage-get-specific.xml.tpl4
-rw-r--r--nova/tests/integrated/api_samples/os-simple-tenant-usage/simple-tenant-usage-get.json.tpl2
-rw-r--r--nova/tests/integrated/api_samples/os-simple-tenant-usage/simple-tenant-usage-get.xml.tpl2
-rw-r--r--nova/tests/test_db_api.py16
-rw-r--r--openstack-common.conf2
66 files changed, 575 insertions, 107 deletions
diff --git a/doc/api_samples/OS-FLV-DISABLED/flavor-detail-get-resp.json b/doc/api_samples/OS-FLV-DISABLED/flavor-detail-get-resp.json
index 42e0e21ce..5c17c84be 100644
--- a/doc/api_samples/OS-FLV-DISABLED/flavor-detail-get-resp.json
+++ b/doc/api_samples/OS-FLV-DISABLED/flavor-detail-get-resp.json
@@ -2,7 +2,7 @@
"flavors": [
{
"OS-FLV-DISABLED:disabled": false,
- "disk": 0,
+ "disk": 1,
"id": "1",
"links": [
{
@@ -91,4 +91,4 @@
"vcpus": 8
}
]
-} \ No newline at end of file
+}
diff --git a/doc/api_samples/OS-FLV-DISABLED/flavor-detail-get-resp.xml b/doc/api_samples/OS-FLV-DISABLED/flavor-detail-get-resp.xml
index 92b51a866..95d8b5d6d 100644
--- a/doc/api_samples/OS-FLV-DISABLED/flavor-detail-get-resp.xml
+++ b/doc/api_samples/OS-FLV-DISABLED/flavor-detail-get-resp.xml
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<flavors xmlns:OS-FLV-DISABLED="http://docs.openstack.org/compute/ext/flavor_disabled/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
- <flavor disk="0" vcpus="1" ram="512" name="m1.tiny" id="1" OS-FLV-DISABLED:disabled="False">
+ <flavor disk="1" vcpus="1" ram="512" name="m1.tiny" id="1" OS-FLV-DISABLED:disabled="False">
<atom:link href="http://openstack.example.com/v2/openstack/flavors/1" rel="self"/>
<atom:link href="http://openstack.example.com/openstack/flavors/1" rel="bookmark"/>
</flavor>
@@ -20,4 +20,4 @@
<atom:link href="http://openstack.example.com/v2/openstack/flavors/5" rel="self"/>
<atom:link href="http://openstack.example.com/openstack/flavors/5" rel="bookmark"/>
</flavor>
-</flavors> \ No newline at end of file
+</flavors>
diff --git a/doc/api_samples/OS-FLV-DISABLED/flavor-show-get-resp.json b/doc/api_samples/OS-FLV-DISABLED/flavor-show-get-resp.json
index 3fd5fa1d7..7587e055b 100644
--- a/doc/api_samples/OS-FLV-DISABLED/flavor-show-get-resp.json
+++ b/doc/api_samples/OS-FLV-DISABLED/flavor-show-get-resp.json
@@ -1,7 +1,7 @@
{
"flavor": {
"OS-FLV-DISABLED:disabled": false,
- "disk": 0,
+ "disk": 1,
"id": "1",
"links": [
{
@@ -17,4 +17,4 @@
"ram": 512,
"vcpus": 1
}
-} \ No newline at end of file
+}
diff --git a/doc/api_samples/OS-FLV-DISABLED/flavor-show-get-resp.xml b/doc/api_samples/OS-FLV-DISABLED/flavor-show-get-resp.xml
index 6abd22641..d49c273d6 100644
--- a/doc/api_samples/OS-FLV-DISABLED/flavor-show-get-resp.xml
+++ b/doc/api_samples/OS-FLV-DISABLED/flavor-show-get-resp.xml
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
-<flavor xmlns:OS-FLV-DISABLED="http://docs.openstack.org/compute/ext/flavor_disabled/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" disk="0" vcpus="1" ram="512" name="m1.tiny" id="1" OS-FLV-DISABLED:disabled="False">
+<flavor xmlns:OS-FLV-DISABLED="http://docs.openstack.org/compute/ext/flavor_disabled/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" disk="1" vcpus="1" ram="512" name="m1.tiny" id="1" OS-FLV-DISABLED:disabled="False">
<atom:link href="http://openstack.example.com/v2/openstack/flavors/1" rel="self"/>
<atom:link href="http://openstack.example.com/openstack/flavors/1" rel="bookmark"/>
-</flavor> \ No newline at end of file
+</flavor>
diff --git a/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.json b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.json
index 3b421b4e1..3865f4ef9 100644
--- a/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.json
+++ b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.json
@@ -1,7 +1,7 @@
{
"flavor": {
"OS-FLV-EXT-DATA:ephemeral": 0,
- "disk": 0,
+ "disk": 1,
"id": "1",
"links": [
{
@@ -17,4 +17,4 @@
"ram": 512,
"vcpus": 1
}
-} \ No newline at end of file
+}
diff --git a/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.xml b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.xml
index dfecff1fc..653e77cda 100644
--- a/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.xml
+++ b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.xml
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
-<flavor xmlns:OS-FLV-EXT-DATA="http://docs.openstack.org/compute/ext/flavor_extra_data/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" disk="0" vcpus="1" ram="512" name="m1.tiny" id="1" OS-FLV-EXT-DATA:ephemeral="0">
+<flavor xmlns:OS-FLV-EXT-DATA="http://docs.openstack.org/compute/ext/flavor_extra_data/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" disk="1" vcpus="1" ram="512" name="m1.tiny" id="1" OS-FLV-EXT-DATA:ephemeral="0">
<atom:link href="http://openstack.example.com/v2/openstack/flavors/1" rel="self"/>
<atom:link href="http://openstack.example.com/openstack/flavors/1" rel="bookmark"/>
-</flavor> \ No newline at end of file
+</flavor>
diff --git a/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.json b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.json
index ee7696bed..ae29b6c86 100644
--- a/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.json
+++ b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.json
@@ -2,7 +2,7 @@
"flavors": [
{
"OS-FLV-EXT-DATA:ephemeral": 0,
- "disk": 0,
+ "disk": 1,
"id": "1",
"links": [
{
@@ -91,4 +91,4 @@
"vcpus": 8
}
]
-} \ No newline at end of file
+}
diff --git a/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.xml b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.xml
index 7b53621b7..dc48eebd8 100644
--- a/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.xml
+++ b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.xml
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<flavors xmlns:OS-FLV-EXT-DATA="http://docs.openstack.org/compute/ext/flavor_extra_data/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
- <flavor disk="0" vcpus="1" ram="512" name="m1.tiny" id="1" OS-FLV-EXT-DATA:ephemeral="0">
+ <flavor disk="1" vcpus="1" ram="512" name="m1.tiny" id="1" OS-FLV-EXT-DATA:ephemeral="0">
<atom:link href="http://openstack.example.com/v2/openstack/flavors/1" rel="self"/>
<atom:link href="http://openstack.example.com/openstack/flavors/1" rel="bookmark"/>
</flavor>
@@ -20,4 +20,4 @@
<atom:link href="http://openstack.example.com/v2/openstack/flavors/5" rel="self"/>
<atom:link href="http://openstack.example.com/openstack/flavors/5" rel="bookmark"/>
</flavor>
-</flavors> \ No newline at end of file
+</flavors>
diff --git a/doc/api_samples/all_extensions/flavor-get-resp.json b/doc/api_samples/all_extensions/flavor-get-resp.json
index d37117d84..b68bc3c97 100644
--- a/doc/api_samples/all_extensions/flavor-get-resp.json
+++ b/doc/api_samples/all_extensions/flavor-get-resp.json
@@ -2,7 +2,7 @@
"flavor": {
"OS-FLV-DISABLED:disabled": false,
"OS-FLV-EXT-DATA:ephemeral": 0,
- "disk": 0,
+ "disk": 1,
"id": "1",
"links": [
{
diff --git a/doc/api_samples/all_extensions/flavor-get-resp.xml b/doc/api_samples/all_extensions/flavor-get-resp.xml
index fe0451c1e..53f870ec4 100644
--- a/doc/api_samples/all_extensions/flavor-get-resp.xml
+++ b/doc/api_samples/all_extensions/flavor-get-resp.xml
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
-<flavor xmlns:OS-FLV-DISABLED="http://docs.openstack.org/compute/ext/flavor_disabled/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:OS-FLV-EXT-DATA="http://docs.openstack.org/compute/ext/flavor_extra_data/api/v1.1" xmlns:os-flavor-access="http://docs.openstack.org/compute/ext/flavor_access/api/v2" xmlns="http://docs.openstack.org/compute/api/v1.1" name="m1.tiny" ram="512" vcpus="1" swap="" rxtx_factor="1.0" disk="0" id="1" os-flavor-access:is_public="True" OS-FLV-EXT-DATA:ephemeral="0" OS-FLV-DISABLED:disabled="False">
+<flavor xmlns:OS-FLV-DISABLED="http://docs.openstack.org/compute/ext/flavor_disabled/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:OS-FLV-EXT-DATA="http://docs.openstack.org/compute/ext/flavor_extra_data/api/v1.1" xmlns:os-flavor-access="http://docs.openstack.org/compute/ext/flavor_access/api/v2" xmlns="http://docs.openstack.org/compute/api/v1.1" name="m1.tiny" ram="512" vcpus="1" swap="" rxtx_factor="1.0" disk="1" id="1" os-flavor-access:is_public="True" OS-FLV-EXT-DATA:ephemeral="0" OS-FLV-DISABLED:disabled="False">
<atom:link href="http://openstack.example.com/v2/openstack/flavors/1" rel="self"/>
<atom:link href="http://openstack.example.com/openstack/flavors/1" rel="bookmark"/>
-</flavor> \ No newline at end of file
+</flavor>
diff --git a/doc/api_samples/flavor-get-resp.json b/doc/api_samples/flavor-get-resp.json
index 160238eea..723be2898 100644
--- a/doc/api_samples/flavor-get-resp.json
+++ b/doc/api_samples/flavor-get-resp.json
@@ -1,6 +1,6 @@
{
"flavor": {
- "disk": 0,
+ "disk": 1,
"id": "1",
"links": [
{
@@ -16,4 +16,4 @@
"ram": 512,
"vcpus": 1
}
-} \ No newline at end of file
+}
diff --git a/doc/api_samples/flavor-get-resp.xml b/doc/api_samples/flavor-get-resp.xml
index 93b91a531..1101fdb56 100644
--- a/doc/api_samples/flavor-get-resp.xml
+++ b/doc/api_samples/flavor-get-resp.xml
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
-<flavor xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" disk="0" vcpus="1" ram="512" name="m1.tiny" id="1">
+<flavor xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" disk="1" vcpus="1" ram="512" name="m1.tiny" id="1">
<atom:link href="http://openstack.example.com/v2/openstack/flavors/1" rel="self"/>
<atom:link href="http://openstack.example.com/openstack/flavors/1" rel="bookmark"/>
-</flavor> \ No newline at end of file
+</flavor>
diff --git a/doc/api_samples/os-flavor-access/flavor-access-detail-resp.json b/doc/api_samples/os-flavor-access/flavor-access-detail-resp.json
index f5e8a7584..03758ca68 100644
--- a/doc/api_samples/os-flavor-access/flavor-access-detail-resp.json
+++ b/doc/api_samples/os-flavor-access/flavor-access-detail-resp.json
@@ -1,7 +1,7 @@
{
"flavors": [
{
- "disk": 0,
+ "disk": 1,
"id": "1",
"links": [
{
@@ -91,4 +91,4 @@
"vcpus": 8
}
]
-} \ No newline at end of file
+}
diff --git a/doc/api_samples/os-flavor-access/flavor-access-detail-resp.xml b/doc/api_samples/os-flavor-access/flavor-access-detail-resp.xml
index 1cbe69c7d..3099fa98f 100644
--- a/doc/api_samples/os-flavor-access/flavor-access-detail-resp.xml
+++ b/doc/api_samples/os-flavor-access/flavor-access-detail-resp.xml
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<flavors xmlns:os-flavor-access="http://docs.openstack.org/compute/ext/flavor_access/api/v2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
- <flavor disk="0" vcpus="1" ram="512" name="m1.tiny" id="1" os-flavor-access:is_public="True">
+ <flavor disk="1" vcpus="1" ram="512" name="m1.tiny" id="1" os-flavor-access:is_public="True">
<atom:link href="http://openstack.example.com/v2/openstack/flavors/1" rel="self"/>
<atom:link href="http://openstack.example.com/openstack/flavors/1" rel="bookmark"/>
</flavor>
@@ -20,4 +20,4 @@
<atom:link href="http://openstack.example.com/v2/openstack/flavors/5" rel="self"/>
<atom:link href="http://openstack.example.com/openstack/flavors/5" rel="bookmark"/>
</flavor>
-</flavors> \ No newline at end of file
+</flavors>
diff --git a/doc/api_samples/os-flavor-access/flavor-access-show-resp.json b/doc/api_samples/os-flavor-access/flavor-access-show-resp.json
index a60b8cc62..0a27a086d 100644
--- a/doc/api_samples/os-flavor-access/flavor-access-show-resp.json
+++ b/doc/api_samples/os-flavor-access/flavor-access-show-resp.json
@@ -1,6 +1,6 @@
{
"flavor": {
- "disk": 0,
+ "disk": 1,
"id": "1",
"links": [
{
@@ -17,4 +17,4 @@
"ram": 512,
"vcpus": 1
}
-} \ No newline at end of file
+}
diff --git a/doc/api_samples/os-flavor-access/flavor-access-show-resp.xml b/doc/api_samples/os-flavor-access/flavor-access-show-resp.xml
index ae699cb07..3fa7f0c43 100644
--- a/doc/api_samples/os-flavor-access/flavor-access-show-resp.xml
+++ b/doc/api_samples/os-flavor-access/flavor-access-show-resp.xml
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
-<flavor xmlns:os-flavor-access="http://docs.openstack.org/compute/ext/flavor_access/api/v2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" disk="0" vcpus="1" ram="512" name="m1.tiny" id="1" os-flavor-access:is_public="True">
+<flavor xmlns:os-flavor-access="http://docs.openstack.org/compute/ext/flavor_access/api/v2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" disk="1" vcpus="1" ram="512" name="m1.tiny" id="1" os-flavor-access:is_public="True">
<atom:link href="http://openstack.example.com/v2/openstack/flavors/1" rel="self"/>
<atom:link href="http://openstack.example.com/openstack/flavors/1" rel="bookmark"/>
-</flavor> \ No newline at end of file
+</flavor>
diff --git a/doc/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.json b/doc/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.json
index 63eaddeb6..ac67e6585 100644
--- a/doc/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.json
+++ b/doc/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.json
@@ -1,6 +1,6 @@
{
"flavor": {
- "disk": 0,
+ "disk": 1,
"id": "1",
"links": [
{
@@ -17,4 +17,4 @@
"rxtx_factor": 1.0,
"vcpus": 1
}
-} \ No newline at end of file
+}
diff --git a/doc/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.xml b/doc/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.xml
index 78b430eca..a07dfcfb9 100644
--- a/doc/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.xml
+++ b/doc/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.xml
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
-<flavor xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" disk="0" vcpus="1" ram="512" name="m1.tiny" id="1" rxtx_factor="1.0">
+<flavor xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" disk="1" vcpus="1" ram="512" name="m1.tiny" id="1" rxtx_factor="1.0">
<atom:link href="http://openstack.example.com/v2/openstack/flavors/1" rel="self"/>
<atom:link href="http://openstack.example.com/openstack/flavors/1" rel="bookmark"/>
-</flavor> \ No newline at end of file
+</flavor>
diff --git a/doc/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.json b/doc/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.json
index 81e9c993c..03f4360d9 100644
--- a/doc/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.json
+++ b/doc/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.json
@@ -1,7 +1,7 @@
{
"flavors": [
{
- "disk": 0,
+ "disk": 1,
"id": "1",
"links": [
{
@@ -91,4 +91,4 @@
"vcpus": 8
}
]
-} \ No newline at end of file
+}
diff --git a/doc/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.xml b/doc/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.xml
index 05192e3f9..c204e7cdf 100644
--- a/doc/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.xml
+++ b/doc/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.xml
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<flavors xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
- <flavor disk="0" vcpus="1" ram="512" name="m1.tiny" id="1" rxtx_factor="1.0">
+ <flavor disk="1" vcpus="1" ram="512" name="m1.tiny" id="1" rxtx_factor="1.0">
<atom:link href="http://openstack.example.com/v2/openstack/flavors/1" rel="self"/>
<atom:link href="http://openstack.example.com/openstack/flavors/1" rel="bookmark"/>
</flavor>
@@ -20,4 +20,4 @@
<atom:link href="http://openstack.example.com/v2/openstack/flavors/5" rel="self"/>
<atom:link href="http://openstack.example.com/openstack/flavors/5" rel="bookmark"/>
</flavor>
-</flavors> \ No newline at end of file
+</flavors>
diff --git a/doc/api_samples/os-flavor-swap/flavor-swap-get-resp.json b/doc/api_samples/os-flavor-swap/flavor-swap-get-resp.json
index 15604fe2b..2a8e394db 100644
--- a/doc/api_samples/os-flavor-swap/flavor-swap-get-resp.json
+++ b/doc/api_samples/os-flavor-swap/flavor-swap-get-resp.json
@@ -1,6 +1,6 @@
{
"flavor": {
- "disk": 0,
+ "disk": 1,
"id": "1",
"links": [
{
@@ -17,4 +17,4 @@
"swap": "",
"vcpus": 1
}
-} \ No newline at end of file
+}
diff --git a/doc/api_samples/os-flavor-swap/flavor-swap-get-resp.xml b/doc/api_samples/os-flavor-swap/flavor-swap-get-resp.xml
index 5357967f3..2cf38aa6c 100644
--- a/doc/api_samples/os-flavor-swap/flavor-swap-get-resp.xml
+++ b/doc/api_samples/os-flavor-swap/flavor-swap-get-resp.xml
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
-<flavor xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" disk="0" vcpus="1" ram="512" name="m1.tiny" id="1" swap="">
+<flavor xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" disk="1" vcpus="1" ram="512" name="m1.tiny" id="1" swap="">
<atom:link href="http://openstack.example.com/v2/openstack/flavors/1" rel="self"/>
<atom:link href="http://openstack.example.com/openstack/flavors/1" rel="bookmark"/>
-</flavor> \ No newline at end of file
+</flavor>
diff --git a/doc/api_samples/os-flavor-swap/flavor-swap-list-resp.json b/doc/api_samples/os-flavor-swap/flavor-swap-list-resp.json
index 5bb94f348..b5377ed4a 100644
--- a/doc/api_samples/os-flavor-swap/flavor-swap-list-resp.json
+++ b/doc/api_samples/os-flavor-swap/flavor-swap-list-resp.json
@@ -1,7 +1,7 @@
{
"flavors": [
{
- "disk": 0,
+ "disk": 1,
"id": "1",
"links": [
{
@@ -91,4 +91,4 @@
"vcpus": 8
}
]
-} \ No newline at end of file
+}
diff --git a/doc/api_samples/os-flavor-swap/flavor-swap-list-resp.xml b/doc/api_samples/os-flavor-swap/flavor-swap-list-resp.xml
index 55b54f700..d9a40dd96 100644
--- a/doc/api_samples/os-flavor-swap/flavor-swap-list-resp.xml
+++ b/doc/api_samples/os-flavor-swap/flavor-swap-list-resp.xml
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<flavors xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
- <flavor disk="0" vcpus="1" ram="512" name="m1.tiny" id="1" swap="">
+ <flavor disk="1" vcpus="1" ram="512" name="m1.tiny" id="1" swap="">
<atom:link href="http://openstack.example.com/v2/openstack/flavors/1" rel="self"/>
<atom:link href="http://openstack.example.com/openstack/flavors/1" rel="bookmark"/>
</flavor>
@@ -20,4 +20,4 @@
<atom:link href="http://openstack.example.com/v2/openstack/flavors/5" rel="self"/>
<atom:link href="http://openstack.example.com/openstack/flavors/5" rel="bookmark"/>
</flavor>
-</flavors> \ No newline at end of file
+</flavors>
diff --git a/doc/api_samples/os-simple-tenant-usage/simple-tenant-usage-get-specific.json b/doc/api_samples/os-simple-tenant-usage/simple-tenant-usage-get-specific.json
index 5020a2a81..6ab0e1fd5 100644
--- a/doc/api_samples/os-simple-tenant-usage/simple-tenant-usage-get-specific.json
+++ b/doc/api_samples/os-simple-tenant-usage/simple-tenant-usage-get-specific.json
@@ -6,7 +6,7 @@
"flavor": "m1.tiny",
"hours": 1.0,
"instance_id": "1f1deceb-17b5-4c04-84c7-e0d4499c8fe0",
- "local_gb": 0,
+ "local_gb": 1,
"memory_mb": 512,
"name": "new-server-test",
"started_at": "2012-10-08T20:10:44.541277",
@@ -20,8 +20,8 @@
"stop": "2012-10-08T21:10:44.587336",
"tenant_id": "openstack",
"total_hours": 1.0,
- "total_local_gb_usage": 0.0,
+ "total_local_gb_usage": 1.0,
"total_memory_mb_usage": 512.0,
"total_vcpus_usage": 1.0
}
-} \ No newline at end of file
+}
diff --git a/doc/api_samples/os-simple-tenant-usage/simple-tenant-usage-get-specific.xml b/doc/api_samples/os-simple-tenant-usage/simple-tenant-usage-get-specific.xml
index 2da8ebea1..56f95edc4 100644
--- a/doc/api_samples/os-simple-tenant-usage/simple-tenant-usage-get-specific.xml
+++ b/doc/api_samples/os-simple-tenant-usage/simple-tenant-usage-get-specific.xml
@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<tenant_usage>
<tenant_id>openstack</tenant_id>
- <total_local_gb_usage>0.0</total_local_gb_usage>
+ <total_local_gb_usage>1.0</total_local_gb_usage>
<total_vcpus_usage>1.0</total_vcpus_usage>
<total_memory_mb_usage>512.0</total_memory_mb_usage>
<total_hours>1.0</total_hours>
@@ -13,7 +13,7 @@
<name>new-server-test</name>
<hours>1.0</hours>
<memory_mb>512</memory_mb>
- <local_gb>0</local_gb>
+ <local_gb>1</local_gb>
<vcpus>1</vcpus>
<tenant_id>openstack</tenant_id>
<flavor>m1.tiny</flavor>
@@ -23,4 +23,4 @@
<uptime>3600</uptime>
</server_usage>
</server_usages>
-</tenant_usage> \ No newline at end of file
+</tenant_usage>
diff --git a/doc/api_samples/os-simple-tenant-usage/simple-tenant-usage-get.json b/doc/api_samples/os-simple-tenant-usage/simple-tenant-usage-get.json
index fb1d0f79f..ba45c4b5c 100644
--- a/doc/api_samples/os-simple-tenant-usage/simple-tenant-usage-get.json
+++ b/doc/api_samples/os-simple-tenant-usage/simple-tenant-usage-get.json
@@ -5,9 +5,9 @@
"stop": "2012-10-08T22:10:44.587336",
"tenant_id": "openstack",
"total_hours": 1.0,
- "total_local_gb_usage": 0.0,
+ "total_local_gb_usage": 1.0,
"total_memory_mb_usage": 512.0,
"total_vcpus_usage": 1.0
}
]
-} \ No newline at end of file
+}
diff --git a/doc/api_samples/os-simple-tenant-usage/simple-tenant-usage-get.xml b/doc/api_samples/os-simple-tenant-usage/simple-tenant-usage-get.xml
index 4fca57e1d..8807691b7 100644
--- a/doc/api_samples/os-simple-tenant-usage/simple-tenant-usage-get.xml
+++ b/doc/api_samples/os-simple-tenant-usage/simple-tenant-usage-get.xml
@@ -2,7 +2,7 @@
<tenant_usages>
<tenant_usage>
<tenant_id>openstack</tenant_id>
- <total_local_gb_usage>0.0</total_local_gb_usage>
+ <total_local_gb_usage>1.0</total_local_gb_usage>
<total_vcpus_usage>1.0</total_vcpus_usage>
<total_memory_mb_usage>512.0</total_memory_mb_usage>
<total_hours>1.0</total_hours>
@@ -10,4 +10,4 @@
<stop>2012-10-08 22:10:51.902640</stop>
<server_usages/>
</tenant_usage>
-</tenant_usages> \ No newline at end of file
+</tenant_usages>
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index a0f679d73..9f7da2c39 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -95,6 +95,7 @@ def require_admin_context(f):
"""
+ @functools.wraps(f)
def wrapper(*args, **kwargs):
nova.context.require_admin_context(args[0])
return f(*args, **kwargs)
@@ -112,6 +113,7 @@ def require_context(f):
"""
+ @functools.wraps(f)
def wrapper(*args, **kwargs):
nova.context.require_context(args[0])
return f(*args, **kwargs)
diff --git a/nova/db/sqlalchemy/migrate_repo/versions/133_folsom.py b/nova/db/sqlalchemy/migrate_repo/versions/133_folsom.py
index 1b688a883..a24cabb2f 100644
--- a/nova/db/sqlalchemy/migrate_repo/versions/133_folsom.py
+++ b/nova/db/sqlalchemy/migrate_repo/versions/133_folsom.py
@@ -38,7 +38,7 @@ def MediumText():
def _populate_instance_types(instance_types_table):
default_inst_types = {
- 'm1.tiny': dict(mem=512, vcpus=1, root_gb=0, eph_gb=0, flavid=1),
+ 'm1.tiny': dict(mem=512, vcpus=1, root_gb=1, eph_gb=0, flavid=1),
'm1.small': dict(mem=2048, vcpus=1, root_gb=20, eph_gb=0, flavid=2),
'm1.medium': dict(mem=4096, vcpus=2, root_gb=40, eph_gb=0, flavid=3),
'm1.large': dict(mem=8192, vcpus=4, root_gb=80, eph_gb=0, flavid=4),
diff --git a/nova/openstack/common/jsonutils.py b/nova/openstack/common/jsonutils.py
index 0aab537a7..11af66daf 100644
--- a/nova/openstack/common/jsonutils.py
+++ b/nova/openstack/common/jsonutils.py
@@ -41,6 +41,8 @@ import json
import types
import xmlrpclib
+import six
+
from nova.openstack.common import timeutils
@@ -93,7 +95,7 @@ def to_primitive(value, convert_instances=False, convert_datetime=True,
# value of itertools.count doesn't get caught by nasty_type_tests
# and results in infinite loop when list(value) is called.
if type(value) == itertools.count:
- return unicode(value)
+ return six.text_type(value)
# FIXME(vish): Workaround for LP bug 852095. Without this workaround,
# tests that raise an exception in a mocked method that
@@ -137,12 +139,12 @@ def to_primitive(value, convert_instances=False, convert_datetime=True,
return recursive(value.__dict__, level=level + 1)
else:
if any(test(value) for test in _nasty_type_tests):
- return unicode(value)
+ return six.text_type(value)
return value
except TypeError:
# Class objects are tricky since they may define something like
# __iter__ defined but it isn't callable as list().
- return unicode(value)
+ return six.text_type(value)
def dumps(value, default=to_primitive, **kwargs):
diff --git a/nova/openstack/common/log.py b/nova/openstack/common/log.py
index e11f666fc..cdaba43ab 100644
--- a/nova/openstack/common/log.py
+++ b/nova/openstack/common/log.py
@@ -43,9 +43,9 @@ import traceback
from oslo.config import cfg
from nova.openstack.common.gettextutils import _
+from nova.openstack.common import importutils
from nova.openstack.common import jsonutils
from nova.openstack.common import local
-from nova.openstack.common import notifier
_DEFAULT_LOG_DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
@@ -322,17 +322,6 @@ class JSONFormatter(logging.Formatter):
return jsonutils.dumps(message)
-class PublishErrorsHandler(logging.Handler):
- def emit(self, record):
- if ('nova.openstack.common.notifier.log_notifier' in
- CONF.notification_driver):
- return
- notifier.api.notify(None, 'error.publisher',
- 'error_notification',
- notifier.api.ERROR,
- dict(error=record.msg))
-
-
def _create_logging_excepthook(product_name):
def logging_excepthook(type, value, tb):
extra = {}
@@ -428,7 +417,10 @@ def _setup_logging_from_conf():
log_root.addHandler(streamlog)
if CONF.publish_errors:
- log_root.addHandler(PublishErrorsHandler(logging.ERROR))
+ handler = importutils.import_object(
+ "nova.openstack.common.log_handler.PublishErrorsHandler",
+ logging.ERROR)
+ log_root.addHandler(handler)
datefmt = CONF.log_date_format
for handler in log_root.handlers:
diff --git a/nova/openstack/common/processutils.py b/nova/openstack/common/processutils.py
index 6474db4ad..de6179602 100644
--- a/nova/openstack/common/processutils.py
+++ b/nova/openstack/common/processutils.py
@@ -123,7 +123,7 @@ def execute(*cmd, **kwargs):
elif isinstance(check_exit_code, int):
check_exit_code = [check_exit_code]
- if len(kwargs):
+ if kwargs:
raise UnknownArgumentError(_('Got unknown keyword args '
'to utils.execute: %r') % kwargs)
diff --git a/nova/openstack/common/service.py b/nova/openstack/common/service.py
new file mode 100644
index 000000000..a1f430999
--- /dev/null
+++ b/nova/openstack/common/service.py
@@ -0,0 +1,333 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2010 United States Government as represented by the
+# Administrator of the National Aeronautics and Space Administration.
+# Copyright 2011 Justin Santa Barbara
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# 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.
+
+"""Generic Node base class for all workers that run on hosts."""
+
+import errno
+import os
+import random
+import signal
+import sys
+import time
+
+import eventlet
+import logging as std_logging
+from oslo.config import cfg
+
+from nova.openstack.common import eventlet_backdoor
+from nova.openstack.common.gettextutils import _
+from nova.openstack.common import importutils
+from nova.openstack.common import log as logging
+from nova.openstack.common import threadgroup
+
+
+rpc = importutils.try_import('nova.openstack.common.rpc')
+CONF = cfg.CONF
+LOG = logging.getLogger(__name__)
+
+
+class Launcher(object):
+ """Launch one or more services and wait for them to complete."""
+
+ def __init__(self):
+ """Initialize the service launcher.
+
+ :returns: None
+
+ """
+ self._services = threadgroup.ThreadGroup()
+ self.backdoor_port = eventlet_backdoor.initialize_if_enabled()
+
+ @staticmethod
+ def run_service(service):
+ """Start and wait for a service to finish.
+
+ :param service: service to run and wait for.
+ :returns: None
+
+ """
+ service.start()
+ service.wait()
+
+ def launch_service(self, service):
+ """Load and start the given service.
+
+ :param service: The service you would like to start.
+ :returns: None
+
+ """
+ service.backdoor_port = self.backdoor_port
+ self._services.add_thread(self.run_service, service)
+
+ def stop(self):
+ """Stop all services which are currently running.
+
+ :returns: None
+
+ """
+ self._services.stop()
+
+ def wait(self):
+ """Waits until all services have been stopped, and then returns.
+
+ :returns: None
+
+ """
+ self._services.wait()
+
+
+class SignalExit(SystemExit):
+ def __init__(self, signo, exccode=1):
+ super(SignalExit, self).__init__(exccode)
+ self.signo = signo
+
+
+class ServiceLauncher(Launcher):
+ def _handle_signal(self, signo, frame):
+ # Allow the process to be killed again and die from natural causes
+ signal.signal(signal.SIGTERM, signal.SIG_DFL)
+ signal.signal(signal.SIGINT, signal.SIG_DFL)
+
+ raise SignalExit(signo)
+
+ def wait(self):
+ signal.signal(signal.SIGTERM, self._handle_signal)
+ signal.signal(signal.SIGINT, self._handle_signal)
+
+ LOG.debug(_('Full set of CONF:'))
+ CONF.log_opt_values(LOG, std_logging.DEBUG)
+
+ status = None
+ try:
+ super(ServiceLauncher, self).wait()
+ except SignalExit as exc:
+ signame = {signal.SIGTERM: 'SIGTERM',
+ signal.SIGINT: 'SIGINT'}[exc.signo]
+ LOG.info(_('Caught %s, exiting'), signame)
+ status = exc.code
+ except SystemExit as exc:
+ status = exc.code
+ finally:
+ if rpc:
+ rpc.cleanup()
+ self.stop()
+ return status
+
+
+class ServiceWrapper(object):
+ def __init__(self, service, workers):
+ self.service = service
+ self.workers = workers
+ self.children = set()
+ self.forktimes = []
+
+
+class ProcessLauncher(object):
+ def __init__(self):
+ self.children = {}
+ self.sigcaught = None
+ self.running = True
+ rfd, self.writepipe = os.pipe()
+ self.readpipe = eventlet.greenio.GreenPipe(rfd, 'r')
+
+ signal.signal(signal.SIGTERM, self._handle_signal)
+ signal.signal(signal.SIGINT, self._handle_signal)
+
+ def _handle_signal(self, signo, frame):
+ self.sigcaught = signo
+ self.running = False
+
+ # Allow the process to be killed again and die from natural causes
+ signal.signal(signal.SIGTERM, signal.SIG_DFL)
+ signal.signal(signal.SIGINT, signal.SIG_DFL)
+
+ def _pipe_watcher(self):
+ # This will block until the write end is closed when the parent
+ # dies unexpectedly
+ self.readpipe.read()
+
+ LOG.info(_('Parent process has died unexpectedly, exiting'))
+
+ sys.exit(1)
+
+ def _child_process(self, service):
+ # Setup child signal handlers differently
+ def _sigterm(*args):
+ signal.signal(signal.SIGTERM, signal.SIG_DFL)
+ raise SignalExit(signal.SIGTERM)
+
+ signal.signal(signal.SIGTERM, _sigterm)
+ # Block SIGINT and let the parent send us a SIGTERM
+ signal.signal(signal.SIGINT, signal.SIG_IGN)
+
+ # Reopen the eventlet hub to make sure we don't share an epoll
+ # fd with parent and/or siblings, which would be bad
+ eventlet.hubs.use_hub()
+
+ # Close write to ensure only parent has it open
+ os.close(self.writepipe)
+ # Create greenthread to watch for parent to close pipe
+ eventlet.spawn_n(self._pipe_watcher)
+
+ # Reseed random number generator
+ random.seed()
+
+ launcher = Launcher()
+ launcher.run_service(service)
+
+ def _start_child(self, wrap):
+ if len(wrap.forktimes) > wrap.workers:
+ # Limit ourselves to one process a second (over the period of
+ # number of workers * 1 second). This will allow workers to
+ # start up quickly but ensure we don't fork off children that
+ # die instantly too quickly.
+ if time.time() - wrap.forktimes[0] < wrap.workers:
+ LOG.info(_('Forking too fast, sleeping'))
+ time.sleep(1)
+
+ wrap.forktimes.pop(0)
+
+ wrap.forktimes.append(time.time())
+
+ pid = os.fork()
+ if pid == 0:
+ # NOTE(johannes): All exceptions are caught to ensure this
+ # doesn't fallback into the loop spawning children. It would
+ # be bad for a child to spawn more children.
+ status = 0
+ try:
+ self._child_process(wrap.service)
+ except SignalExit as exc:
+ signame = {signal.SIGTERM: 'SIGTERM',
+ signal.SIGINT: 'SIGINT'}[exc.signo]
+ LOG.info(_('Caught %s, exiting'), signame)
+ status = exc.code
+ except SystemExit as exc:
+ status = exc.code
+ except BaseException:
+ LOG.exception(_('Unhandled exception'))
+ status = 2
+ finally:
+ wrap.service.stop()
+
+ os._exit(status)
+
+ LOG.info(_('Started child %d'), pid)
+
+ wrap.children.add(pid)
+ self.children[pid] = wrap
+
+ return pid
+
+ def launch_service(self, service, workers=1):
+ wrap = ServiceWrapper(service, workers)
+
+ LOG.info(_('Starting %d workers'), wrap.workers)
+ while self.running and len(wrap.children) < wrap.workers:
+ self._start_child(wrap)
+
+ def _wait_child(self):
+ try:
+ # Don't block if no child processes have exited
+ pid, status = os.waitpid(0, os.WNOHANG)
+ if not pid:
+ return None
+ except OSError as exc:
+ if exc.errno not in (errno.EINTR, errno.ECHILD):
+ raise
+ return None
+
+ if os.WIFSIGNALED(status):
+ sig = os.WTERMSIG(status)
+ LOG.info(_('Child %(pid)d killed by signal %(sig)d'),
+ dict(pid=pid, sig=sig))
+ else:
+ code = os.WEXITSTATUS(status)
+ LOG.info(_('Child %(pid)s exited with status %(code)d'),
+ dict(pid=pid, code=code))
+
+ if pid not in self.children:
+ LOG.warning(_('pid %d not in child list'), pid)
+ return None
+
+ wrap = self.children.pop(pid)
+ wrap.children.remove(pid)
+ return wrap
+
+ def wait(self):
+ """Loop waiting on children to die and respawning as necessary"""
+
+ LOG.debug(_('Full set of CONF:'))
+ CONF.log_opt_values(LOG, std_logging.DEBUG)
+
+ while self.running:
+ wrap = self._wait_child()
+ if not wrap:
+ # Yield to other threads if no children have exited
+ # Sleep for a short time to avoid excessive CPU usage
+ # (see bug #1095346)
+ eventlet.greenthread.sleep(.01)
+ continue
+
+ while self.running and len(wrap.children) < wrap.workers:
+ self._start_child(wrap)
+
+ if self.sigcaught:
+ signame = {signal.SIGTERM: 'SIGTERM',
+ signal.SIGINT: 'SIGINT'}[self.sigcaught]
+ LOG.info(_('Caught %s, stopping children'), signame)
+
+ for pid in self.children:
+ try:
+ os.kill(pid, signal.SIGTERM)
+ except OSError as exc:
+ if exc.errno != errno.ESRCH:
+ raise
+
+ # Wait for children to die
+ if self.children:
+ LOG.info(_('Waiting on %d children to exit'), len(self.children))
+ while self.children:
+ self._wait_child()
+
+
+class Service(object):
+ """Service object for binaries running on hosts."""
+
+ def __init__(self, threads=1000):
+ self.tg = threadgroup.ThreadGroup(threads)
+
+ def start(self):
+ pass
+
+ def stop(self):
+ self.tg.stop()
+
+ def wait(self):
+ self.tg.wait()
+
+
+def launch(service, workers=None):
+ if workers:
+ launcher = ProcessLauncher()
+ launcher.launch_service(service, workers=workers)
+ else:
+ launcher = ServiceLauncher()
+ launcher.launch_service(service)
+ return launcher
diff --git a/nova/openstack/common/threadgroup.py b/nova/openstack/common/threadgroup.py
new file mode 100644
index 000000000..26a391f58
--- /dev/null
+++ b/nova/openstack/common/threadgroup.py
@@ -0,0 +1,121 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2012 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# 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 eventlet import greenlet
+from eventlet import greenpool
+from eventlet import greenthread
+
+from nova.openstack.common import log as logging
+from nova.openstack.common import loopingcall
+
+
+LOG = logging.getLogger(__name__)
+
+
+def _thread_done(gt, *args, **kwargs):
+ """ Callback function to be passed to GreenThread.link() when we spawn()
+ Calls the :class:`ThreadGroup` to notify if.
+
+ """
+ kwargs['group'].thread_done(kwargs['thread'])
+
+
+class Thread(object):
+ """ Wrapper around a greenthread, that holds a reference to the
+ :class:`ThreadGroup`. The Thread will notify the :class:`ThreadGroup` when
+ it has done so it can be removed from the threads list.
+ """
+ def __init__(self, thread, group):
+ self.thread = thread
+ self.thread.link(_thread_done, group=group, thread=self)
+
+ def stop(self):
+ self.thread.kill()
+
+ def wait(self):
+ return self.thread.wait()
+
+
+class ThreadGroup(object):
+ """ The point of the ThreadGroup classis to:
+
+ * keep track of timers and greenthreads (making it easier to stop them
+ when need be).
+ * provide an easy API to add timers.
+ """
+ def __init__(self, thread_pool_size=10):
+ self.pool = greenpool.GreenPool(thread_pool_size)
+ self.threads = []
+ self.timers = []
+
+ def add_dynamic_timer(self, callback, initial_delay=None,
+ periodic_interval_max=None, *args, **kwargs):
+ timer = loopingcall.DynamicLoopingCall(callback, *args, **kwargs)
+ timer.start(initial_delay=initial_delay,
+ periodic_interval_max=periodic_interval_max)
+ self.timers.append(timer)
+
+ def add_timer(self, interval, callback, initial_delay=None,
+ *args, **kwargs):
+ pulse = loopingcall.FixedIntervalLoopingCall(callback, *args, **kwargs)
+ pulse.start(interval=interval,
+ initial_delay=initial_delay)
+ self.timers.append(pulse)
+
+ def add_thread(self, callback, *args, **kwargs):
+ gt = self.pool.spawn(callback, *args, **kwargs)
+ th = Thread(gt, self)
+ self.threads.append(th)
+
+ def thread_done(self, thread):
+ self.threads.remove(thread)
+
+ def stop(self):
+ current = greenthread.getcurrent()
+ for x in self.threads:
+ if x is current:
+ # don't kill the current thread.
+ continue
+ try:
+ x.stop()
+ except Exception as ex:
+ LOG.exception(ex)
+
+ for x in self.timers:
+ try:
+ x.stop()
+ except Exception as ex:
+ LOG.exception(ex)
+ self.timers = []
+
+ def wait(self):
+ for x in self.timers:
+ try:
+ x.wait()
+ except greenlet.GreenletExit:
+ pass
+ except Exception as ex:
+ LOG.exception(ex)
+ current = greenthread.getcurrent()
+ for x in self.threads:
+ if x is current:
+ continue
+ try:
+ x.wait()
+ except greenlet.GreenletExit:
+ pass
+ except Exception as ex:
+ LOG.exception(ex)
diff --git a/nova/tests/integrated/api_samples/OS-FLV-DISABLED/flavor-detail-get-resp.json.tpl b/nova/tests/integrated/api_samples/OS-FLV-DISABLED/flavor-detail-get-resp.json.tpl
index d1f78c08e..04083d063 100644
--- a/nova/tests/integrated/api_samples/OS-FLV-DISABLED/flavor-detail-get-resp.json.tpl
+++ b/nova/tests/integrated/api_samples/OS-FLV-DISABLED/flavor-detail-get-resp.json.tpl
@@ -2,7 +2,7 @@
"flavors": [
{
"OS-FLV-DISABLED:disabled": false,
- "disk": 0,
+ "disk": 1,
"id": "1",
"links": [
{
diff --git a/nova/tests/integrated/api_samples/OS-FLV-DISABLED/flavor-detail-get-resp.xml.tpl b/nova/tests/integrated/api_samples/OS-FLV-DISABLED/flavor-detail-get-resp.xml.tpl
index 8d992e42d..5d73195fa 100644
--- a/nova/tests/integrated/api_samples/OS-FLV-DISABLED/flavor-detail-get-resp.xml.tpl
+++ b/nova/tests/integrated/api_samples/OS-FLV-DISABLED/flavor-detail-get-resp.xml.tpl
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<flavors xmlns:OS-FLV-DISABLED="http://docs.openstack.org/compute/ext/flavor_disabled/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
- <flavor disk="0" vcpus="1" ram="512" name="m1.tiny" id="1" OS-FLV-DISABLED:disabled="False">
+ <flavor disk="1" vcpus="1" ram="512" name="m1.tiny" id="1" OS-FLV-DISABLED:disabled="False">
<atom:link href="%(host)s/v2/openstack/flavors/1" rel="self"/>
<atom:link href="%(host)s/openstack/flavors/1" rel="bookmark"/>
</flavor>
diff --git a/nova/tests/integrated/api_samples/OS-FLV-DISABLED/flavor-show-get-resp.json.tpl b/nova/tests/integrated/api_samples/OS-FLV-DISABLED/flavor-show-get-resp.json.tpl
index cf5fb232a..a47af7b18 100644
--- a/nova/tests/integrated/api_samples/OS-FLV-DISABLED/flavor-show-get-resp.json.tpl
+++ b/nova/tests/integrated/api_samples/OS-FLV-DISABLED/flavor-show-get-resp.json.tpl
@@ -1,7 +1,7 @@
{
"flavor": {
"OS-FLV-DISABLED:disabled": false,
- "disk": 0,
+ "disk": 1,
"id": "%(flavor_id)s",
"links": [
{
diff --git a/nova/tests/integrated/api_samples/OS-FLV-DISABLED/flavor-show-get-resp.xml.tpl b/nova/tests/integrated/api_samples/OS-FLV-DISABLED/flavor-show-get-resp.xml.tpl
index c7bdd1ca8..13908e2ac 100644
--- a/nova/tests/integrated/api_samples/OS-FLV-DISABLED/flavor-show-get-resp.xml.tpl
+++ b/nova/tests/integrated/api_samples/OS-FLV-DISABLED/flavor-show-get-resp.xml.tpl
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
-<flavor xmlns:OS-FLV-DISABLED="http://docs.openstack.org/compute/ext/flavor_disabled/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" disk="0" vcpus="1" ram="512" name="m1.tiny" id="%(flavor_id)s" OS-FLV-DISABLED:disabled="False">
+<flavor xmlns:OS-FLV-DISABLED="http://docs.openstack.org/compute/ext/flavor_disabled/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" disk="1" vcpus="1" ram="512" name="m1.tiny" id="%(flavor_id)s" OS-FLV-DISABLED:disabled="False">
<atom:link href="%(host)s/v2/openstack/flavors/%(flavor_id)s" rel="self"/>
<atom:link href="%(host)s/openstack/flavors/%(flavor_id)s" rel="bookmark"/>
</flavor>
diff --git a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.json.tpl b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.json.tpl
index 3422de9f5..b86db0a46 100644
--- a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.json.tpl
+++ b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.json.tpl
@@ -1,7 +1,7 @@
{
"flavor": {
"OS-FLV-EXT-DATA:ephemeral": 0,
- "disk": 0,
+ "disk": 1,
"id": "%(flavor_id)s",
"links": [
{
diff --git a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.xml.tpl b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.xml.tpl
index dc143010a..da45536c3 100644
--- a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.xml.tpl
+++ b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.xml.tpl
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
-<flavor xmlns:OS-FLV-EXT-DATA="http://docs.openstack.org/compute/ext/flavor_extra_data/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" disk="0" vcpus="1" ram="512" name="%(flavor_name)s" id="%(flavor_id)s" OS-FLV-EXT-DATA:ephemeral="0">
+<flavor xmlns:OS-FLV-EXT-DATA="http://docs.openstack.org/compute/ext/flavor_extra_data/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" disk="1" vcpus="1" ram="512" name="%(flavor_name)s" id="%(flavor_id)s" OS-FLV-EXT-DATA:ephemeral="0">
<atom:link href="%(host)s/v2/openstack/flavors/%(flavor_id)s" rel="self"/>
<atom:link href="%(host)s/openstack/flavors/%(flavor_id)s" rel="bookmark"/>
</flavor>
diff --git a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.json.tpl b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.json.tpl
index 2c79efeaf..a798262f3 100644
--- a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.json.tpl
+++ b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.json.tpl
@@ -2,7 +2,7 @@
"flavors": [
{
"OS-FLV-EXT-DATA:ephemeral": 0,
- "disk": 0,
+ "disk": 1,
"id": "1",
"links": [
{
diff --git a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.xml.tpl b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.xml.tpl
index 7108ebd79..5ba463188 100644
--- a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.xml.tpl
+++ b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.xml.tpl
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<flavors xmlns:OS-FLV-EXT-DATA="http://docs.openstack.org/compute/ext/flavor_extra_data/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
- <flavor disk="0" vcpus="1" ram="512" name="m1.tiny" id="1" OS-FLV-EXT-DATA:ephemeral="0">
+ <flavor disk="1" vcpus="1" ram="512" name="m1.tiny" id="1" OS-FLV-EXT-DATA:ephemeral="0">
<atom:link href="%(host)s/v2/openstack/flavors/1" rel="self"/>
<atom:link href="%(host)s/openstack/flavors/1" rel="bookmark"/>
</flavor>
diff --git a/nova/tests/integrated/api_samples/all_extensions/flavor-get-resp.json.tpl b/nova/tests/integrated/api_samples/all_extensions/flavor-get-resp.json.tpl
index bbd681e66..b68bc3c97 100644
--- a/nova/tests/integrated/api_samples/all_extensions/flavor-get-resp.json.tpl
+++ b/nova/tests/integrated/api_samples/all_extensions/flavor-get-resp.json.tpl
@@ -2,7 +2,7 @@
"flavor": {
"OS-FLV-DISABLED:disabled": false,
"OS-FLV-EXT-DATA:ephemeral": 0,
- "disk": 0,
+ "disk": 1,
"id": "1",
"links": [
{
@@ -21,4 +21,4 @@
"swap": "",
"vcpus": 1
}
-} \ No newline at end of file
+}
diff --git a/nova/tests/integrated/api_samples/all_extensions/flavor-get-resp.xml.tpl b/nova/tests/integrated/api_samples/all_extensions/flavor-get-resp.xml.tpl
index 920b82e53..53f870ec4 100644
--- a/nova/tests/integrated/api_samples/all_extensions/flavor-get-resp.xml.tpl
+++ b/nova/tests/integrated/api_samples/all_extensions/flavor-get-resp.xml.tpl
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
-<flavor xmlns:OS-FLV-DISABLED="http://docs.openstack.org/compute/ext/flavor_disabled/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:OS-FLV-EXT-DATA="http://docs.openstack.org/compute/ext/flavor_extra_data/api/v1.1" xmlns:os-flavor-access="http://docs.openstack.org/compute/ext/flavor_access/api/v2" xmlns="http://docs.openstack.org/compute/api/v1.1" name="m1.tiny" ram="512" vcpus="1" swap="" rxtx_factor="1.0" disk="0" id="1" os-flavor-access:is_public="True" OS-FLV-EXT-DATA:ephemeral="0" OS-FLV-DISABLED:disabled="False">
+<flavor xmlns:OS-FLV-DISABLED="http://docs.openstack.org/compute/ext/flavor_disabled/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:OS-FLV-EXT-DATA="http://docs.openstack.org/compute/ext/flavor_extra_data/api/v1.1" xmlns:os-flavor-access="http://docs.openstack.org/compute/ext/flavor_access/api/v2" xmlns="http://docs.openstack.org/compute/api/v1.1" name="m1.tiny" ram="512" vcpus="1" swap="" rxtx_factor="1.0" disk="1" id="1" os-flavor-access:is_public="True" OS-FLV-EXT-DATA:ephemeral="0" OS-FLV-DISABLED:disabled="False">
<atom:link href="http://openstack.example.com/v2/openstack/flavors/1" rel="self"/>
<atom:link href="http://openstack.example.com/openstack/flavors/1" rel="bookmark"/>
</flavor>
diff --git a/nova/tests/integrated/api_samples/flavor-get-resp.json.tpl b/nova/tests/integrated/api_samples/flavor-get-resp.json.tpl
index 86ff86fa1..723be2898 100644
--- a/nova/tests/integrated/api_samples/flavor-get-resp.json.tpl
+++ b/nova/tests/integrated/api_samples/flavor-get-resp.json.tpl
@@ -1,6 +1,6 @@
{
"flavor": {
- "disk": 0,
+ "disk": 1,
"id": "1",
"links": [
{
diff --git a/nova/tests/integrated/api_samples/flavor-get-resp.xml.tpl b/nova/tests/integrated/api_samples/flavor-get-resp.xml.tpl
index ca49884f3..5925c588d 100644
--- a/nova/tests/integrated/api_samples/flavor-get-resp.xml.tpl
+++ b/nova/tests/integrated/api_samples/flavor-get-resp.xml.tpl
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
-<flavor xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" name="m1.tiny" ram="512" vcpus="1" disk="0" id="1">
+<flavor xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" name="m1.tiny" ram="512" vcpus="1" disk="1" id="1">
<atom:link href="http://openstack.example.com/v2/openstack/flavors/1" rel="self"/>
<atom:link href="http://openstack.example.com/openstack/flavors/1" rel="bookmark"/>
</flavor>
diff --git a/nova/tests/integrated/api_samples/flavors-list-resp.json.tpl b/nova/tests/integrated/api_samples/flavors-list-resp.json.tpl
index ab86d2a52..fb9a8ff1f 100644
--- a/nova/tests/integrated/api_samples/flavors-list-resp.json.tpl
+++ b/nova/tests/integrated/api_samples/flavors-list-resp.json.tpl
@@ -71,4 +71,4 @@
"name": "m1.xlarge"
}
]
-} \ No newline at end of file
+}
diff --git a/nova/tests/integrated/api_samples/os-flavor-access/flavor-access-detail-resp.json.tpl b/nova/tests/integrated/api_samples/os-flavor-access/flavor-access-detail-resp.json.tpl
index 711207d2d..b5f1eea54 100644
--- a/nova/tests/integrated/api_samples/os-flavor-access/flavor-access-detail-resp.json.tpl
+++ b/nova/tests/integrated/api_samples/os-flavor-access/flavor-access-detail-resp.json.tpl
@@ -1,7 +1,7 @@
{
"flavors": [
{
- "disk": 0,
+ "disk": 1,
"id": "1",
"links": [
{
diff --git a/nova/tests/integrated/api_samples/os-flavor-access/flavor-access-detail-resp.xml.tpl b/nova/tests/integrated/api_samples/os-flavor-access/flavor-access-detail-resp.xml.tpl
index cdef74cce..8ee66226a 100644
--- a/nova/tests/integrated/api_samples/os-flavor-access/flavor-access-detail-resp.xml.tpl
+++ b/nova/tests/integrated/api_samples/os-flavor-access/flavor-access-detail-resp.xml.tpl
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<flavors xmlns:os-flavor-access="http://docs.openstack.org/compute/ext/flavor_access/api/v2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
- <flavor disk="0" vcpus="1" ram="512" name="m1.tiny" id="1" os-flavor-access:is_public="True">
+ <flavor disk="1" vcpus="1" ram="512" name="m1.tiny" id="1" os-flavor-access:is_public="True">
<atom:link href="%(host)s/v2/openstack/flavors/1" rel="self"/>
<atom:link href="%(host)s/openstack/flavors/1" rel="bookmark"/>
</flavor>
diff --git a/nova/tests/integrated/api_samples/os-flavor-access/flavor-access-show-resp.json.tpl b/nova/tests/integrated/api_samples/os-flavor-access/flavor-access-show-resp.json.tpl
index 975f38661..2e991a4ce 100644
--- a/nova/tests/integrated/api_samples/os-flavor-access/flavor-access-show-resp.json.tpl
+++ b/nova/tests/integrated/api_samples/os-flavor-access/flavor-access-show-resp.json.tpl
@@ -1,6 +1,6 @@
{
"flavor": {
- "disk": 0,
+ "disk": 1,
"id": "%(flavor_id)s",
"links": [
{
diff --git a/nova/tests/integrated/api_samples/os-flavor-access/flavor-access-show-resp.xml.tpl b/nova/tests/integrated/api_samples/os-flavor-access/flavor-access-show-resp.xml.tpl
index f9a3ff178..ae18daba2 100644
--- a/nova/tests/integrated/api_samples/os-flavor-access/flavor-access-show-resp.xml.tpl
+++ b/nova/tests/integrated/api_samples/os-flavor-access/flavor-access-show-resp.xml.tpl
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
-<flavor xmlns:os-flavor-access="http://docs.openstack.org/compute/ext/flavor_access/api/v2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" disk="0" vcpus="1" ram="512" name="m1.tiny" id="%(flavor_id)s" os-flavor-access:is_public="True">
+<flavor xmlns:os-flavor-access="http://docs.openstack.org/compute/ext/flavor_access/api/v2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" disk="1" vcpus="1" ram="512" name="m1.tiny" id="%(flavor_id)s" os-flavor-access:is_public="True">
<atom:link href="%(host)s/v2/openstack/flavors/%(flavor_id)s" rel="self"/>
<atom:link href="%(host)s/openstack/flavors/%(flavor_id)s" rel="bookmark"/>
</flavor>
diff --git a/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.json.tpl b/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.json.tpl
index a7f3a1993..241cf7c80 100644
--- a/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.json.tpl
+++ b/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.json.tpl
@@ -1,6 +1,6 @@
{
"flavor": {
- "disk": 0,
+ "disk": 1,
"id": "%(flavor_id)s",
"links": [
{
diff --git a/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.xml.tpl b/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.xml.tpl
index 4feec740c..d461b443e 100644
--- a/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.xml.tpl
+++ b/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.xml.tpl
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
-<flavor xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" disk="0" vcpus="1" ram="512" name="m1.tiny" id="1" rxtx_factor="1.0">
+<flavor xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" disk="1" vcpus="1" ram="512" name="m1.tiny" id="1" rxtx_factor="1.0">
<atom:link href="%(host)s/v2/openstack/flavors/1" rel="self"/>
<atom:link href="%(host)s/openstack/flavors/1" rel="bookmark"/>
</flavor>
diff --git a/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.json.tpl b/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.json.tpl
index 5b27e1385..035c860c9 100644
--- a/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.json.tpl
+++ b/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.json.tpl
@@ -1,7 +1,7 @@
{
"flavors": [
{
- "disk": 0,
+ "disk": 1,
"id": "1",
"links": [
{
diff --git a/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.xml.tpl b/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.xml.tpl
index fb2ee09e0..ee937b974 100644
--- a/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.xml.tpl
+++ b/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.xml.tpl
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<flavors xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
- <flavor disk="0" vcpus="1" ram="512" name="m1.tiny" id="1" rxtx_factor="1.0">
+ <flavor disk="1" vcpus="1" ram="512" name="m1.tiny" id="1" rxtx_factor="1.0">
<atom:link href="%(host)s/v2/openstack/flavors/1" rel="self"/>
<atom:link href="%(host)s/openstack/flavors/1" rel="bookmark"/>
</flavor>
diff --git a/nova/tests/integrated/api_samples/os-flavor-swap/flavor-swap-get-resp.json.tpl b/nova/tests/integrated/api_samples/os-flavor-swap/flavor-swap-get-resp.json.tpl
index be9afe012..9b7e57c8a 100644
--- a/nova/tests/integrated/api_samples/os-flavor-swap/flavor-swap-get-resp.json.tpl
+++ b/nova/tests/integrated/api_samples/os-flavor-swap/flavor-swap-get-resp.json.tpl
@@ -1,6 +1,6 @@
{
"flavor": {
- "disk": 0,
+ "disk": 1,
"id": "%(flavor_id)s",
"links": [
{
diff --git a/nova/tests/integrated/api_samples/os-flavor-swap/flavor-swap-get-resp.xml.tpl b/nova/tests/integrated/api_samples/os-flavor-swap/flavor-swap-get-resp.xml.tpl
index 53afae086..9375b14b5 100644
--- a/nova/tests/integrated/api_samples/os-flavor-swap/flavor-swap-get-resp.xml.tpl
+++ b/nova/tests/integrated/api_samples/os-flavor-swap/flavor-swap-get-resp.xml.tpl
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
-<flavor xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" disk="0" vcpus="1" ram="512" name="%(flavor_name)s" id="%(flavor_id)s" swap="">
+<flavor xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" disk="1" vcpus="1" ram="512" name="%(flavor_name)s" id="%(flavor_id)s" swap="">
<atom:link href="%(host)s/v2/openstack/flavors/%(flavor_id)s" rel="self"/>
<atom:link href="%(host)s/openstack/flavors/%(flavor_id)s" rel="bookmark"/>
</flavor>
diff --git a/nova/tests/integrated/api_samples/os-flavor-swap/flavor-swap-list-resp.json.tpl b/nova/tests/integrated/api_samples/os-flavor-swap/flavor-swap-list-resp.json.tpl
index c46a1695d..1367e75de 100644
--- a/nova/tests/integrated/api_samples/os-flavor-swap/flavor-swap-list-resp.json.tpl
+++ b/nova/tests/integrated/api_samples/os-flavor-swap/flavor-swap-list-resp.json.tpl
@@ -1,7 +1,7 @@
{
"flavors": [
{
- "disk": 0,
+ "disk": 1,
"id": "1",
"links": [
{
diff --git a/nova/tests/integrated/api_samples/os-flavor-swap/flavor-swap-list-resp.xml.tpl b/nova/tests/integrated/api_samples/os-flavor-swap/flavor-swap-list-resp.xml.tpl
index ced8e1779..7c9c589be 100644
--- a/nova/tests/integrated/api_samples/os-flavor-swap/flavor-swap-list-resp.xml.tpl
+++ b/nova/tests/integrated/api_samples/os-flavor-swap/flavor-swap-list-resp.xml.tpl
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<flavors xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
- <flavor disk="0" vcpus="1" ram="512" name="m1.tiny" id="1" swap="">
+ <flavor disk="1" vcpus="1" ram="512" name="m1.tiny" id="1" swap="">
<atom:link href="%(host)s/v2/openstack/flavors/1" rel="self"/>
<atom:link href="%(host)s/openstack/flavors/1" rel="bookmark"/>
</flavor>
diff --git a/nova/tests/integrated/api_samples/os-simple-tenant-usage/simple-tenant-usage-get-specific.json.tpl b/nova/tests/integrated/api_samples/os-simple-tenant-usage/simple-tenant-usage-get-specific.json.tpl
index 68092f353..a12dd7157 100644
--- a/nova/tests/integrated/api_samples/os-simple-tenant-usage/simple-tenant-usage-get-specific.json.tpl
+++ b/nova/tests/integrated/api_samples/os-simple-tenant-usage/simple-tenant-usage-get-specific.json.tpl
@@ -6,7 +6,7 @@
"flavor": "m1.tiny",
"hours": 1.0,
"instance_id": "%(uuid)s",
- "local_gb": 0,
+ "local_gb": 1,
"memory_mb": 512,
"name": "new-server-test",
"started_at": "%(timestamp)s",
@@ -20,7 +20,7 @@
"stop": "%(timestamp)s",
"tenant_id": "openstack",
"total_hours": 1.0,
- "total_local_gb_usage": 0.0,
+ "total_local_gb_usage": 1.0,
"total_memory_mb_usage": 512.0,
"total_vcpus_usage": 1.0
}
diff --git a/nova/tests/integrated/api_samples/os-simple-tenant-usage/simple-tenant-usage-get-specific.xml.tpl b/nova/tests/integrated/api_samples/os-simple-tenant-usage/simple-tenant-usage-get-specific.xml.tpl
index a8a065fa1..4a6882307 100644
--- a/nova/tests/integrated/api_samples/os-simple-tenant-usage/simple-tenant-usage-get-specific.xml.tpl
+++ b/nova/tests/integrated/api_samples/os-simple-tenant-usage/simple-tenant-usage-get-specific.xml.tpl
@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<tenant_usage>
<tenant_id>openstack</tenant_id>
- <total_local_gb_usage>0.0</total_local_gb_usage>
+ <total_local_gb_usage>1.0</total_local_gb_usage>
<total_vcpus_usage>1.0</total_vcpus_usage>
<total_memory_mb_usage>512.0</total_memory_mb_usage>
<total_hours>1.0</total_hours>
@@ -13,7 +13,7 @@
<name>new-server-test</name>
<hours>1.0</hours>
<memory_mb>512</memory_mb>
- <local_gb>0</local_gb>
+ <local_gb>1</local_gb>
<vcpus>1</vcpus>
<tenant_id>openstack</tenant_id>
<flavor>m1.tiny</flavor>
diff --git a/nova/tests/integrated/api_samples/os-simple-tenant-usage/simple-tenant-usage-get.json.tpl b/nova/tests/integrated/api_samples/os-simple-tenant-usage/simple-tenant-usage-get.json.tpl
index b33ccbfc2..082e6bc90 100644
--- a/nova/tests/integrated/api_samples/os-simple-tenant-usage/simple-tenant-usage-get.json.tpl
+++ b/nova/tests/integrated/api_samples/os-simple-tenant-usage/simple-tenant-usage-get.json.tpl
@@ -5,7 +5,7 @@
"stop": "%(timestamp)s",
"tenant_id": "openstack",
"total_hours": 1.0,
- "total_local_gb_usage": 0.0,
+ "total_local_gb_usage": 1.0,
"total_memory_mb_usage": 512.0,
"total_vcpus_usage": 1.0
}
diff --git a/nova/tests/integrated/api_samples/os-simple-tenant-usage/simple-tenant-usage-get.xml.tpl b/nova/tests/integrated/api_samples/os-simple-tenant-usage/simple-tenant-usage-get.xml.tpl
index 536e79738..4a2833da8 100644
--- a/nova/tests/integrated/api_samples/os-simple-tenant-usage/simple-tenant-usage-get.xml.tpl
+++ b/nova/tests/integrated/api_samples/os-simple-tenant-usage/simple-tenant-usage-get.xml.tpl
@@ -2,7 +2,7 @@
<tenant_usages>
<tenant_usage>
<tenant_id>openstack</tenant_id>
- <total_local_gb_usage>0.0</total_local_gb_usage>
+ <total_local_gb_usage>1.0</total_local_gb_usage>
<total_vcpus_usage>1.0</total_vcpus_usage>
<total_memory_mb_usage>512.0</total_memory_mb_usage>
<total_hours>1.0</total_hours>
diff --git a/nova/tests/test_db_api.py b/nova/tests/test_db_api.py
index 130ed22af..dc2cf0d24 100644
--- a/nova/tests/test_db_api.py
+++ b/nova/tests/test_db_api.py
@@ -1177,6 +1177,22 @@ class DbApiTestCase(DbTestCase):
_compare(bw_usages[2], expected_bw_usages[2])
timeutils.clear_time_override()
+ def _test_decorator_wraps_helper(self, decorator):
+ def test_func():
+ """Test docstring."""
+
+ decorated_func = decorator(test_func)
+
+ self.assertEquals(test_func.func_name, decorated_func.func_name)
+ self.assertEquals(test_func.__doc__, decorated_func.__doc__)
+ self.assertEquals(test_func.__module__, decorated_func.__module__)
+
+ def test_require_context_decorator_wraps_functions_properly(self):
+ self._test_decorator_wraps_helper(sqlalchemy_api.require_context)
+
+ def test_require_admin_context_decorator_wraps_functions_properly(self):
+ self._test_decorator_wraps_helper(sqlalchemy_api.require_admin_context)
+
def _get_fake_aggr_values():
return {'name': 'fake_aggregate'}
diff --git a/openstack-common.conf b/openstack-common.conf
index 24c306181..87be18491 100644
--- a/openstack-common.conf
+++ b/openstack-common.conf
@@ -27,7 +27,9 @@ module=processutils
module=redhat-eventlet.patch
module=rootwrap
module=rpc
+module=service
module=strutils
+module=threadgroup
module=timeutils
module=uuidutils