Removes disk-config extension from v3 api

This patch removes disk-config extension for v3 api, and also
remove related tests. And remove resize extension point for
servers core because there isn't any extension using it anymore
and there isn't good way to test resize extension point.

Implements bp api-v3-remove-disk-config
DocImpact

Change-Id: I894ae6f4e0d6c9f956a71e8e061ccb3fa1b039d8
This commit is contained in:
He Jie Xu
2013-12-15 18:24:54 +08:00
parent 0b54716424
commit ec1711134e
56 changed files with 32 additions and 1779 deletions

View File

@@ -49,7 +49,6 @@
"os-access-ips:access_ip_v4": "",
"os-access-ips:access_ip_v6": "",
"os-config-drive:config_drive": "",
"os-disk-config:disk_config": "AUTO",
"os-extended-availability-zone:availability_zone": "nova",
"os-extended-server-attributes:host": "b8b357f7100d4391828f2177c922ef93",
"os-extended-server-attributes:hypervisor_hostname": "fake-mini",

View File

@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns:os-extended-availability-zone="http://docs.openstack.org/compute/ext/extended_availability_zone/api/v3" xmlns:os-pci="http://docs.openstack.org/compute/ext/os-pci/api/v3" xmlns:os-extended-server-attributes="http://docs.openstack.org/compute/ext/extended_server_attributes/api/v3" xmlns:os-extended-status="http://docs.openstack.org/compute/ext/extended_status/api/v3" xmlns:os-disk-config="http://docs.openstack.org/compute/ext/disk_config/api/v3" xmlns:os-access-ips="http://docs.openstack.org/compute/ext/os-access-ips/api/v3" xmlns:os-extended-volumes="http://docs.openstack.org/compute/ext/extended_volumes/api/v3" xmlns:os-server-usage="http://docs.openstack.org/compute/ext/os-server-usage/api/v3" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:os-config-drive="http://docs.openstack.org/compute/ext/config_drive/api/v3" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="2013-10-31T06:32:30Z" user_id="fake" name="new-server-test" created="2013-09-23T13:25:51Z" tenant_id="openstack" progress="0" host_id="cf633433346bd3b095fe1ee9039b553f9d55b552f001c02544b1da64" id="97918d76-884c-4629-8500-4cc147194463" os-config-drive:config_drive="" os-server-usage:launched_at="2013-09-23 13:25:51.254223" os-server-usage:terminated_at="None" os-extended-status:vm_state="active" os-extended-status:locked_by="None" os-extended-status:power_state="1" os-extended-status:task_state="None" os-access-ips:access_ip_v4="" os-access-ips:access_ip_v6="" os-disk-config:disk_config="AUTO" os-extended-availability-zone:availability_zone="nova" os-extended-server-attributes:hypervisor_hostname="fake-mini" os-extended-server-attributes:instance_name="instance-00000001" os-extended-server-attributes:host="b78e05fa358d404bb5c5f803aba22060" key_name="None">
<server xmlns:os-extended-availability-zone="http://docs.openstack.org/compute/ext/extended_availability_zone/api/v3" xmlns:os-pci="http://docs.openstack.org/compute/ext/os-pci/api/v3" xmlns:os-extended-server-attributes="http://docs.openstack.org/compute/ext/extended_server_attributes/api/v3" xmlns:os-extended-status="http://docs.openstack.org/compute/ext/extended_status/api/v3" xmlns:os-access-ips="http://docs.openstack.org/compute/ext/os-access-ips/api/v3" xmlns:os-extended-volumes="http://docs.openstack.org/compute/ext/extended_volumes/api/v3" xmlns:os-server-usage="http://docs.openstack.org/compute/ext/os-server-usage/api/v3" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:os-config-drive="http://docs.openstack.org/compute/ext/config_drive/api/v3" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="2013-10-31T06:32:30Z" user_id="fake" name="new-server-test" created="2013-09-23T13:25:51Z" tenant_id="openstack" progress="0" host_id="cf633433346bd3b095fe1ee9039b553f9d55b552f001c02544b1da64" id="97918d76-884c-4629-8500-4cc147194463" os-config-drive:config_drive="" os-server-usage:launched_at="2013-09-23 13:25:51.254223" os-server-usage:terminated_at="None" os-extended-status:vm_state="active" os-extended-status:locked_by="None" os-extended-status:power_state="1" os-extended-status:task_state="None" os-access-ips:access_ip_v4="" os-access-ips:access_ip_v6="" os-extended-availability-zone:availability_zone="nova" os-extended-server-attributes:hypervisor_hostname="fake-mini" os-extended-server-attributes:instance_name="instance-00000001" os-extended-server-attributes:host="b78e05fa358d404bb5c5f803aba22060" key_name="None">
<image id="70a599e0-31e7-49b7-b260-868f441e862b">
<atom:link href="http://glance.openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b" rel="bookmark"/>
</image>

View File

@@ -14,7 +14,6 @@
],
"os-access-ips:access_ip_v4": "",
"os-access-ips:access_ip_v6": "",
"os-disk-config:disk_config": "AUTO",
"security_groups": [
{
"name": "default"

View File

@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns:os-access-ips="http://docs.openstack.org/compute/ext/os-access-ips/api/v3" xmlns:os-disk-config="http://docs.openstack.org/compute/ext/disk_config/api/v3" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" id="72885505-d8fb-4078-8bdb-65222c08f4d1" admin_password="V24sJmhzzKLu" os-disk-config:disk_config="AUTO" os-access-ips:access_ip_v4="" os-access-ips:access_ip_v6="">
<server xmlns:os-access-ips="http://docs.openstack.org/compute/ext/os-access-ips/api/v3" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" id="72885505-d8fb-4078-8bdb-65222c08f4d1" admin_password="V24sJmhzzKLu" os-access-ips:access_ip_v4="" os-access-ips:access_ip_v6="">
<metadata/>
<atom:link href="http://openstack.example.com/v3/servers/72885505-d8fb-4078-8bdb-65222c08f4d1" rel="self"/>
<atom:link href="http://openstack.example.com/servers/72885505-d8fb-4078-8bdb-65222c08f4d1" rel="bookmark"/>

View File

@@ -50,7 +50,6 @@
"os-access-ips:access_ip_v4": "",
"os-access-ips:access_ip_v6": "",
"os-config-drive:config_drive": "",
"os-disk-config:disk_config": "AUTO",
"os-extended-availability-zone:availability_zone": "nova",
"os-extended-server-attributes:host": "c3f14e9812ad496baf92ccfb3c61e15f",
"os-extended-server-attributes:hypervisor_hostname": "fake-mini",

View File

@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<servers xmlns:os-extended-availability-zone="http://docs.openstack.org/compute/ext/extended_availability_zone/api/v3" xmlns:os-pci="http://docs.openstack.org/compute/ext/os-pci/api/v3" xmlns:os-extended-server-attributes="http://docs.openstack.org/compute/ext/extended_server_attributes/api/v3" xmlns:os-extended-status="http://docs.openstack.org/compute/ext/extended_status/api/v3" xmlns:os-disk-config="http://docs.openstack.org/compute/ext/disk_config/api/v3" xmlns:os-access-ips="http://docs.openstack.org/compute/ext/os-access-ips/api/v3" xmlns:os-extended-volumes="http://docs.openstack.org/compute/ext/extended_volumes/api/v3" xmlns:os-server-usage="http://docs.openstack.org/compute/ext/os-server-usage/api/v3" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:os-config-drive="http://docs.openstack.org/compute/ext/config_drive/api/v3" xmlns="http://docs.openstack.org/compute/api/v1.1">
<server status="ACTIVE" updated="2013-10-31T06:32:30Z" user_id="fake" name="new-server-test" created="2013-09-23T13:29:36Z" tenant_id="openstack" progress="0" host_id="6da2179515d81d177b0fb59fb11a1b70f7ca3b859bb6d8beb6331403" id="dbcc8944-8510-46bd-a017-ecacd6e6de5c" os-config-drive:config_drive="" os-server-usage:launched_at="2013-10-31 06:32:30.295031" os-server-usage:terminated_at="None" os-extended-status:vm_state="active" os-extended-status:locked_by="None" os-extended-status:power_state="1" os-extended-status:task_state="None" os-access-ips:access_ip_v4="" os-access-ips:access_ip_v6="" os-disk-config:disk_config="AUTO" os-extended-availability-zone:availability_zone="nova" os-extended-server-attributes:hypervisor_hostname="fake-mini" os-extended-server-attributes:instance_name="instance-00000001" os-extended-server-attributes:host="ac7b409b83234b25af19fc4d36793f8d" key_name="None">
<servers xmlns:os-extended-availability-zone="http://docs.openstack.org/compute/ext/extended_availability_zone/api/v3" xmlns:os-pci="http://docs.openstack.org/compute/ext/os-pci/api/v3" xmlns:os-extended-server-attributes="http://docs.openstack.org/compute/ext/extended_server_attributes/api/v3" xmlns:os-extended-status="http://docs.openstack.org/compute/ext/extended_status/api/v3" xmlns:os-access-ips="http://docs.openstack.org/compute/ext/os-access-ips/api/v3" xmlns:os-extended-volumes="http://docs.openstack.org/compute/ext/extended_volumes/api/v3" xmlns:os-server-usage="http://docs.openstack.org/compute/ext/os-server-usage/api/v3" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:os-config-drive="http://docs.openstack.org/compute/ext/config_drive/api/v3" xmlns="http://docs.openstack.org/compute/api/v1.1">
<server status="ACTIVE" updated="2013-10-31T06:32:30Z" user_id="fake" name="new-server-test" created="2013-09-23T13:29:36Z" tenant_id="openstack" progress="0" host_id="6da2179515d81d177b0fb59fb11a1b70f7ca3b859bb6d8beb6331403" id="dbcc8944-8510-46bd-a017-ecacd6e6de5c" os-config-drive:config_drive="" os-server-usage:launched_at="2013-10-31 06:32:30.295031" os-server-usage:terminated_at="None" os-extended-status:vm_state="active" os-extended-status:locked_by="None" os-extended-status:power_state="1" os-extended-status:task_state="None" os-access-ips:access_ip_v4="" os-access-ips:access_ip_v6="" os-extended-availability-zone:availability_zone="nova" os-extended-server-attributes:hypervisor_hostname="fake-mini" os-extended-server-attributes:instance_name="instance-00000001" os-extended-server-attributes:host="ac7b409b83234b25af19fc4d36793f8d" key_name="None">
<image id="70a599e0-31e7-49b7-b260-868f441e862b">
<atom:link href="http://glance.openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b" rel="bookmark"/>
</image>

View File

@@ -1,58 +0,0 @@
{
"servers": [
{
"addresses": {
"private": [
{
"addr": "192.168.0.3",
"mac_addr": "aa:bb:cc:dd:ee:ff",
"type": "fixed",
"version": 4
}
]
},
"created": "2013-10-15T02:10:25Z",
"flavor": {
"id": "1",
"links": [
{
"href": "http://openstack.example.com/flavors/1",
"rel": "bookmark"
}
]
},
"host_id": "6cf06d723b64cccf68dd9d40429588cd215879d518a2699b2b947c19",
"id": "e1f469a7-1d3c-44ad-ac17-312596b84e0c",
"image": {
"id": "70a599e0-31e7-49b7-b260-868f441e862b",
"links": [
{
"href": "http://glance.openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b",
"rel": "bookmark"
}
]
},
"key_name": null,
"links": [
{
"href": "http://openstack.example.com/v3/servers/e1f469a7-1d3c-44ad-ac17-312596b84e0c",
"rel": "self"
},
{
"href": "http://openstack.example.com/servers/e1f469a7-1d3c-44ad-ac17-312596b84e0c",
"rel": "bookmark"
}
],
"metadata": {
"My Server Name": "Apache1"
},
"name": "new-server-test",
"os-disk-config:disk_config": "AUTO",
"progress": 0,
"status": "ACTIVE",
"tenant_id": "openstack",
"updated": "2013-10-15T02:10:25Z",
"user_id": "fake"
}
]
}

View File

@@ -1,21 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<servers xmlns:os-disk-config="http://docs.openstack.org/compute/ext/disk_config/api/v3" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
<server status="ACTIVE" updated="2013-10-15T02:10:26Z" user_id="fake" name="new-server-test" created="2013-10-15T02:10:26Z" tenant_id="openstack" progress="0" host_id="91afc29a75a4060983952e3a85271fa9ae5748430d4688e81b2baf4d" id="b4bcbdb4-837c-4070-88df-3da18ffbf303" os-disk-config:disk_config="AUTO" key_name="None">
<image id="70a599e0-31e7-49b7-b260-868f441e862b">
<atom:link href="http://glance.openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b" rel="bookmark"/>
</image>
<flavor id="1">
<atom:link href="http://openstack.example.com/flavors/1" rel="bookmark"/>
</flavor>
<metadata>
<meta key="My Server Name">Apache1</meta>
</metadata>
<addresses>
<network id="private">
<ip version="4" type="fixed" addr="192.168.0.3" mac_addr="aa:bb:cc:dd:ee:ff"/>
</network>
</addresses>
<atom:link href="http://openstack.example.com/v3/servers/b4bcbdb4-837c-4070-88df-3da18ffbf303" rel="self"/>
<atom:link href="http://openstack.example.com/servers/b4bcbdb4-837c-4070-88df-3da18ffbf303" rel="bookmark"/>
</server>
</servers>

View File

@@ -1,6 +0,0 @@
{
"rebuild": {
"image_ref" : "http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b",
"os-disk-config:disk_config": "AUTO"
}
}

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<rebuild xmlns:os-disk-config="http://docs.openstack.org/compute/ext/disk_config/api/v1.1"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns="http://docs.openstack.org/compute/api/v1.1"
image_ref="http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b"
os-disk-config:disk_config="AUTO" />

View File

@@ -1,56 +0,0 @@
{
"server": {
"addresses": {
"private": [
{
"addr": "192.168.0.3",
"mac_addr": "aa:bb:cc:dd:ee:ff",
"type": "fixed",
"version": 4
}
]
},
"admin_password": "GfbpJWGgBZ8K",
"created": "2013-10-15T02:10:35Z",
"flavor": {
"id": "1",
"links": [
{
"href": "http://openstack.example.com/flavors/1",
"rel": "bookmark"
}
]
},
"host_id": "0052256b3afffc50ce0b1e6cdbee47df8398935d1e76fb8bb4a202c7",
"id": "4c69ad8c-5d0f-4fc8-83f8-c031b2769b0e",
"image": {
"id": "70a599e0-31e7-49b7-b260-868f441e862b",
"links": [
{
"href": "http://glance.openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b",
"rel": "bookmark"
}
]
},
"links": [
{
"href": "http://openstack.example.com/v3/servers/4c69ad8c-5d0f-4fc8-83f8-c031b2769b0e",
"rel": "self"
},
{
"href": "http://openstack.example.com/servers/4c69ad8c-5d0f-4fc8-83f8-c031b2769b0e",
"rel": "bookmark"
}
],
"metadata": {
"My Server Name": "Apache1"
},
"name": "new-server-test",
"os-disk-config:disk_config": "AUTO",
"progress": 0,
"status": "ACTIVE",
"tenant_id": "openstack",
"updated": "2013-10-15T02:10:35Z",
"user_id": "fake"
}
}

View File

@@ -1,19 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns:os-disk-config="http://docs.openstack.org/compute/ext/disk_config/api/v3" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="2013-10-15T02:10:27Z" user_id="fake" name="new-server-test" created="2013-10-15T02:10:27Z" tenant_id="openstack" progress="0" host_id="197205cc7340272607a9c5fa34f3520bbf53103399a6e80a06b67583" id="beb22987-dd7c-4791-8b7a-542c4f53cdd7" admin_password="whSjs3JXbb6p" os-disk-config:disk_config="AUTO">
<image id="70a599e0-31e7-49b7-b260-868f441e862b">
<atom:link href="http://glance.openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b" rel="bookmark"/>
</image>
<flavor id="1">
<atom:link href="http://openstack.example.com/flavors/1" rel="bookmark"/>
</flavor>
<metadata>
<meta key="My Server Name">Apache1</meta>
</metadata>
<addresses>
<network id="private">
<ip version="4" type="fixed" addr="192.168.0.3" mac_addr="aa:bb:cc:dd:ee:ff"/>
</network>
</addresses>
<atom:link href="http://openstack.example.com/v3/servers/beb22987-dd7c-4791-8b7a-542c4f53cdd7" rel="self"/>
<atom:link href="http://openstack.example.com/servers/beb22987-dd7c-4791-8b7a-542c4f53cdd7" rel="bookmark"/>
</server>

View File

@@ -1,56 +0,0 @@
{
"server": {
"addresses": {
"private": [
{
"addr": "192.168.0.3",
"mac_addr": "aa:bb:cc:dd:ee:ff",
"type": "fixed",
"version": 4
}
]
},
"created": "2013-10-15T02:10:34Z",
"flavor": {
"id": "1",
"links": [
{
"href": "http://openstack.example.com/flavors/1",
"rel": "bookmark"
}
]
},
"host_id": "060592f7d211654f26c403eeb86fe3a0ce60f29b4338b37f1c88b15e",
"id": "5b5e7d2e-720b-404e-81ae-4faa7aa43c6a",
"image": {
"id": "70a599e0-31e7-49b7-b260-868f441e862b",
"links": [
{
"href": "http://glance.openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b",
"rel": "bookmark"
}
]
},
"key_name": null,
"links": [
{
"href": "http://openstack.example.com/v3/servers/5b5e7d2e-720b-404e-81ae-4faa7aa43c6a",
"rel": "self"
},
{
"href": "http://openstack.example.com/servers/5b5e7d2e-720b-404e-81ae-4faa7aa43c6a",
"rel": "bookmark"
}
],
"metadata": {
"My Server Name": "Apache1"
},
"name": "new-server-test",
"os-disk-config:disk_config": "AUTO",
"progress": 0,
"status": "ACTIVE",
"tenant_id": "openstack",
"updated": "2013-10-15T02:10:34Z",
"user_id": "fake"
}
}

View File

@@ -1,19 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns:os-disk-config="http://docs.openstack.org/compute/ext/disk_config/api/v3" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="2013-10-15T02:10:26Z" user_id="fake" name="new-server-test" created="2013-10-15T02:10:26Z" tenant_id="openstack" progress="0" host_id="0f65e54d42dc6ab16e7a970df1c58d93ea8fa92636550f0d00af48f4" id="31c9e8eb-0527-4dfe-a631-52d487baa7be" os-disk-config:disk_config="AUTO" key_name="None">
<image id="70a599e0-31e7-49b7-b260-868f441e862b">
<atom:link href="http://glance.openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b" rel="bookmark"/>
</image>
<flavor id="1">
<atom:link href="http://openstack.example.com/flavors/1" rel="bookmark"/>
</flavor>
<metadata>
<meta key="My Server Name">Apache1</meta>
</metadata>
<addresses>
<network id="private">
<ip version="4" type="fixed" addr="192.168.0.3" mac_addr="aa:bb:cc:dd:ee:ff"/>
</network>
</addresses>
<atom:link href="http://openstack.example.com/v3/servers/31c9e8eb-0527-4dfe-a631-52d487baa7be" rel="self"/>
<atom:link href="http://openstack.example.com/servers/31c9e8eb-0527-4dfe-a631-52d487baa7be" rel="bookmark"/>
</server>

View File

@@ -1,10 +0,0 @@
{
"server" : {
"name" : "new-server-test",
"image_ref" : "http://glance.openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b",
"flavor_ref" : "http://openstack.example.com/flavors/1",
"metadata" : {
"My Server Name" : "Apache1"
}
}
}

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<server xmlns="http://docs.openstack.org/compute/api/v1.1" image_ref="http://glance.openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b" flavor_ref="http://openstack.example.com/flavors/1" name="new-server-test">
<metadata>
<meta key="My Server Name">Apache1</meta>
</metadata>
</server>

View File

@@ -1,17 +0,0 @@
{
"server": {
"admin_password": "S3uGgNnQRb4V",
"id": "e1f469a7-1d3c-44ad-ac17-312596b84e0c",
"links": [
{
"href": "http://openstack.example.com/v3/servers/e1f469a7-1d3c-44ad-ac17-312596b84e0c",
"rel": "self"
},
{
"href": "http://openstack.example.com/servers/e1f469a7-1d3c-44ad-ac17-312596b84e0c",
"rel": "bookmark"
}
],
"os-disk-config:disk_config": "AUTO"
}
}

View File

@@ -1,6 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns:os-disk-config="http://docs.openstack.org/compute/ext/disk_config/api/v3" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" id="31c9e8eb-0527-4dfe-a631-52d487baa7be" admin_password="Sjn7LYAiNLZH" os-disk-config:disk_config="AUTO">
<metadata/>
<atom:link href="http://openstack.example.com/v3/servers/31c9e8eb-0527-4dfe-a631-52d487baa7be" rel="self"/>
<atom:link href="http://openstack.example.com/servers/31c9e8eb-0527-4dfe-a631-52d487baa7be" rel="bookmark"/>
</server>

View File

@@ -1,6 +0,0 @@
{
"resize": {
"flavor_ref": "3",
"os-disk-config:disk_config": "AUTO"
}
}

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<resize xmlns:os-disk-config="http://docs.openstack.org/compute/ext/disk_config/api/v1.1"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns="http://docs.openstack.org/compute/api/v1.1"
os-disk-config:disk_config="AUTO"
flavor_ref="3" />

View File

@@ -1,5 +0,0 @@
{
"server": {
"os-disk-config:disk_config": "AUTO"
}
}

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<server xmlns:os-disk-config="http://docs.openstack.org/compute/ext/disk_config/api/v1.1"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns="http://docs.openstack.org/compute/api/v1.1"
os-disk-config:disk_config="AUTO" />

View File

@@ -1,55 +0,0 @@
{
"server": {
"addresses": {
"private": [
{
"addr": "192.168.0.3",
"mac_addr": "aa:bb:cc:dd:ee:ff",
"type": "fixed",
"version": 4
}
]
},
"created": "2013-10-15T02:10:28Z",
"flavor": {
"id": "1",
"links": [
{
"href": "http://openstack.example.com/flavors/1",
"rel": "bookmark"
}
]
},
"host_id": "1ccbc449599c02938647dcf0956213555a5e36e8c1dd0962763a89a3",
"id": "5deb985c-1409-42a9-995d-0a07c31f5459",
"image": {
"id": "70a599e0-31e7-49b7-b260-868f441e862b",
"links": [
{
"href": "http://glance.openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b",
"rel": "bookmark"
}
]
},
"links": [
{
"href": "http://openstack.example.com/v3/servers/5deb985c-1409-42a9-995d-0a07c31f5459",
"rel": "self"
},
{
"href": "http://openstack.example.com/servers/5deb985c-1409-42a9-995d-0a07c31f5459",
"rel": "bookmark"
}
],
"metadata": {
"My Server Name": "Apache1"
},
"name": "new-server-test",
"os-disk-config:disk_config": "AUTO",
"progress": 0,
"status": "ACTIVE",
"tenant_id": "openstack",
"updated": "2013-10-15T02:10:29Z",
"user_id": "fake"
}
}

View File

@@ -1,19 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns:os-disk-config="http://docs.openstack.org/compute/ext/disk_config/api/v3" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="2013-10-15T02:10:28Z" user_id="fake" name="new-server-test" created="2013-10-15T02:10:28Z" tenant_id="openstack" progress="0" host_id="44694455e4f8b2616f1b84eeb20234ff2d66220d7cfb595930a89ccb" id="3b094134-6907-4682-874c-5ecf44f4b6c5" os-disk-config:disk_config="AUTO">
<image id="70a599e0-31e7-49b7-b260-868f441e862b">
<atom:link href="http://glance.openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b" rel="bookmark"/>
</image>
<flavor id="1">
<atom:link href="http://openstack.example.com/flavors/1" rel="bookmark"/>
</flavor>
<metadata>
<meta key="My Server Name">Apache1</meta>
</metadata>
<addresses>
<network id="private">
<ip version="4" type="fixed" addr="192.168.0.3" mac_addr="aa:bb:cc:dd:ee:ff"/>
</network>
</addresses>
<atom:link href="http://openstack.example.com/v3/servers/3b094134-6907-4682-874c-5ecf44f4b6c5" rel="self"/>
<atom:link href="http://openstack.example.com/servers/3b094134-6907-4682-874c-5ecf44f4b6c5" rel="bookmark"/>
</server>

View File

@@ -83,7 +83,6 @@
"compute_extension:v3:os-deferred-delete": "",
"compute_extension:v3:os-deferred-delete:discoverable": "",
"compute_extension:disk_config": "",
"compute_extension:v3:os-disk-config": "",
"compute_extension:evacuate": "rule:admin_api",
"compute_extension:v3:os-evacuate": "rule:admin_api",
"compute_extension:v3:os-evacuate:discoverable": "",

View File

@@ -1,184 +0,0 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack Foundation
# Copyright 2013 IBM Corp.
#
# 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.
"""Disk Config extension."""
from webob import exc
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova.api.openstack import xmlutil
from nova.openstack.common.gettextutils import _
ALIAS = 'os-disk-config'
XMLNS_DCF = "http://docs.openstack.org/compute/ext/disk_config/api/v3"
API_DISK_CONFIG = "%s:disk_config" % ALIAS
INTERNAL_DISK_CONFIG = "auto_disk_config"
authorize = extensions.soft_extension_authorizer('compute',
'v3:' + ALIAS)
def disk_config_to_api(value):
return 'AUTO' if value else 'MANUAL'
def disk_config_from_api(value):
if value == 'AUTO':
return True
elif value == 'MANUAL':
return False
else:
msg = _("%s must be either 'MANUAL' or 'AUTO'.") % API_DISK_CONFIG
raise exc.HTTPBadRequest(explanation=msg)
class ServerDiskConfigTemplate(xmlutil.TemplateBuilder):
def construct(self):
root = xmlutil.TemplateElement('server')
root.set('{%s}disk_config' % XMLNS_DCF, API_DISK_CONFIG)
return xmlutil.SlaveTemplate(root, 1, nsmap={ALIAS: XMLNS_DCF})
class ServersDiskConfigTemplate(xmlutil.TemplateBuilder):
def construct(self):
root = xmlutil.TemplateElement('servers')
elem = xmlutil.SubTemplateElement(root, 'server', selector='servers')
elem.set('{%s}disk_config' % XMLNS_DCF, API_DISK_CONFIG)
return xmlutil.SlaveTemplate(root, 1, nsmap={ALIAS: XMLNS_DCF})
class ServerDiskConfigController(wsgi.Controller):
def _add_disk_config(self, req, servers):
for server in servers:
db_server = req.get_db_instance(server['id'])
# server['id'] is guaranteed to be in the cache due to
# the core API adding it in its 'show'/'detail' methods.
value = db_server.get(INTERNAL_DISK_CONFIG)
server[API_DISK_CONFIG] = disk_config_to_api(value)
def _show(self, req, resp_obj):
if 'server' in resp_obj.obj:
resp_obj.attach(xml=ServerDiskConfigTemplate())
server = resp_obj.obj['server']
self._add_disk_config(req, [server])
@wsgi.extends
def show(self, req, resp_obj, id):
context = req.environ['nova.context']
if authorize(context):
self._show(req, resp_obj)
@wsgi.extends
def detail(self, req, resp_obj):
context = req.environ['nova.context']
if 'servers' in resp_obj.obj and authorize(context):
resp_obj.attach(xml=ServersDiskConfigTemplate())
servers = resp_obj.obj['servers']
self._add_disk_config(req, servers)
def _set_disk_config(self, dict_):
if API_DISK_CONFIG in dict_:
api_value = dict_[API_DISK_CONFIG]
internal_value = disk_config_from_api(api_value)
dict_[INTERNAL_DISK_CONFIG] = internal_value
@wsgi.extends
def create(self, req, body):
context = req.environ['nova.context']
if authorize(context):
if 'server' in body:
self._set_disk_config(body['server'])
resp_obj = (yield)
self._show(req, resp_obj)
@wsgi.extends
def update(self, req, id, body):
context = req.environ['nova.context']
if authorize(context):
if 'server' in body:
self._set_disk_config(body['server'])
resp_obj = (yield)
self._show(req, resp_obj)
@wsgi.extends(action='rebuild')
def _action_rebuild(self, req, id, body):
context = req.environ['nova.context']
if authorize(context):
self._set_disk_config(body['rebuild'])
resp_obj = (yield)
self._show(req, resp_obj)
@wsgi.extends(action='resize')
def _action_resize(self, req, id, body):
context = req.environ['nova.context']
if authorize(context):
self._set_disk_config(body['resize'])
yield
class DiskConfig(extensions.V3APIExtensionBase):
"""Disk Management Extension."""
name = "DiskConfig"
alias = ALIAS
namespace = XMLNS_DCF
version = 1
def get_controller_extensions(self):
servers_extension = extensions.ControllerExtension(
self, 'servers', ServerDiskConfigController())
return [servers_extension]
def get_resources(self):
return []
def server_create(self, server_dict, create_kwargs):
create_kwargs['auto_disk_config'] = server_dict.get(
'auto_disk_config')
def server_xml_extract_server_deserialize(self, server_node, server_dict):
auto_disk_config =\
server_node.getAttribute('os-disk-config:disk_config')
if auto_disk_config:
server_dict['os-disk-config:disk_config'] = auto_disk_config
def server_rebuild(self, rebuild_dict, rebuild_kwargs):
if 'auto_disk_config' in rebuild_dict:
rebuild_kwargs['auto_disk_config'] = rebuild_dict[
'auto_disk_config']
def server_xml_extract_rebuild_deserialize(self, rebuild_node,
rebuild_dict):
if rebuild_node.hasAttribute("os-disk-config:disk_config"):
rebuild_dict['os-disk-config:disk_config'] =\
rebuild_node.getAttribute("os-disk-config:disk_config")
def server_resize(self, resize_dict, resize_kwargs):
if 'auto_disk_config' in resize_dict:
resize_kwargs['auto_disk_config'] = resize_dict[
'auto_disk_config']
def server_xml_extract_resize_deserialize(self, resize_node,
resize_dict):
if resize_node.hasAttribute("os-disk-config:disk_config"):
resize_dict['os-disk-config:disk_config'] =\
resize_node.getAttribute("os-disk-config:disk_config")
def server_update(self, update_dict, update_kwargs):
if 'auto_disk_config' in update_dict:
update_kwargs['auto_disk_config'] = update_dict['auto_disk_config']

View File

@@ -262,8 +262,6 @@ class ActionDeserializer(CommonDeserializer):
else:
raise AttributeError("No flavor_ref was specified in request")
if self.controller:
self.controller.server_resize_xml_deserialize(node, resize)
return resize
def _action_confirm_resize(self, node):
@@ -311,10 +309,6 @@ class ServersController(wsgi.Controller):
EXTENSION_DESERIALIZE_EXTRACT_REBUILD_NAMESPACE = (
'nova.api.v3.extensions.server.rebuild.deserialize')
EXTENSION_RESIZE_NAMESPACE = 'nova.api.v3.extensions.server.resize'
EXTENSION_DESERIALIZE_EXTRACT_RESIZE_NAMESPACE = (
'nova.api.v3.extensions.server.resize.deserialize')
EXTENSION_UPDATE_NAMESPACE = 'nova.api.v3.extensions.server.update'
_view_builder_class = views_servers.ViewBuilderV3
@@ -433,31 +427,6 @@ class ServersController(wsgi.Controller):
LOG.debug(_("Did not find any server rebuild xml deserializer"
" extensions"))
# Look for implementation of extension point of server resize
self.resize_extension_manager = \
stevedore.enabled.EnabledExtensionManager(
namespace=self.EXTENSION_RESIZE_NAMESPACE,
check_func=_check_load_extension('server_resize'),
invoke_on_load=True,
invoke_kwds={"extension_info": self.extension_info},
propagate_map_exceptions=True)
if not list(self.resize_extension_manager):
LOG.debug(_("Did not find any server resize extensions"))
# Look for implementation of extension point of server resize
# XML deserialization
self.resize_xml_deserialize_manager = \
stevedore.enabled.EnabledExtensionManager(
namespace=self.EXTENSION_DESERIALIZE_EXTRACT_RESIZE_NAMESPACE,
check_func=_check_load_extension(
'server_xml_extract_resize_deserialize'),
invoke_on_load=True,
invoke_kwds={"extension_info": self.extension_info},
propagate_map_exceptions=True)
if not list(self.resize_xml_deserialize_manager):
LOG.debug(_("Did not find any server resize xml deserializer"
" extensions"))
# Look for implementation of extension point of server update
self.update_extension_manager = \
stevedore.enabled.EnabledExtensionManager(
@@ -1098,10 +1067,6 @@ class ServersController(wsgi.Controller):
resize_kwargs = {}
if list(self.resize_extension_manager):
self.resize_extension_manager.map(self._resize_extension_point,
resize_dict, resize_kwargs)
return self._resize(req, id, flavor_ref, **resize_kwargs)
@wsgi.response(202)

View File

@@ -1,679 +0,0 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2011 OpenStack Foundation
# Copyright 2013 IBM Corp.
# 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.
import datetime
from oslo.config import cfg
from nova.api.openstack.compute import plugins
from nova.api.openstack.compute.plugins.v3 import servers
from nova.compute import api as compute_api
from nova.compute import flavors
from nova import db
from nova.openstack.common import jsonutils
import nova.openstack.common.rpc
from nova import test
from nova.tests.api.openstack import fakes
from nova.tests import fake_instance
import nova.tests.image.fake
CONF = cfg.CONF
MANUAL_INSTANCE_UUID = fakes.FAKE_UUID
AUTO_INSTANCE_UUID = fakes.FAKE_UUID.replace('a', 'b')
stub_instance = fakes.stub_instance
API_DISK_CONFIG = 'os-disk-config:disk_config'
def instance_addresses(context, instance_id):
return None
class DiskConfigTestCase(test.TestCase):
def setUp(self):
super(DiskConfigTestCase, self).setUp()
nova.tests.image.fake.stub_out_image_service(self.stubs)
fakes.stub_out_nw_api(self.stubs)
FAKE_INSTANCES = [
fakes.stub_instance(1,
uuid=MANUAL_INSTANCE_UUID,
auto_disk_config=False),
fakes.stub_instance(2,
uuid=AUTO_INSTANCE_UUID,
auto_disk_config=True)
]
def fake_instance_get(context, id_):
for instance in FAKE_INSTANCES:
if id_ == instance['id']:
return instance
self.stubs.Set(db, 'instance_get', fake_instance_get)
def fake_instance_get_by_uuid(context, uuid,
columns_to_join=None, use_slave=False):
for instance in FAKE_INSTANCES:
if uuid == instance['uuid']:
return instance
self.stubs.Set(db, 'instance_get_by_uuid',
fake_instance_get_by_uuid)
def fake_instance_get_all(context, *args, **kwargs):
return FAKE_INSTANCES
self.stubs.Set(db, 'instance_get_all', fake_instance_get_all)
self.stubs.Set(db, 'instance_get_all_by_filters',
fake_instance_get_all)
def fake_instance_create(context, inst_, session=None):
inst = fake_instance.fake_db_instance(**{
'id': 1,
'uuid': AUTO_INSTANCE_UUID,
'created_at': datetime.datetime(2010, 10, 10, 12, 0, 0),
'updated_at': datetime.datetime(2010, 10, 10, 12, 0, 0),
'progress': 0,
'name': 'instance-1', # this is a property
'task_state': '',
'vm_state': '',
'auto_disk_config': inst_['auto_disk_config'],
'security_groups': inst_['security_groups'],
})
def fake_instance_get_for_create(context, id_, *args, **kwargs):
return (inst, inst)
self.stubs.Set(db, 'instance_update_and_get_original',
fake_instance_get_for_create)
def fake_instance_get_all_for_create(context, *args, **kwargs):
return [inst]
self.stubs.Set(db, 'instance_get_all',
fake_instance_get_all_for_create)
self.stubs.Set(db, 'instance_get_all_by_filters',
fake_instance_get_all_for_create)
def fake_instance_add_security_group(context, instance_id,
security_group_id):
pass
self.stubs.Set(db,
'instance_add_security_group',
fake_instance_add_security_group)
return inst
self.stubs.Set(db, 'instance_create', fake_instance_create)
self.app = fakes.wsgi_app_v3(init_only=('servers',
'os-disk-config'))
CONF.set_override('extensions_blacklist', 'os-disk-config',
'osapi_v3')
self.no_disk_config_app = fakes.wsgi_app_v3(init_only=('servers'))
def tearDown(self):
super(DiskConfigTestCase, self).tearDown()
nova.tests.image.fake.FakeImageService_reset()
def assertDiskConfig(self, dict_, value):
self.assertIn(API_DISK_CONFIG, dict_)
self.assertEqual(dict_[API_DISK_CONFIG], value)
def test_show_server(self):
req = fakes.HTTPRequestV3.blank(
'/v3/servers/%s' % MANUAL_INSTANCE_UUID)
res = req.get_response(self.app)
server_dict = jsonutils.loads(res.body)['server']
self.assertDiskConfig(server_dict, 'MANUAL')
req = fakes.HTTPRequestV3.blank(
'/v3/servers/%s' % AUTO_INSTANCE_UUID)
res = req.get_response(self.app)
server_dict = jsonutils.loads(res.body)['server']
self.assertDiskConfig(server_dict, 'AUTO')
def test_detail_servers(self):
req = fakes.HTTPRequestV3.blank('/v3/servers/detail')
res = req.get_response(self.app)
server_dicts = jsonutils.loads(res.body)['servers']
expectations = ['MANUAL', 'AUTO']
for server_dict, expected in zip(server_dicts, expectations):
self.assertDiskConfig(server_dict, expected)
def test_create_server_override_auto_with_disk_config_enabled(self):
req = fakes.HTTPRequestV3.blank('/v3/servers')
req.method = 'POST'
req.content_type = 'application/json'
body = {
'server': {
'name': 'server_test',
'image_ref': 'cedef40a-ed67-4d10-800e-17455edce175',
'flavor_ref': '1',
API_DISK_CONFIG: 'AUTO'
},
}
old_create = compute_api.API.create
def create(*args, **kwargs):
self.assertIn('auto_disk_config', kwargs)
self.assertTrue(kwargs['auto_disk_config'])
return old_create(*args, **kwargs)
self.stubs.Set(compute_api.API, 'create', create)
req.body = jsonutils.dumps(body)
res = req.get_response(self.app)
server_dict = jsonutils.loads(res.body)['server']
self.assertDiskConfig(server_dict, 'AUTO')
def test_create_server_override_manual(self):
req = fakes.HTTPRequestV3.blank('/v3/servers')
req.method = 'POST'
req.content_type = 'application/json'
body = {'server': {
'name': 'server_test',
'image_ref': 'cedef40a-ed67-4d10-800e-17455edce175',
'flavor_ref': '1',
API_DISK_CONFIG: 'MANUAL'
},
}
req.body = jsonutils.dumps(body)
res = req.get_response(self.app)
server_dict = jsonutils.loads(res.body)['server']
self.assertDiskConfig(server_dict, 'MANUAL')
def test_create_server_detect_from_image(self):
"""If user doesn't pass in diskConfig for server, use image metadata
to specify AUTO or MANUAL.
"""
req = fakes.HTTPRequestV3.blank('/v3/servers')
req.method = 'POST'
req.content_type = 'application/json'
body = {'server': {
'name': 'server_test',
'image_ref': 'a440c04b-79fa-479c-bed1-0b816eaec379',
'flavor_ref': '1',
},
}
req.body = jsonutils.dumps(body)
res = req.get_response(self.app)
server_dict = jsonutils.loads(res.body)['server']
self.assertDiskConfig(server_dict, 'MANUAL')
req = fakes.HTTPRequestV3.blank('/v3/servers')
req.method = 'POST'
req.content_type = 'application/json'
body = {'server': {
'name': 'server_test',
'image_ref': '70a599e0-31e7-49b7-b260-868f441e862b',
'flavor_ref': '1',
},
}
req.body = jsonutils.dumps(body)
res = req.get_response(self.app)
server_dict = jsonutils.loads(res.body)['server']
self.assertDiskConfig(server_dict, 'AUTO')
def test_update_server_invalid_disk_config(self):
# Return BadRequest if user passes an invalid diskConfig value.
req = fakes.HTTPRequestV3.blank(
'/v3/servers/%s' % MANUAL_INSTANCE_UUID)
req.method = 'PUT'
req.content_type = 'application/json'
body = {'server': {API_DISK_CONFIG: 'server_test'}}
req.body = jsonutils.dumps(body)
res = req.get_response(self.app)
self.assertEqual(res.status_int, 400)
expected_msg = ('{"badRequest": {"message": "%s must be either'
' \'MANUAL\' or \'AUTO\'.", "code": 400}}' %
API_DISK_CONFIG)
self.assertEqual(res.body, expected_msg)
def test_rebuild_instance_with_disk_config(self):
info = dict(image_href_in_call=None)
def rebuild(self2, context, instance, image_href, *args, **kwargs):
self.assertIn('auto_disk_config', kwargs)
self.assertFalse(kwargs['auto_disk_config'])
info['image_href_in_call'] = image_href
self.stubs.Set(compute_api.API, 'rebuild', rebuild)
image_uuid = '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6'
image_href = 'http://localhost/v3/os-images/%s' % image_uuid
body = {
'rebuild': {
'image_ref': image_uuid,
'os-disk-config:disk_config': 'MANUAL',
},
}
req = fakes.HTTPRequestV3.blank(
'/v3/servers/%s/action' % AUTO_INSTANCE_UUID)
req.method = 'POST'
req.body = jsonutils.dumps(body)
req.headers["content-type"] = "application/json"
req.body = jsonutils.dumps(body)
res = req.get_response(self.app)
self.assertEqual(info['image_href_in_call'], image_uuid)
def test_resize_instance_with_disk_config(self):
self.resize_called = False
def resize_mock(*args, **kwargs):
self.assertIn('auto_disk_config', kwargs)
self.assertFalse(kwargs['auto_disk_config'])
self.resize_called = True
self.stubs.Set(compute_api.API, 'resize', resize_mock)
image_uuid = '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6'
image_href = 'http://localhost/v3/os-images/%s' % image_uuid
body = {
'resize': {
"flavor_ref": "2",
'os-disk-config:disk_config': 'MANUAL',
},
}
req = fakes.HTTPRequestV3.blank(
'/v3/servers/%s/action' % AUTO_INSTANCE_UUID)
req.method = 'POST'
req.body = jsonutils.dumps(body)
req.headers["content-type"] = "application/json"
req.body = jsonutils.dumps(body)
res = req.get_response(self.app)
def test_update_instance_with_disk_config_disabled(self):
self.update_called = False
def update(self2, update_dict):
self.assertNotIn('auto_disk_config', update_dict)
self.update_called = True
def cache_db_instance(*arg, **kwargs):
pass
def save(self2, context, expected_task_state=None):
pass
self.stubs.Set(nova.objects.instance.Instance, 'save',
save)
self.stubs.Set(nova.api.openstack.wsgi.Request,
"cache_db_instance", cache_db_instance)
self.stubs.Set(nova.objects.instance.Instance, 'update',
update)
image_uuid = '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6'
image_href = 'http://localhost/v3/os-images/%s' % image_uuid
body = {
'server': {
"name": "update_test",
'os-disk-config:disk_config': 'MANUAL',
},
}
req = fakes.HTTPRequestV3.blank(
'/v3/servers/%s' % AUTO_INSTANCE_UUID)
req.method = 'PUT'
req.body = jsonutils.dumps(body)
req.headers["content-type"] = "application/json"
req.body = jsonutils.dumps(body)
res = req.get_response(self.no_disk_config_app)
self.assertTrue(self.update_called)
def test_update_instance_with_disk_config(self):
self.update_called = False
def update(self2, update_dict):
self.assertIn('auto_disk_config', update_dict)
self.assertFalse(update_dict['auto_disk_config'])
self.update_called = True
def cache_db_instance(*arg, **kwargs):
pass
def save(self2, context, expected_task_state=None):
pass
self.stubs.Set(nova.objects.instance.Instance, 'save',
save)
self.stubs.Set(nova.api.openstack.wsgi.Request,
"cache_db_instance", cache_db_instance)
self.stubs.Set(nova.objects.instance.Instance, 'update',
update)
image_uuid = '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6'
image_href = 'http://localhost/v3/os-images/%s' % image_uuid
body = {
'server': {
"name": "update_test",
'os-disk-config:disk_config': 'MANUAL',
},
}
req = fakes.HTTPRequestV3.blank('/v3/servers/%s' % AUTO_INSTANCE_UUID)
req.method = 'PUT'
req.body = jsonutils.dumps(body)
req.headers["content-type"] = "application/json"
req.body = jsonutils.dumps(body)
res = req.get_response(self.app)
self.assertTrue(self.update_called)
class ServersControllerCreateTest(test.TestCase):
def setUp(self):
"""Shared implementation for tests below that create instance."""
super(ServersControllerCreateTest, self).setUp()
self.flags(verbose=True,
enable_instance_password=True)
self.instance_cache_num = 0
self.instance_cache_by_id = {}
self.instance_cache_by_uuid = {}
ext_info = plugins.LoadedExtensionInfo()
self.controller = servers.ServersController(extension_info=ext_info)
CONF.set_override('extensions_blacklist', 'os-disk-config',
'osapi_v3')
self.no_disk_config_controller = servers.ServersController(
extension_info=ext_info)
def instance_create(context, inst):
inst_type = flavors.get_flavor_by_flavor_id(3)
image_uuid = '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6'
def_image_ref = 'http://localhost/v3/os-images/%s' % image_uuid
self.instance_cache_num += 1
instance = {
'id': self.instance_cache_num,
'display_name': inst['display_name'] or 'test',
'uuid': MANUAL_INSTANCE_UUID,
'instance_type': dict(inst_type),
'access_ip_v4': '1.2.3.4',
'access_ip_v6': 'fead::1234',
'image_ref': inst.get('image_ref', def_image_ref),
'user_id': 'fake',
'project_id': 'fake',
'reservation_id': inst['reservation_id'],
"created_at": datetime.datetime(2010, 10, 10, 12, 0, 0),
"updated_at": datetime.datetime(2010, 11, 11, 11, 0, 0),
"user_data": None,
"progress": 0,
"fixed_ips": [],
"task_state": "",
"vm_state": "",
}
self.instance_cache_by_id[instance['id']] = instance
self.instance_cache_by_uuid[instance['uuid']] = instance
return instance
def instance_get(context, instance_id):
"""Stub for compute/api create() pulling in instance after
scheduling
"""
return self.instance_cache_by_id[instance_id]
def instance_update(context, uuid, values):
instance = self.instance_cache_by_uuid[uuid]
instance.update(values)
return instance
def fake_method(*args, **kwargs):
pass
def queue_get_for(context, *args):
return 'network_topic'
def return_security_group(context, instance_id, security_group_id):
pass
fakes.stub_out_rate_limiting(self.stubs)
fakes.stub_out_key_pair_funcs(self.stubs)
nova.tests.image.fake.stub_out_image_service(self.stubs)
fakes.stub_out_nw_api(self.stubs)
self.stubs.Set(db, 'instance_add_security_group',
return_security_group)
self.stubs.Set(db, 'instance_system_metadata_update',
fake_method)
self.stubs.Set(db, 'instance_get', instance_get)
self.stubs.Set(db, 'instance_update', instance_update)
self.stubs.Set(nova.openstack.common.rpc, 'cast', fake_method)
return_server = fakes.fake_instance_get()
return_servers = fakes.fake_instance_get_all_by_filters()
self.stubs.Set(db, 'instance_get_all_by_filters',
return_servers)
self.stubs.Set(db, 'instance_get_by_uuid',
return_server)
self.stubs.Set(db, 'instance_add_security_group',
return_security_group)
def test_create_server_override_auto_with_disk_config_disabled(self):
req = fakes.HTTPRequestV3.blank('/v3/servers')
req.method = 'POST'
req.content_type = 'application/json'
body = {
'server': {
'name': 'server_test',
'image_ref': 'cedef40a-ed67-4d10-800e-17455edce175',
'flavor_ref': '1',
'os-disk-config:disk_config': 'AUTO'
},
}
self.create_called = False
old_create = compute_api.API.create
def create(*args, **kwargs):
self.assertNotIn('os-disk-config:disk_config', kwargs)
self.assertNotIn('auto_disk_config', kwargs)
self.create_called = True
return old_create(*args, **kwargs)
self.stubs.Set(compute_api.API, 'create', create)
req.body = jsonutils.dumps(body)
res = self.no_disk_config_controller.create(
req,
body).obj['server']
self.assertTrue(self.create_called)
def test_rebuild_instance_with_disk_config_disabled(self):
info = dict(image_href_in_call=None)
def rebuild(self2, context, instance, image_href, *args, **kwargs):
self.assertNotIn('os-disk-config:disk_config', kwargs)
self.assertNotIn('auto_disk_config', kwargs)
info['image_href_in_call'] = image_href
self.stubs.Set(compute_api.API, 'rebuild', rebuild)
image_uuid = '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6'
body = {
'rebuild': {
'image_ref': image_uuid,
'os-disk-config:disk_config': 'MANUAL',
},
}
req = fakes.HTTPRequestV3.blank(
'/v3/servers/%s/action' % AUTO_INSTANCE_UUID)
req.method = 'POST'
req.body = jsonutils.dumps(body)
req.headers["content-type"] = "application/json"
req.body = jsonutils.dumps(body)
res = self.no_disk_config_controller._action_rebuild(
req,
AUTO_INSTANCE_UUID,
body).obj
self.assertEqual(info['image_href_in_call'], image_uuid)
def test_resize_instance_with_disk_config_disabled(self):
self.resize_called = False
def resize_mock(*args, **kwargs):
self.assertNotIn('os-disk-config:disk_config', kwargs)
self.assertNotIn('auto_disk_config', kwargs)
self.resize_called = True
self.stubs.Set(compute_api.API, 'resize', resize_mock)
image_uuid = '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6'
image_href = 'http://localhost/v3/os-images/%s' % image_uuid
body = {
'resize': {
"flavor_ref": "2",
'os-disk-config:disk_config': 'MANUAL',
},
}
req = fakes.HTTPRequestV3.blank(
'/v3/servers/%s/action' % AUTO_INSTANCE_UUID)
req.method = 'POST'
req.body = jsonutils.dumps(body)
req.headers["content-type"] = "application/json"
req.body = jsonutils.dumps(body)
self.no_disk_config_controller._action_resize(
req,
AUTO_INSTANCE_UUID,
body)
self.assertTrue(self.resize_called)
class TestServerCreateRequestXMLDeserializer(test.TestCase):
def setUp(self):
super(TestServerCreateRequestXMLDeserializer, self).setUp()
ext_info = plugins.LoadedExtensionInfo()
controller = servers.ServersController(extension_info=ext_info)
self.create_deserializer = servers.CreateDeserializer(controller)
self.deserializer = servers.ActionDeserializer(controller)
CONF.set_override('extensions_blacklist', 'os-disk-config',
'osapi_v3')
no_disk_config_controller = servers.ServersController(
extension_info=ext_info)
self.create_no_disk_config_deserializer =\
servers.CreateDeserializer(no_disk_config_controller)
self.no_disk_config_deserializer =\
servers.ActionDeserializer(no_disk_config_controller)
def test_create_request_with_disk_config(self):
serial_request = """
<server xmlns="http://docs.openstack.org/compute/api/v3"
xmlns:os-disk-config=
"http://docs.openstack.org/compute/ext/disk_config/api/v3"
name="disk_config_test"
image_ref="1"
flavor_ref="1"
os-disk-config:disk_config="AUTO"/>"""
request = self.create_deserializer.deserialize(serial_request)
expected = {
"server": {
"name": "disk_config_test",
"image_ref": "1",
"flavor_ref": "1",
"os-disk-config:disk_config": "AUTO",
},
}
self.assertEqual(request['body'], expected)
def test_create_request_with_disk_config_disabled(self):
serial_request = """
<server xmlns="http://docs.openstack.org/compute/api/v3"
xmlns:os-disk-config=
"http://docs.openstack.org/compute/ext/disk_config/api/v3"
name="disk_config_test"
image_ref="1"
flavor_ref="1"
os-disk-config:disk_config="AUTO"/>"""
request = self.create_no_disk_config_deserializer.\
deserialize(serial_request)
expected = {
"server": {
"name": "disk_config_test",
"image_ref": "1",
"flavor_ref": "1",
},
}
self.assertEqual(request['body'], expected)
def test_rebuild_request(self):
serial_request = """
<rebuild xmlns="http://docs.openstack.org/compute/api/v3"
xmlns:os-disk-config=
"http://docs.openstack.org/compute/ext/disk_config/api/v3"
os-disk-config:disk_config="MANUAL" image_ref="1"/>"""
request = self.deserializer.deserialize(serial_request)
expected = {
"rebuild": {
"image_ref": "1",
"os-disk-config:disk_config": "MANUAL",
},
}
self.assertEqual(request['body'], expected)
def test_rebuild_request_with_disk_config_disabled(self):
serial_request = """
<rebuild xmlns="http://docs.openstack.org/compute/api/v3"
xmlns:os-disk-config=
"http://docs.openstack.org/compute/ext/disk_config/api/v3"
os-disk-config:disk_config="MANUAL" image_ref="1"/>"""
request = self.no_disk_config_deserializer.deserialize(serial_request)
expected = {
"rebuild": {
"image_ref": "1",
},
}
self.assertEqual(request['body'], expected)
def test_resize_request(self):
serial_request = """
<resize xmlns="http://docs.openstack.org/compute/api/v3"
xmlns:os-disk-config=
"http://docs.openstack.org/compute/ext/disk_config/api/v3"
os-disk-config:disk_config="MANUAL" flavor_ref="1"/>"""
request = self.deserializer.deserialize(serial_request)
expected = {
"resize": {
"flavor_ref": "1",
"os-disk-config:disk_config": "MANUAL",
},
}
self.assertEqual(request['body'], expected)
def test_resize_request_with_disk_config_disabled(self):
serial_request = """
<resize xmlns="http://docs.openstack.org/compute/api/v3"
xmlns:os-disk-config=
"http://docs.openstack.org/compute/ext/disk_config/api/v3"
os-disk-config:disk_config="MANUAL" flavor_ref="1"/>"""
request = self.no_disk_config_deserializer.deserialize(serial_request)
expected = {
"resize": {
"flavor_ref": "1",
},
}
self.assertEqual(request['body'], expected)

View File

@@ -30,8 +30,8 @@ import webob
from nova.api.openstack import compute
from nova.api.openstack.compute import plugins
from nova.api.openstack.compute.plugins.v3 import access_ips
from nova.api.openstack.compute.plugins.v3 import availability_zone
from nova.api.openstack.compute.plugins.v3 import disk_config
from nova.api.openstack.compute.plugins.v3 import ips
from nova.api.openstack.compute.plugins.v3 import keypairs
from nova.api.openstack.compute.plugins.v3 import servers
@@ -4211,14 +4211,15 @@ class ServersAllExtensionsTestCase(test.TestCase):
an exception because of a malformed request before the core API
gets a chance to validate the request and return a 422 response.
For example, ServerDiskConfigController extends servers.Controller:
For example, AccessIPsController extends servers.Controller:
@wsgi.extends
def create(self, req, body):
if 'server' in body:
self._set_disk_config(body['server'])
resp_obj = (yield)
self._show(req, resp_obj)
@wsgi.extends
def create(self, req, resp_obj, body):
context = req.environ['nova.context']
if authorize(context) and 'server' in resp_obj.obj:
resp_obj.attach(xml=AccessIPTemplate())
server = resp_obj.obj['server']
self._extend_server(req, server)
we want to ensure that the extension isn't barfing on an invalid
body.
@@ -4333,10 +4334,10 @@ class TestServerRebuildXMLDeserializer(test.NoDBTestCase):
self.assertThat(request['body'], matchers.DictMatches(expected))
class FakeDiskConfigExt(extensions.V3APIExtensionBase):
name = "DiskConfig"
alias = 'os-disk-config'
namespace = "http://docs.openstack.org/compute/ext/disk_config/api/v3"
class FakeExt(extensions.V3APIExtensionBase):
name = "AccessIPs"
alias = 'os-access-ips'
namespace = "http://docs.openstack.org/compute/ext/os-access-ips/api/v3"
version = 1
def fake_extension_point(self, *args, **kwargs):
@@ -4352,23 +4353,20 @@ class FakeDiskConfigExt(extensions.V3APIExtensionBase):
class TestServersExtensionPoint(test.NoDBTestCase):
def setUp(self):
super(TestServersExtensionPoint, self).setUp()
CONF.set_override('extensions_whitelist', ['os-disk-config'],
CONF.set_override('extensions_whitelist', ['os-access-ips'],
'osapi_v3')
self.stubs.Set(disk_config, 'DiskConfig', FakeDiskConfigExt)
self.stubs.Set(access_ips, 'AccessIPs', FakeExt)
def _test_load_extension_point(self, name):
setattr(FakeDiskConfigExt, 'server_%s' % name,
FakeDiskConfigExt.fake_extension_point)
setattr(FakeExt, 'server_%s' % name,
FakeExt.fake_extension_point)
ext_info = plugins.LoadedExtensionInfo()
controller = servers.ServersController(extension_info=ext_info)
self.assertEqual(
'os-disk-config',
'os-access-ips',
list(getattr(controller,
'%s_extension_manager' % name))[0].obj.alias)
delattr(FakeDiskConfigExt, 'server_%s' % name)
def test_load_resize_extension_point(self):
self._test_load_extension_point('resize')
delattr(FakeExt, 'server_%s' % name)
def test_load_update_extension_point(self):
self._test_load_extension_point('update')
@@ -4377,27 +4375,24 @@ class TestServersExtensionPoint(test.NoDBTestCase):
self._test_load_extension_point('rebuild')
def test_load_create_extension_point(self):
self._test_load_extension_point('rebuild')
self._test_load_extension_point('create')
def _test_load_deserialize_extension_point(self, name):
extension_point_func = 'server_xml_extract_%s_deserialize' % name
if name == 'create':
extension_point_func = 'server_xml_extract_server_deserialize'
setattr(FakeDiskConfigExt, extension_point_func,
FakeDiskConfigExt.fake_extension_point)
setattr(FakeExt, extension_point_func,
FakeExt.fake_extension_point)
ext_info = plugins.LoadedExtensionInfo()
controller = servers.ServersController(extension_info=ext_info)
self.assertEqual(
'os-disk-config',
'os-access-ips',
list(getattr(controller,
'%s_xml_deserialize_manager' % name))[0].obj.alias)
delattr(FakeDiskConfigExt, extension_point_func)
delattr(FakeExt, extension_point_func)
def test_load_create_xml_deserialize_extension_point(self):
self._test_load_deserialize_extension_point('create')
def test_load_resize_xml_deserialize_extension_point(self):
self._test_load_deserialize_extension_point('resize')
def test_load_rebuild_xml_deserialize_extension_point(self):
self._test_load_deserialize_extension_point('rebuild')

View File

@@ -152,7 +152,6 @@ policy_data = """
"compute_extension:deferred_delete": "",
"compute_extension:v3:os-deferred-delete": "",
"compute_extension:disk_config": "",
"compute_extension:v3:os-disk-config": "",
"compute_extension:evacuate": "is_admin:True",
"compute_extension:v3:os-evacuate": "is_admin:True",
"compute_extension:extended_server_attributes": "",

View File

@@ -49,7 +49,6 @@
},
"name": "new-server-test",
"os-config-drive:config_drive": "",
"os-disk-config:disk_config": "AUTO",
"os-extended-availability-zone:availability_zone": "nova",
"os-extended-server-attributes:host": "%(compute_host)s",
"os-extended-server-attributes:hypervisor_hostname": "%(hypervisor_hostname)s",

View File

@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns:os-access-ips="http://docs.openstack.org/compute/ext/os-access-ips/api/v3" xmlns:os-extended-volumes="http://docs.openstack.org/compute/ext/extended_volumes/api/v3" xmlns:os-extended-availability-zone="http://docs.openstack.org/compute/ext/extended_availability_zone/api/v3" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:os-extended-status="http://docs.openstack.org/compute/ext/extended_status/api/v3" xmlns:os-config-drive="http://docs.openstack.org/compute/ext/config_drive/api/v3" xmlns:os-extended-server-attributes="http://docs.openstack.org/compute/ext/extended_server_attributes/api/v3" xmlns:os-pci="http://docs.openstack.org/compute/ext/os-pci/api/v3" xmlns:os-disk-config="http://docs.openstack.org/compute/ext/disk_config/api/v3" xmlns:os-server-usage="http://docs.openstack.org/compute/ext/os-server-usage/api/v3" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="%(timestamp)s" user_id="fake" name="new-server-test" created="%(timestamp)s" tenant_id="openstack" progress="0" host_id="%(hostid)s" id="%(id)s" os-config-drive:config_drive="" os-server-usage:launched_at="%(timestamp)s" os-server-usage:terminated_at="None" os-extended-status:vm_state="active" os-extended-status:locked_by="None" os-extended-status:power_state="1" os-extended-status:task_state="None" os-disk-config:disk_config="AUTO" os-extended-availability-zone:availability_zone="nova" os-extended-server-attributes:hypervisor_hostname="%(hypervisor_hostname)s" os-extended-server-attributes:instance_name="instance-00000001" os-extended-server-attributes:host="%(compute_host)s" key_name="None" os-access-ips:access_ip_v4="" os-access-ips:access_ip_v6="">
<server xmlns:os-access-ips="http://docs.openstack.org/compute/ext/os-access-ips/api/v3" xmlns:os-extended-volumes="http://docs.openstack.org/compute/ext/extended_volumes/api/v3" xmlns:os-extended-availability-zone="http://docs.openstack.org/compute/ext/extended_availability_zone/api/v3" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:os-extended-status="http://docs.openstack.org/compute/ext/extended_status/api/v3" xmlns:os-config-drive="http://docs.openstack.org/compute/ext/config_drive/api/v3" xmlns:os-extended-server-attributes="http://docs.openstack.org/compute/ext/extended_server_attributes/api/v3" xmlns:os-pci="http://docs.openstack.org/compute/ext/os-pci/api/v3" xmlns:os-server-usage="http://docs.openstack.org/compute/ext/os-server-usage/api/v3" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="%(timestamp)s" user_id="fake" name="new-server-test" created="%(timestamp)s" tenant_id="openstack" progress="0" host_id="%(hostid)s" id="%(id)s" os-config-drive:config_drive="" os-server-usage:launched_at="%(timestamp)s" os-server-usage:terminated_at="None" os-extended-status:vm_state="active" os-extended-status:locked_by="None" os-extended-status:power_state="1" os-extended-status:task_state="None" os-extended-availability-zone:availability_zone="nova" os-extended-server-attributes:hypervisor_hostname="%(hypervisor_hostname)s" os-extended-server-attributes:instance_name="instance-00000001" os-extended-server-attributes:host="%(compute_host)s" key_name="None" os-access-ips:access_ip_v4="" os-access-ips:access_ip_v6="">
<image id="%(uuid)s">
<atom:link href="%(glance_host)s/images/%(uuid)s" rel="bookmark"/>
</image>

View File

@@ -12,7 +12,6 @@
"rel": "bookmark"
}
],
"os-disk-config:disk_config": "AUTO",
"security_groups": [
{
"name": "default"

View File

@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns:os-access-ips="http://docs.openstack.org/compute/ext/os-access-ips/api/v3" xmlns:os-disk-config="http://docs.openstack.org/compute/ext/disk_config/api/v3" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" id="%(id)s" admin_password="%(password)s" os-disk-config:disk_config="AUTO" os-access-ips:access_ip_v4="" os-access-ips:access_ip_v6="">
<server xmlns:os-access-ips="http://docs.openstack.org/compute/ext/os-access-ips/api/v3" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" id="%(id)s" admin_password="%(password)s" os-access-ips:access_ip_v4="" os-access-ips:access_ip_v6="">
<metadata/>
<atom:link href="%(host)s/v3/servers/%(uuid)s" rel="self"/>
<atom:link href="%(host)s/servers/%(uuid)s" rel="bookmark"/>

View File

@@ -50,7 +50,6 @@
},
"name": "new-server-test",
"os-config-drive:config_drive": "",
"os-disk-config:disk_config": "AUTO",
"os-extended-availability-zone:availability_zone": "nova",
"os-extended-server-attributes:host": "%(compute_host)s",
"os-extended-server-attributes:hypervisor_hostname": "%(hypervisor_hostname)s",

View File

@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<servers xmlns:os-access-ips="http://docs.openstack.org/compute/ext/os-access-ips/api/v3" xmlns:os-extended-volumes="http://docs.openstack.org/compute/ext/extended_volumes/api/v3" xmlns:os-extended-availability-zone="http://docs.openstack.org/compute/ext/extended_availability_zone/api/v3" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:os-extended-status="http://docs.openstack.org/compute/ext/extended_status/api/v3" xmlns:os-config-drive="http://docs.openstack.org/compute/ext/config_drive/api/v3" xmlns:os-extended-server-attributes="http://docs.openstack.org/compute/ext/extended_server_attributes/api/v3" xmlns:os-pci="http://docs.openstack.org/compute/ext/os-pci/api/v3" xmlns:os-disk-config="http://docs.openstack.org/compute/ext/disk_config/api/v3" xmlns:os-server-usage="http://docs.openstack.org/compute/ext/os-server-usage/api/v3" xmlns="http://docs.openstack.org/compute/api/v1.1">
<server status="ACTIVE" updated="%(timestamp)s" user_id="fake" name="new-server-test" created="%(timestamp)s" tenant_id="openstack" progress="0" host_id="%(hostid)s" id="%(id)s" os-config-drive:config_drive="" os-server-usage:launched_at="%(timestamp)s" os-server-usage:terminated_at="None" os-extended-status:vm_state="active" os-extended-status:locked_by="None" os-extended-status:power_state="1" os-extended-status:task_state="None" os-disk-config:disk_config="AUTO" os-extended-availability-zone:availability_zone="nova" os-extended-server-attributes:hypervisor_hostname="%(hypervisor_hostname)s" os-extended-server-attributes:instance_name="instance-00000001" os-extended-server-attributes:host="%(compute_host)s" key_name="None" os-access-ips:access_ip_v4="" os-access-ips:access_ip_v6="">
<servers xmlns:os-access-ips="http://docs.openstack.org/compute/ext/os-access-ips/api/v3" xmlns:os-extended-volumes="http://docs.openstack.org/compute/ext/extended_volumes/api/v3" xmlns:os-extended-availability-zone="http://docs.openstack.org/compute/ext/extended_availability_zone/api/v3" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:os-extended-status="http://docs.openstack.org/compute/ext/extended_status/api/v3" xmlns:os-config-drive="http://docs.openstack.org/compute/ext/config_drive/api/v3" xmlns:os-extended-server-attributes="http://docs.openstack.org/compute/ext/extended_server_attributes/api/v3" xmlns:os-pci="http://docs.openstack.org/compute/ext/os-pci/api/v3" xmlns:os-server-usage="http://docs.openstack.org/compute/ext/os-server-usage/api/v3" xmlns="http://docs.openstack.org/compute/api/v1.1">
<server status="ACTIVE" updated="%(timestamp)s" user_id="fake" name="new-server-test" created="%(timestamp)s" tenant_id="openstack" progress="0" host_id="%(hostid)s" id="%(id)s" os-config-drive:config_drive="" os-server-usage:launched_at="%(timestamp)s" os-server-usage:terminated_at="None" os-extended-status:vm_state="active" os-extended-status:locked_by="None" os-extended-status:power_state="1" os-extended-status:task_state="None" os-extended-availability-zone:availability_zone="nova" os-extended-server-attributes:hypervisor_hostname="%(hypervisor_hostname)s" os-extended-server-attributes:instance_name="instance-00000001" os-extended-server-attributes:host="%(compute_host)s" key_name="None" os-access-ips:access_ip_v4="" os-access-ips:access_ip_v6="">
<image id="%(uuid)s">
<atom:link href="%(glance_host)s/images/%(uuid)s" rel="bookmark"/>
</image>

View File

@@ -1,58 +0,0 @@
{
"servers": [
{
"addresses": {
"private": [
{
"addr": "%(ip)s",
"mac_addr": "aa:bb:cc:dd:ee:ff",
"type": "fixed",
"version": 4
}
]
},
"created": "%(timestamp)s",
"flavor": {
"id": "1",
"links": [
{
"href": "%(host)s/flavors/1",
"rel": "bookmark"
}
]
},
"host_id": "%(hostid)s",
"id": "%(id)s",
"image": {
"id": "%(uuid)s",
"links": [
{
"href": "%(glance_host)s/images/%(uuid)s",
"rel": "bookmark"
}
]
},
"key_name": null,
"links": [
{
"href": "%(host)s/v3/servers/%(uuid)s",
"rel": "self"
},
{
"href": "%(host)s/servers/%(uuid)s",
"rel": "bookmark"
}
],
"metadata": {
"My Server Name": "Apache1"
},
"name": "new-server-test",
"os-disk-config:disk_config": "AUTO",
"progress": 0,
"status": "ACTIVE",
"tenant_id": "openstack",
"updated": "%(timestamp)s",
"user_id": "fake"
}
]
}

View File

@@ -1,21 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<servers xmlns:os-disk-config="http://docs.openstack.org/compute/ext/disk_config/api/v3" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
<server status="ACTIVE" updated="%(timestamp)s" user_id="fake" name="new-server-test" created="%(timestamp)s" tenant_id="openstack" progress="0" host_id="%(hostid)s" id="%(id)s" os-disk-config:disk_config="AUTO" key_name="None">
<image id="%(uuid)s">
<atom:link href="%(glance_host)s/images/%(uuid)s" rel="bookmark"/>
</image>
<flavor id="1">
<atom:link href="%(host)s/flavors/1" rel="bookmark"/>
</flavor>
<metadata>
<meta key="My Server Name">Apache1</meta>
</metadata>
<addresses>
<network id="private">
<ip version="4" type="fixed" addr="%(ip)s" mac_addr="aa:bb:cc:dd:ee:ff"/>
</network>
</addresses>
<atom:link href="%(host)s/v3/servers/%(uuid)s" rel="self"/>
<atom:link href="%(host)s/servers/%(uuid)s" rel="bookmark"/>
</server>
</servers>

View File

@@ -1,6 +0,0 @@
{
"rebuild": {
"image_ref" : "%(host)s/openstack/images/%(image_id)s",
"os-disk-config:disk_config": "AUTO"
}
}

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<rebuild xmlns:os-disk-config="http://docs.openstack.org/compute/ext/disk_config/api/v1.1"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns="http://docs.openstack.org/compute/api/v1.1"
image_ref="%(host)s/openstack/images/%(image_id)s"
os-disk-config:disk_config="AUTO" />

View File

@@ -1,56 +0,0 @@
{
"server": {
"addresses": {
"private": [
{
"addr": "%(ip)s",
"mac_addr": "aa:bb:cc:dd:ee:ff",
"type": "fixed",
"version": 4
}
]
},
"admin_password": "%(password)s",
"created": "%(timestamp)s",
"flavor": {
"id": "1",
"links": [
{
"href": "%(host)s/flavors/1",
"rel": "bookmark"
}
]
},
"host_id": "%(hostid)s",
"id": "%(id)s",
"image": {
"id": "%(uuid)s",
"links": [
{
"href": "%(glance_host)s/images/%(uuid)s",
"rel": "bookmark"
}
]
},
"links": [
{
"href": "%(host)s/v3/servers/%(uuid)s",
"rel": "self"
},
{
"href": "%(host)s/servers/%(uuid)s",
"rel": "bookmark"
}
],
"metadata": {
"My Server Name": "Apache1"
},
"name": "new-server-test",
"os-disk-config:disk_config": "AUTO",
"progress": 0,
"status": "ACTIVE",
"tenant_id": "openstack",
"updated": "%(timestamp)s",
"user_id": "fake"
}
}

View File

@@ -1,19 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns:os-disk-config="http://docs.openstack.org/compute/ext/disk_config/api/v3" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="%(timestamp)s" user_id="fake" name="new-server-test" created="%(timestamp)s" tenant_id="openstack" progress="0" host_id="%(hostid)s" id="%(id)s" admin_password="%(password)s" os-disk-config:disk_config="AUTO">
<image id="%(uuid)s">
<atom:link href="%(glance_host)s/images/%(uuid)s" rel="bookmark"/>
</image>
<flavor id="1">
<atom:link href="%(host)s/flavors/1" rel="bookmark"/>
</flavor>
<metadata>
<meta key="My Server Name">Apache1</meta>
</metadata>
<addresses>
<network id="private">
<ip version="4" type="fixed" addr="%(ip)s" mac_addr="aa:bb:cc:dd:ee:ff"/>
</network>
</addresses>
<atom:link href="%(host)s/v3/servers/%(uuid)s" rel="self"/>
<atom:link href="%(host)s/servers/%(uuid)s" rel="bookmark"/>
</server>

View File

@@ -1,56 +0,0 @@
{
"server": {
"addresses": {
"private": [
{
"addr": "%(ip)s",
"mac_addr": "aa:bb:cc:dd:ee:ff",
"type": "fixed",
"version": 4
}
]
},
"created": "%(timestamp)s",
"flavor": {
"id": "1",
"links": [
{
"href": "%(host)s/flavors/1",
"rel": "bookmark"
}
]
},
"host_id": "%(hostid)s",
"id": "%(id)s",
"image": {
"id": "%(uuid)s",
"links": [
{
"href": "%(glance_host)s/images/%(uuid)s",
"rel": "bookmark"
}
]
},
"key_name": null,
"links": [
{
"href": "%(host)s/v3/servers/%(uuid)s",
"rel": "self"
},
{
"href": "%(host)s/servers/%(uuid)s",
"rel": "bookmark"
}
],
"metadata": {
"My Server Name": "Apache1"
},
"name": "new-server-test",
"os-disk-config:disk_config": "AUTO",
"progress": 0,
"status": "ACTIVE",
"tenant_id": "openstack",
"updated": "%(timestamp)s",
"user_id": "fake"
}
}

View File

@@ -1,19 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns:os-disk-config="http://docs.openstack.org/compute/ext/disk_config/api/v3" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="%(timestamp)s" user_id="fake" name="new-server-test" created="%(timestamp)s" tenant_id="openstack" progress="0" host_id="%(hostid)s" id="%(id)s" key_name="None" os-disk-config:disk_config="AUTO">
<image id="%(uuid)s">
<atom:link href="%(glance_host)s/images/%(uuid)s" rel="bookmark"/>
</image>
<flavor id="1">
<atom:link href="%(host)s/flavors/1" rel="bookmark"/>
</flavor>
<metadata>
<meta key="My Server Name">Apache1</meta>
</metadata>
<addresses>
<network id="private">
<ip version="4" type="fixed" addr="%(ip)s" mac_addr="aa:bb:cc:dd:ee:ff"/>
</network>
</addresses>
<atom:link href="%(host)s/v3/servers/%(uuid)s" rel="self"/>
<atom:link href="%(host)s/servers/%(uuid)s" rel="bookmark"/>
</server>

View File

@@ -1,10 +0,0 @@
{
"server" : {
"name" : "new-server-test",
"image_ref" : "%(glance_host)s/images/%(image_id)s",
"flavor_ref" : "%(host)s/flavors/1",
"metadata" : {
"My Server Name" : "Apache1"
}
}
}

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<server xmlns="http://docs.openstack.org/compute/api/v1.1" xmlns:os-disk-config="http://docs.openstack.org/compute/ext/disk_config/api/v1.1" image_ref="%(glance_host)s/images/%(image_id)s" flavor_ref="%(host)s/flavors/1" name="new-server-test" os-disk-config:disk_config="AUTO">
<metadata>
<meta key="My Server Name">Apache1</meta>
</metadata>
</server>

View File

@@ -1,17 +0,0 @@
{
"server": {
"admin_password": "%(password)s",
"id": "%(id)s",
"os-disk-config:disk_config": "AUTO",
"links": [
{
"href": "http://openstack.example.com/v3/servers/%(uuid)s",
"rel": "self"
},
{
"href": "http://openstack.example.com/servers/%(uuid)s",
"rel": "bookmark"
}
]
}
}

View File

@@ -1,6 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns:os-disk-config="http://docs.openstack.org/compute/ext/disk_config/api/v3" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" id="%(id)s" admin_password="%(password)s" os-disk-config:disk_config="AUTO">
<metadata/>
<atom:link href="%(host)s/v3/servers/%(uuid)s" rel="self"/>
<atom:link href="%(host)s/servers/%(uuid)s" rel="bookmark"/>
</server>

View File

@@ -1,6 +0,0 @@
{
"resize": {
"flavor_ref": "3",
"os-disk-config:disk_config": "AUTO"
}
}

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<resize xmlns:os-disk-config="http://docs.openstack.org/compute/ext/disk_config/api/v1.1"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns="http://docs.openstack.org/compute/api/v1.1"
os-disk-config:disk_config="AUTO"
flavor_ref="3" />

View File

@@ -1,5 +0,0 @@
{
"server": {
"os-disk-config:disk_config": "AUTO"
}
}

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<server xmlns:os-disk-config="http://docs.openstack.org/compute/ext/disk_config/api/v1.1"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns="http://docs.openstack.org/compute/api/v1.1"
os-disk-config:disk_config="AUTO" />

View File

@@ -1,55 +0,0 @@
{
"server": {
"addresses": {
"private": [
{
"addr": "%(ip)s",
"mac_addr": "aa:bb:cc:dd:ee:ff",
"type": "fixed",
"version": 4
}
]
},
"created": "%(timestamp)s",
"flavor": {
"id": "1",
"links": [
{
"href": "%(host)s/flavors/1",
"rel": "bookmark"
}
]
},
"host_id": "%(hostid)s",
"id": "%(id)s",
"image": {
"id": "%(uuid)s",
"links": [
{
"href": "%(glance_host)s/images/%(uuid)s",
"rel": "bookmark"
}
]
},
"links": [
{
"href": "%(host)s/v3/servers/%(uuid)s",
"rel": "self"
},
{
"href": "%(host)s/servers/%(uuid)s",
"rel": "bookmark"
}
],
"metadata": {
"My Server Name": "Apache1"
},
"name": "new-server-test",
"os-disk-config:disk_config": "AUTO",
"progress": 0,
"status": "ACTIVE",
"tenant_id": "openstack",
"updated": "%(timestamp)s",
"user_id": "fake"
}
}

View File

@@ -1,19 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns:os-disk-config="http://docs.openstack.org/compute/ext/disk_config/api/v3" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="%(timestamp)s" user_id="fake" name="new-server-test" created="%(timestamp)s" tenant_id="openstack" progress="0" host_id="%(hostid)s" id="%(id)s" os-disk-config:disk_config="AUTO">
<image id="%(uuid)s">
<atom:link href="%(glance_host)s/images/%(uuid)s" rel="bookmark"/>
</image>
<flavor id="1">
<atom:link href="%(host)s/flavors/1" rel="bookmark"/>
</flavor>
<metadata>
<meta key="My Server Name">Apache1</meta>
</metadata>
<addresses>
<network id="private">
<ip version="4" type="fixed" addr="%(ip)s" mac_addr="aa:bb:cc:dd:ee:ff"/>
</network>
</addresses>
<atom:link href="%(host)s/v3/servers/%(uuid)s" rel="self"/>
<atom:link href="%(host)s/servers/%(uuid)s" rel="bookmark"/>
</server>

View File

@@ -1,72 +0,0 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# 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 nova.tests.image import fake
from nova.tests.integrated.v3 import test_servers
class DiskConfigJsonTest(test_servers.ServersSampleBase):
extension_name = "os-disk-config"
def test_list_servers_detail(self):
uuid = self._post_server()
response = self._do_get('servers/detail')
subs = self._get_regexes()
subs['hostid'] = '[a-f0-9]+'
subs['id'] = uuid
self._verify_response('list-servers-detail-get', subs, response, 200)
def test_get_server(self):
uuid = self._post_server()
response = self._do_get('servers/%s' % uuid)
subs = self._get_regexes()
subs['hostid'] = '[a-f0-9]+'
self._verify_response('server-get-resp', subs, response, 200)
def test_update_server(self):
uuid = self._post_server()
response = self._do_put('servers/%s' % uuid,
'server-update-put-req', {})
subs = self._get_regexes()
subs['hostid'] = '[a-f0-9]+'
self._verify_response('server-update-put-resp', subs, response, 200)
def test_resize_server(self):
self.flags(allow_resize_to_same_host=True)
uuid = self._post_server()
response = self._do_post('servers/%s/action' % uuid,
'server-resize-post-req', {})
self.assertEqual(response.status, 202)
# NOTE(tmello): Resize does not return response body
# Bug #1085213.
self.assertEqual(response.read(), "")
def test_rebuild_server(self):
uuid = self._post_server()
subs = {
'image_id': fake.get_valid_image_id(),
'host': self._get_host(),
}
response = self._do_post('servers/%s/action' % uuid,
'server-action-rebuild-req', subs)
subs = self._get_regexes()
subs['hostid'] = '[a-f0-9]+'
self._verify_response('server-action-rebuild-resp',
subs, response, 202)
class DiskConfigXmlTest(DiskConfigJsonTest):
ctype = 'xml'

View File

@@ -70,7 +70,6 @@ nova.api.v3.extensions =
console_output = nova.api.openstack.compute.plugins.v3.console_output:ConsoleOutput
consoles = nova.api.openstack.compute.plugins.v3.consoles:Consoles
deferred_delete = nova.api.openstack.compute.plugins.v3.deferred_delete:DeferredDelete
disk_config = nova.api.openstack.compute.plugins.v3.disk_config:DiskConfig
evacuate = nova.api.openstack.compute.plugins.v3.evacuate:Evacuate
extended_availability_zone = nova.api.openstack.compute.plugins.v3.extended_availability_zone:ExtendedAvailabilityZone
extended_server_attributes = nova.api.openstack.compute.plugins.v3.extended_server_attributes:ExtendedServerAttributes
@@ -115,7 +114,6 @@ nova.api.v3.extensions.server.create =
availability_zone = nova.api.openstack.compute.plugins.v3.availability_zone:AvailabilityZone
block_device_mapping = nova.api.openstack.compute.plugins.v3.block_device_mapping:BlockDeviceMapping
config_drive = nova.api.openstack.compute.plugins.v3.config_drive:ConfigDrive
disk_config = nova.api.openstack.compute.plugins.v3.disk_config:DiskConfig
keypairs_create = nova.api.openstack.compute.plugins.v3.keypairs:Keypairs
multiple_create = nova.api.openstack.compute.plugins.v3.multiple_create:MultipleCreate
scheduler_hints = nova.api.openstack.compute.plugins.v3.scheduler_hints:SchedulerHints
@@ -127,7 +125,6 @@ nova.api.v3.extensions.server.create.deserialize =
availability_zone = nova.api.openstack.compute.plugins.v3.availability_zone:AvailabilityZone
block_device_mapping = nova.api.openstack.compute.plugins.v3.block_device_mapping:BlockDeviceMapping
config_drive = nova.api.openstack.compute.plugins.v3.config_drive:ConfigDrive
disk_config = nova.api.openstack.compute.plugins.v3.disk_config:DiskConfig
multiple_create = nova.api.openstack.compute.plugins.v3.multiple_create:MultipleCreate
scheduler_hints = nova.api.openstack.compute.plugins.v3.scheduler_hints:SchedulerHints
security_groups = nova.api.openstack.compute.plugins.v3.security_groups:SecurityGroups
@@ -135,21 +132,12 @@ nova.api.v3.extensions.server.create.deserialize =
nova.api.v3.extensions.server.rebuild =
access_ips = nova.api.openstack.compute.plugins.v3.access_ips:AccessIPs
disk_config = nova.api.openstack.compute.plugins.v3.disk_config:DiskConfig
nova.api.v3.extensions.server.rebuild.deserialize =
access_ips = nova.api.openstack.compute.plugins.v3.access_ips:AccessIPs
disk_config = nova.api.openstack.compute.plugins.v3.disk_config:DiskConfig
nova.api.v3.extensions.server.resize =
disk_config = nova.api.openstack.compute.plugins.v3.disk_config:DiskConfig
nova.api.v3.extensions.server.resize.deserialize =
disk_config = nova.api.openstack.compute.plugins.v3.disk_config:DiskConfig
nova.api.v3.extensions.server.update =
access_ips = nova.api.openstack.compute.plugins.v3.access_ips:AccessIPs
disk_config = nova.api.openstack.compute.plugins.v3.disk_config:DiskConfig
[build_sphinx]
all_files = 1