Merge "Extends V3 servers api for pci support"
This commit is contained in:
commit
457d3b799d
@ -59,6 +59,11 @@
|
||||
"os-extended-status:task_state": null,
|
||||
"os-extended-status:vm_state": "active",
|
||||
"os-extended-volumes:volumes_attached": [],
|
||||
"os-pci:pci_devices": [
|
||||
{
|
||||
"id": 1
|
||||
}
|
||||
],
|
||||
"os-server-usage:launched_at": "2013-09-23T13:37:00.880302",
|
||||
"os-server-usage:terminated_at": null,
|
||||
"progress": 0,
|
||||
@ -69,7 +74,7 @@
|
||||
],
|
||||
"status": "ACTIVE",
|
||||
"tenant_id": "openstack",
|
||||
"updated": "2013-09-23T13:37:00Z",
|
||||
"updated": "2013-10-31T07:31:30Z",
|
||||
"user_id": "fake"
|
||||
}
|
||||
}
|
||||
|
@ -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:os-extended-status="http://docs.openstack.org/compute/ext/extended_status/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:os-extended-server-attributes="http://docs.openstack.org/compute/ext/extended_server_attributes/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="2013-09-23T13:25:51Z" 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-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" os-access-ips:access_ip_v4="" os-access-ips:access_ip_v6="">
|
||||
<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">
|
||||
<image id="70a599e0-31e7-49b7-b260-868f441e862b">
|
||||
<atom:link href="http://glance.openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b" rel="bookmark"/>
|
||||
</image>
|
||||
@ -16,6 +16,9 @@
|
||||
</addresses>
|
||||
<atom:link href="http://openstack.example.com/v3/servers/97918d76-884c-4629-8500-4cc147194463" rel="self"/>
|
||||
<atom:link href="http://openstack.example.com/servers/97918d76-884c-4629-8500-4cc147194463" rel="bookmark"/>
|
||||
<os-pci:pci_devices xmlns:os-pci="os-pci">
|
||||
<os-pci:pci_device id="1"/>
|
||||
</os-pci:pci_devices>
|
||||
<security_groups>
|
||||
<security_group name="default"/>
|
||||
</security_groups>
|
||||
|
@ -60,6 +60,11 @@
|
||||
"os-extended-status:task_state": null,
|
||||
"os-extended-status:vm_state": "active",
|
||||
"os-extended-volumes:volumes_attached": [],
|
||||
"os-pci:pci_devices": [
|
||||
{
|
||||
"id": 1
|
||||
}
|
||||
],
|
||||
"os-server-usage:launched_at": "2013-09-23T13:53:12.774549",
|
||||
"os-server-usage:terminated_at": null,
|
||||
"progress": 0,
|
||||
@ -70,7 +75,7 @@
|
||||
],
|
||||
"status": "ACTIVE",
|
||||
"tenant_id": "openstack",
|
||||
"updated": "2013-09-23T13:53:12Z",
|
||||
"updated": "2013-10-31T06:32:32Z",
|
||||
"user_id": "fake"
|
||||
}
|
||||
]
|
||||
|
@ -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:os-extended-status="http://docs.openstack.org/compute/ext/extended_status/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:os-extended-server-attributes="http://docs.openstack.org/compute/ext/extended_server_attributes/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="2013-09-23T13:29:37Z" 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-09-23 13:29:37.150043" 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="fake-mini" os-extended-server-attributes:instance_name="instance-00000001" os-extended-server-attributes:host="ac7b409b83234b25af19fc4d36793f8d" key_name="None" os-access-ips:access_ip_v4="" os-access-ips:access_ip_v6="">
|
||||
<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">
|
||||
<image id="70a599e0-31e7-49b7-b260-868f441e862b">
|
||||
<atom:link href="http://glance.openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b" rel="bookmark"/>
|
||||
</image>
|
||||
@ -17,6 +17,9 @@
|
||||
</addresses>
|
||||
<atom:link href="http://openstack.example.com/v3/servers/dbcc8944-8510-46bd-a017-ecacd6e6de5c" rel="self"/>
|
||||
<atom:link href="http://openstack.example.com/servers/dbcc8944-8510-46bd-a017-ecacd6e6de5c" rel="bookmark"/>
|
||||
<os-pci:pci_devices xmlns:os-pci="os-pci">
|
||||
<os-pci:pci_device id="1"/>
|
||||
</os-pci:pci_devices>
|
||||
<security_groups>
|
||||
<security_group name="default"/>
|
||||
</security_groups>
|
||||
|
60
doc/v3/api_samples/os-pci/server-get-resp.json
Normal file
60
doc/v3/api_samples/os-pci/server-get-resp.json
Normal file
@ -0,0 +1,60 @@
|
||||
{
|
||||
"server": {
|
||||
"addresses": {
|
||||
"private": [
|
||||
{
|
||||
"addr": "192.168.0.3",
|
||||
"mac_addr": "aa:bb:cc:dd:ee:ff",
|
||||
"type": "fixed",
|
||||
"version": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
"created": "2013-11-25T03:45:54Z",
|
||||
"flavor": {
|
||||
"id": "1",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/flavors/1",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
},
|
||||
"host_id": "b7e88944272df30c113572778bcf5527f02e9c2a745221214536c1a2",
|
||||
"id": "9dafa6bc-7a9f-45b2-8177-11800ceb7224",
|
||||
"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/9dafa6bc-7a9f-45b2-8177-11800ceb7224",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://openstack.example.com/servers/9dafa6bc-7a9f-45b2-8177-11800ceb7224",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"My Server Name": "Apache1"
|
||||
},
|
||||
"name": "new-server-test",
|
||||
"os-pci:pci_devices": [
|
||||
{
|
||||
"id": 1
|
||||
}
|
||||
],
|
||||
"progress": 0,
|
||||
"status": "ACTIVE",
|
||||
"tenant_id": "openstack",
|
||||
"updated": "2013-11-25T03:45:54Z",
|
||||
"user_id": "fake"
|
||||
}
|
||||
}
|
22
doc/v3/api_samples/os-pci/server-get-resp.xml
Normal file
22
doc/v3/api_samples/os-pci/server-get-resp.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<server xmlns:os-pci="http://docs.openstack.org/compute/ext/os-pci/api/v3" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="2013-11-26T08:21:55Z" user_id="fake" name="new-server-test" created="2013-11-26T08:21:55Z" tenant_id="openstack" progress="0" host_id="b9ab24ad7baab83d01a77509f6ab4e8d7437e7c3927e27f43a952e25" id="01216aae-950e-4344-9c11-ef1f82a2740e" 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/01216aae-950e-4344-9c11-ef1f82a2740e" rel="self"/>
|
||||
<atom:link href="http://openstack.example.com/servers/01216aae-950e-4344-9c11-ef1f82a2740e" rel="bookmark"/>
|
||||
<os-pci:pci_devices xmlns:os-pci="os-pci">
|
||||
<os-pci:pci_device id="1"/>
|
||||
</os-pci:pci_devices>
|
||||
</server>
|
16
doc/v3/api_samples/os-pci/server-post-req.json
Normal file
16
doc/v3/api_samples/os-pci/server-post-req.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"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"
|
||||
},
|
||||
"personality" : [
|
||||
{
|
||||
"path" : "/etc/banner.txt",
|
||||
"contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
19
doc/v3/api_samples/os-pci/server-post-req.xml
Normal file
19
doc/v3/api_samples/os-pci/server-post-req.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?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>
|
||||
<personality>
|
||||
<file path="/etc/banner.txt">
|
||||
ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBp
|
||||
dCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5k
|
||||
IGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVs
|
||||
c2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4g
|
||||
QnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRo
|
||||
ZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlv
|
||||
dSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vy
|
||||
c2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6
|
||||
b25zLiINCg0KLVJpY2hhcmQgQmFjaA==
|
||||
</file>
|
||||
</personality>
|
||||
</server>
|
16
doc/v3/api_samples/os-pci/server-post-resp.json
Normal file
16
doc/v3/api_samples/os-pci/server-post-resp.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"server": {
|
||||
"admin_password": "8C5KEgw2cQxu",
|
||||
"id": "fb947804-6a43-499d-9526-3eac8adf7271",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/v3/servers/fb947804-6a43-499d-9526-3eac8adf7271",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://openstack.example.com/servers/fb947804-6a43-499d-9526-3eac8adf7271",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
6
doc/v3/api_samples/os-pci/server-post-resp.xml
Normal file
6
doc/v3/api_samples/os-pci/server-post-resp.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<server xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" id="3c9b5929-8fb0-4d90-8453-bfe86117ef7e" admin_password="BxU9bpYSF3RL">
|
||||
<metadata/>
|
||||
<atom:link href="http://openstack.example.com/v3/servers/3c9b5929-8fb0-4d90-8453-bfe86117ef7e" rel="self"/>
|
||||
<atom:link href="http://openstack.example.com/servers/3c9b5929-8fb0-4d90-8453-bfe86117ef7e" rel="bookmark"/>
|
||||
</server>
|
62
doc/v3/api_samples/os-pci/servers-detail-resp.json
Normal file
62
doc/v3/api_samples/os-pci/servers-detail-resp.json
Normal file
@ -0,0 +1,62 @@
|
||||
{
|
||||
"servers": [
|
||||
{
|
||||
"addresses": {
|
||||
"private": [
|
||||
{
|
||||
"addr": "192.168.0.3",
|
||||
"mac_addr": "aa:bb:cc:dd:ee:ff",
|
||||
"type": "fixed",
|
||||
"version": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
"created": "2013-11-25T03:45:54Z",
|
||||
"flavor": {
|
||||
"id": "1",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/flavors/1",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
},
|
||||
"host_id": "416f83c758ea0f9271018b278a9dcedb91b1190deaa598704b87219b",
|
||||
"id": "ef440f98-04e8-46ea-ae74-e24d437040ea",
|
||||
"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/ef440f98-04e8-46ea-ae74-e24d437040ea",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://openstack.example.com/servers/ef440f98-04e8-46ea-ae74-e24d437040ea",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"My Server Name": "Apache1"
|
||||
},
|
||||
"name": "new-server-test",
|
||||
"os-pci:pci_devices": [
|
||||
{
|
||||
"id": 1
|
||||
}
|
||||
],
|
||||
"progress": 0,
|
||||
"status": "ACTIVE",
|
||||
"tenant_id": "openstack",
|
||||
"updated": "2013-11-25T03:45:54Z",
|
||||
"user_id": "fake"
|
||||
}
|
||||
]
|
||||
}
|
24
doc/v3/api_samples/os-pci/servers-detail-resp.xml
Normal file
24
doc/v3/api_samples/os-pci/servers-detail-resp.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<servers xmlns:os-pci="http://docs.openstack.org/compute/ext/os-pci/api/v3" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
|
||||
<server status="ACTIVE" updated="2013-11-26T08:34:20Z" user_id="fake" name="new-server-test" created="2013-11-26T08:34:19Z" tenant_id="openstack" progress="0" host_id="80bdb19a508d377edcd9cc0c86a3559294bb24375bffc54068054261" id="09f64ffb-6bfa-4749-9ebc-308548e231a3" 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/09f64ffb-6bfa-4749-9ebc-308548e231a3" rel="self"/>
|
||||
<atom:link href="http://openstack.example.com/servers/09f64ffb-6bfa-4749-9ebc-308548e231a3" rel="bookmark"/>
|
||||
<os-pci:pci_devices xmlns:os-pci="os-pci">
|
||||
<os-pci:pci_device id="1"/>
|
||||
</os-pci:pci_devices>
|
||||
</server>
|
||||
</servers>
|
@ -178,6 +178,8 @@
|
||||
"compute_extension:networks": "rule:admin_api",
|
||||
"compute_extension:networks:view": "",
|
||||
"compute_extension:networks_associate": "rule:admin_api",
|
||||
"compute_extension:v3:os-pci:pci_servers": "",
|
||||
"compute_extension:v3:os-pci:discoverable": "",
|
||||
"compute_extension:quotas:show": "",
|
||||
"compute_extension:quotas:update": "rule:admin_api",
|
||||
"compute_extension:quotas:delete": "rule:admin_api",
|
||||
|
95
nova/api/openstack/compute/plugins/v3/pci.py
Normal file
95
nova/api/openstack/compute/plugins/v3/pci.py
Normal file
@ -0,0 +1,95 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright 2013 Intel Corporation
|
||||
# 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.
|
||||
|
||||
|
||||
from nova.api.openstack import extensions
|
||||
from nova.api.openstack import wsgi
|
||||
from nova.api.openstack import xmlutil
|
||||
|
||||
|
||||
ALIAS = 'os-pci'
|
||||
instance_authorize = extensions.soft_extension_authorizer(
|
||||
'compute', 'v3:' + ALIAS + ':pci_servers')
|
||||
|
||||
|
||||
def make_server(elem):
|
||||
pci_devices = xmlutil.TemplateElement('%s:pci_devices' % Pci.alias,
|
||||
colon_ns=True)
|
||||
elem.append(pci_devices)
|
||||
device = xmlutil.SubTemplateElement(pci_devices,
|
||||
'%s:pci_device' % Pci.alias,
|
||||
selector='%s:pci_devices' % Pci.alias,
|
||||
colon_ns=True)
|
||||
device.set('id')
|
||||
|
||||
|
||||
class PciServerTemplate(xmlutil.TemplateBuilder):
|
||||
def construct(self):
|
||||
root = xmlutil.TemplateElement('server', selector='server')
|
||||
make_server(root)
|
||||
return xmlutil.SlaveTemplate(root, 1, nsmap={Pci.alias: Pci.namespace})
|
||||
|
||||
|
||||
class PciServersTemplate(xmlutil.TemplateBuilder):
|
||||
def construct(self):
|
||||
root = xmlutil.TemplateElement('servers')
|
||||
elem = xmlutil.SubTemplateElement(root, 'server', selector='servers')
|
||||
make_server(elem)
|
||||
return xmlutil.SlaveTemplate(root, 1, nsmap={Pci.alias: Pci.namespace})
|
||||
|
||||
|
||||
class PciServerController(wsgi.Controller):
|
||||
def _extend_server(self, server, instance):
|
||||
dev_id = []
|
||||
for dev in instance.pci_devices:
|
||||
dev_id.append({'id': dev['id']})
|
||||
server['%s:pci_devices' % Pci.alias] = dev_id
|
||||
|
||||
@wsgi.extends
|
||||
def show(self, req, resp_obj, id):
|
||||
context = req.environ['nova.context']
|
||||
if instance_authorize(context):
|
||||
resp_obj.attach(xml=PciServerTemplate())
|
||||
server = resp_obj.obj['server']
|
||||
instance = req.get_db_instance(server['id'])
|
||||
self._extend_server(server, instance)
|
||||
|
||||
@wsgi.extends
|
||||
def detail(self, req, resp_obj):
|
||||
context = req.environ['nova.context']
|
||||
if instance_authorize(context):
|
||||
resp_obj.attach(xml=PciServersTemplate())
|
||||
servers = list(resp_obj.obj['servers'])
|
||||
for server in servers:
|
||||
instance = req.get_db_instance(server['id'])
|
||||
self._extend_server(server, instance)
|
||||
|
||||
|
||||
class Pci(extensions.V3APIExtensionBase):
|
||||
"""Pci access support."""
|
||||
name = "PCIAccess"
|
||||
alias = ALIAS
|
||||
namespace = "http://docs.openstack.org/compute/ext/%s/api/v3" % ALIAS
|
||||
version = 1
|
||||
|
||||
def get_resources(self):
|
||||
return []
|
||||
|
||||
def get_controller_extensions(self):
|
||||
server_extension = extensions.ControllerExtension(
|
||||
self, 'servers', PciServerController())
|
||||
return [server_extension]
|
121
nova/tests/api/openstack/compute/plugins/v3/test_pci.py
Normal file
121
nova/tests/api/openstack/compute/plugins/v3/test_pci.py
Normal file
@ -0,0 +1,121 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright 2013 Intel 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.api.openstack.compute.plugins.v3 import pci
|
||||
from nova.api.openstack import wsgi
|
||||
from nova import context
|
||||
from nova import db
|
||||
from nova.objects import instance
|
||||
from nova.objects import pci_device
|
||||
from nova import test
|
||||
from nova.tests.api.openstack import fakes
|
||||
from nova.tests.objects import test_pci_device
|
||||
|
||||
|
||||
class FakeResponse(wsgi.ResponseObject):
|
||||
pass
|
||||
|
||||
|
||||
class PciServerTemplateTest(test.NoDBTestCase):
|
||||
def test_pci_server_serializer(self):
|
||||
fake_server = {"server": {'os-pci:pci_devices': [{"id": 1}]}}
|
||||
expected = ("<?xml version='1.0' encoding='UTF-8'?>\n"
|
||||
'<server xmlns:os-pci="http://docs.openstack.org/compute'
|
||||
'/ext/os-pci/api/v3"><os-pci:pci_devices xmlns:'
|
||||
'os-pci="os-pci"><os-pci:pci_device id="1"/>'
|
||||
'</os-pci:pci_devices></server>'
|
||||
)
|
||||
serializer = pci.PciServerTemplate()
|
||||
text = serializer.serialize(fake_server)
|
||||
self.assertEqual(expected, text)
|
||||
|
||||
def test_pci_servers_serializer(self):
|
||||
fake_servers = {"servers": [{'os-pci:pci_devices': [{"id": 1}]},
|
||||
{'os-pci:pci_devices': [{"id": 2}]}]}
|
||||
expected = ("<?xml version='1.0' encoding='UTF-8'?>\n"
|
||||
'<servers xmlns:os-pci="http://docs.openstack.org/'
|
||||
'compute/ext/os-pci/api/v3"><server><os-pci:pci_devices'
|
||||
' xmlns:os-pci="os-pci"><os-pci:pci_device id="1"/>'
|
||||
'</os-pci:pci_devices></server><server>'
|
||||
'<os-pci:pci_devices xmlns:os-pci="os-pci">'
|
||||
'<os-pci:pci_device id="2"/></os-pci:pci_devices>'
|
||||
'</server></servers>'
|
||||
)
|
||||
serializer = pci.PciServersTemplate()
|
||||
text = serializer.serialize(fake_servers)
|
||||
self.assertEqual(expected, text)
|
||||
|
||||
|
||||
class PciServerControllerTest(test.NoDBTestCase):
|
||||
def setUp(self):
|
||||
super(PciServerControllerTest, self).setUp()
|
||||
self.controller = pci.PciServerController()
|
||||
self.fake_obj = {'server': {'addresses': {},
|
||||
'id': 'fb08',
|
||||
'name': 'a3',
|
||||
'status': 'ACTIVE',
|
||||
'tenant_id': '9a3af784c',
|
||||
'user_id': 'e992080ac0',
|
||||
}}
|
||||
self.fake_list = {'servers': [{'addresses': {},
|
||||
'id': 'fb08',
|
||||
'name': 'a3',
|
||||
'status': 'ACTIVE',
|
||||
'tenant_id': '9a3af784c',
|
||||
'user_id': 'e992080ac',
|
||||
}]}
|
||||
self._create_fake_instance()
|
||||
self._create_fake_pci_device()
|
||||
self.pci_device.claim(self.inst)
|
||||
self.pci_device.allocate(self.inst)
|
||||
|
||||
def _create_fake_instance(self):
|
||||
self.inst = instance.Instance()
|
||||
self.inst.uuid = 'fake-inst-uuid'
|
||||
self.inst.pci_devices = pci_device.PciDeviceList()
|
||||
|
||||
def _create_fake_pci_device(self):
|
||||
def fake_pci_device_get_by_addr(ctxt, id, addr):
|
||||
return test_pci_device.fake_db_dev
|
||||
|
||||
ctxt = context.get_admin_context()
|
||||
self.stubs.Set(db, 'pci_device_get_by_addr',
|
||||
fake_pci_device_get_by_addr)
|
||||
self.pci_device = pci_device.PciDevice.get_by_dev_addr(ctxt, 1, 'a')
|
||||
|
||||
def test_show(self):
|
||||
def fake_get_db_instance(id):
|
||||
return self.inst
|
||||
|
||||
resp = FakeResponse(self.fake_obj, '')
|
||||
req = fakes.HTTPRequestV3.blank('/os-pci/1', use_admin_context=True)
|
||||
self.stubs.Set(req, 'get_db_instance', fake_get_db_instance)
|
||||
self.controller.show(req, resp, '1')
|
||||
self.assertEqual([{'id': 1}],
|
||||
resp.obj['server']['os-pci:pci_devices'])
|
||||
|
||||
def test_detail(self):
|
||||
def fake_get_db_instance(id):
|
||||
return self.inst
|
||||
|
||||
resp = FakeResponse(self.fake_list, '')
|
||||
req = fakes.HTTPRequestV3.blank('/os-pci/detail',
|
||||
use_admin_context=True)
|
||||
self.stubs.Set(req, 'get_db_instance', fake_get_db_instance)
|
||||
self.controller.detail(req, resp)
|
||||
self.assertEqual([{'id': 1}],
|
||||
resp.obj['servers'][0]['os-pci:pci_devices'])
|
@ -29,8 +29,10 @@ from nova.network import nova_ipam_lib
|
||||
from nova.network import rpcapi as network_rpcapi
|
||||
from nova.objects import base as obj_base
|
||||
from nova.objects import instance_info_cache
|
||||
from nova.objects import pci_device
|
||||
from nova.openstack.common import jsonutils
|
||||
from nova.tests.objects import test_instance_info_cache
|
||||
from nova.tests.objects import test_pci_device
|
||||
from nova.virt.libvirt import config as libvirt_config
|
||||
|
||||
|
||||
@ -435,6 +437,10 @@ def stub_compute_with_ips(stubs):
|
||||
def fake_create(*args, **kwargs):
|
||||
return _create_instances_with_cached_ips(orig_create, *args, **kwargs)
|
||||
|
||||
def fake_pci_device_get_by_addr(context, node_id, dev_addr):
|
||||
return test_pci_device.fake_db_dev
|
||||
|
||||
stubs.Set(db, 'pci_device_get_by_addr', fake_pci_device_get_by_addr)
|
||||
stubs.Set(compute_api.API, 'get', fake_get)
|
||||
stubs.Set(compute_api.API, 'get_all', fake_get_all)
|
||||
stubs.Set(compute_api.API, 'create', fake_create)
|
||||
@ -469,6 +475,7 @@ def _get_instances_with_cached_ips(orig_func, *args, **kwargs):
|
||||
"""
|
||||
instances = orig_func(*args, **kwargs)
|
||||
context = args[0]
|
||||
fake_device = pci_device.PciDevice.get_by_dev_addr(context, 1, 'a')
|
||||
|
||||
def _info_cache_for(instance):
|
||||
info_cache = dict(test_instance_info_cache.fake_info_cache,
|
||||
@ -485,8 +492,12 @@ def _get_instances_with_cached_ips(orig_func, *args, **kwargs):
|
||||
if isinstance(instances, (list, obj_base.ObjectListBase)):
|
||||
for instance in instances:
|
||||
_info_cache_for(instance)
|
||||
fake_device.claim(instance)
|
||||
fake_device.allocate(instance)
|
||||
else:
|
||||
_info_cache_for(instances)
|
||||
fake_device.claim(instances)
|
||||
fake_device.allocate(instances)
|
||||
return instances
|
||||
|
||||
|
||||
|
@ -234,6 +234,7 @@ policy_data = """
|
||||
"compute_extension:networks:view": "",
|
||||
"compute_extension:networks_associate": "",
|
||||
"compute_extension:os-tenant-networks": "",
|
||||
"compute_extension:v3:os-pci:pci_servers": "",
|
||||
"compute_extension:quotas:show": "",
|
||||
"compute_extension:quotas:update": "",
|
||||
"compute_extension:quotas:delete": "",
|
||||
|
@ -59,6 +59,7 @@
|
||||
"os-extended-status:task_state": null,
|
||||
"os-extended-status:vm_state": "active",
|
||||
"os-extended-volumes:volumes_attached": [],
|
||||
"os-pci:pci_devices": [{"id": 1}],
|
||||
"os-server-usage:launched_at": "%(timestamp)s",
|
||||
"os-server-usage:terminated_at": null,
|
||||
"progress": 0,
|
||||
|
@ -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-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-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="">
|
||||
<image id="%(uuid)s">
|
||||
<atom:link href="%(glance_host)s/images/%(uuid)s" rel="bookmark"/>
|
||||
</image>
|
||||
@ -16,6 +16,9 @@
|
||||
</addresses>
|
||||
<atom:link href="%(host)s/v3/servers/%(uuid)s" rel="self"/>
|
||||
<atom:link href="%(host)s/servers/%(uuid)s" rel="bookmark"/>
|
||||
<os-pci:pci_devices xmlns:os-pci="os-pci">
|
||||
<os-pci:pci_device id="1"/>
|
||||
</os-pci:pci_devices>
|
||||
<security_groups>
|
||||
<security_group name="default"/>
|
||||
</security_groups>
|
||||
|
@ -60,6 +60,7 @@
|
||||
"os-extended-status:task_state": null,
|
||||
"os-extended-status:vm_state": "active",
|
||||
"os-extended-volumes:volumes_attached": [],
|
||||
"os-pci:pci_devices": [{"id": 1}],
|
||||
"os-server-usage:launched_at": "%(timestamp)s",
|
||||
"os-server-usage:terminated_at": null,
|
||||
"progress": 0,
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?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-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">
|
||||
<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="">
|
||||
<image id="%(uuid)s">
|
||||
<atom:link href="%(glance_host)s/images/%(uuid)s" rel="bookmark"/>
|
||||
@ -17,6 +17,9 @@
|
||||
</addresses>
|
||||
<atom:link href="%(host)s/v3/servers/%(uuid)s" rel="self"/>
|
||||
<atom:link href="%(host)s/servers/%(uuid)s" rel="bookmark"/>
|
||||
<os-pci:pci_devices xmlns:os-pci="os-pci">
|
||||
<os-pci:pci_device id="1"/>
|
||||
</os-pci:pci_devices>
|
||||
<security_groups>
|
||||
<security_group name="default"/>
|
||||
</security_groups>
|
||||
|
@ -0,0 +1,60 @@
|
||||
{
|
||||
"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-pci:pci_devices": [
|
||||
{
|
||||
"id": 1
|
||||
}
|
||||
],
|
||||
"progress": 0,
|
||||
"status": "ACTIVE",
|
||||
"tenant_id": "openstack",
|
||||
"updated": "%(timestamp)s",
|
||||
"user_id": "fake"
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<server xmlns:os-pci="http://docs.openstack.org/compute/ext/os-pci/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">
|
||||
<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"/>
|
||||
<os-pci:pci_devices xmlns:os-pci="os-pci">
|
||||
<os-pci:pci_device id="1"/>
|
||||
</os-pci:pci_devices>
|
||||
</server>
|
@ -0,0 +1,16 @@
|
||||
{
|
||||
"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"
|
||||
},
|
||||
"personality" : [
|
||||
{
|
||||
"path" : "/etc/banner.txt",
|
||||
"contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<server xmlns="http://docs.openstack.org/compute/api/v1.1" image_ref="%(glance_host)s/images/%(image_id)s" flavor_ref="%(host)s/flavors/1" name="new-server-test">
|
||||
<metadata>
|
||||
<meta key="My Server Name">Apache1</meta>
|
||||
</metadata>
|
||||
<personality>
|
||||
<file path="/etc/banner.txt">
|
||||
ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBp
|
||||
dCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5k
|
||||
IGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVs
|
||||
c2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4g
|
||||
QnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRo
|
||||
ZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlv
|
||||
dSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vy
|
||||
c2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6
|
||||
b25zLiINCg0KLVJpY2hhcmQgQmFjaA==
|
||||
</file>
|
||||
</personality>
|
||||
</server>
|
@ -0,0 +1,16 @@
|
||||
{
|
||||
"server": {
|
||||
"admin_password": "%(password)s",
|
||||
"id": "%(id)s",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/v3/servers/%(uuid)s",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "%(host)s/servers/%(uuid)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<server xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" id="%(id)s" admin_password="%(password)s">
|
||||
<metadata/>
|
||||
<atom:link href="%(host)s/v3/servers/%(uuid)s" rel="self"/>
|
||||
<atom:link href="%(host)s/servers/%(uuid)s" rel="bookmark"/>
|
||||
</server>
|
@ -0,0 +1,62 @@
|
||||
{
|
||||
"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-pci:pci_devices": [
|
||||
{
|
||||
"id": 1
|
||||
}
|
||||
],
|
||||
"progress": 0,
|
||||
"status": "ACTIVE",
|
||||
"tenant_id": "openstack",
|
||||
"updated": "%(timestamp)s",
|
||||
"user_id": "fake"
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<servers xmlns:os-pci="http://docs.openstack.org/compute/ext/os-pci/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" 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"/>
|
||||
<os-pci:pci_devices xmlns:os-pci="os-pci">
|
||||
<os-pci:pci_device id="1"/>
|
||||
</os-pci:pci_devices>
|
||||
</server>
|
||||
</servers>
|
39
nova/tests/integrated/v3/test_pci.py
Normal file
39
nova/tests/integrated/v3/test_pci.py
Normal file
@ -0,0 +1,39 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
# Copyright 2013 Intel.
|
||||
#
|
||||
# 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.integrated.v3 import test_servers
|
||||
|
||||
|
||||
class ExtendedServerPciSampleJsonTest(test_servers.ServersSampleBase):
|
||||
extension_name = "os-pci"
|
||||
|
||||
def test_show(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_detail(self):
|
||||
self._post_server()
|
||||
response = self._do_get('servers/detail')
|
||||
subs = self._get_regexes()
|
||||
subs['hostid'] = '[a-f0-9]+'
|
||||
self._verify_response('servers-detail-resp', subs, response, 200)
|
||||
|
||||
|
||||
class ExtendedServerPciSampleXmlTest(ExtendedServerPciSampleJsonTest):
|
||||
ctype = 'xml'
|
@ -93,6 +93,7 @@ nova.api.v3.extensions =
|
||||
migrations = nova.api.openstack.compute.plugins.v3.migrations:Migrations
|
||||
multinic = nova.api.openstack.compute.plugins.v3.multinic:Multinic
|
||||
multiple_create = nova.api.openstack.compute.plugins.v3.multiple_create:MultipleCreate
|
||||
pci = nova.api.openstack.compute.plugins.v3.pci:Pci
|
||||
quota_classes = nova.api.openstack.compute.plugins.v3.quota_classes:QuotaClasses
|
||||
quota_sets = nova.api.openstack.compute.plugins.v3.quota_sets:QuotaSets
|
||||
remote_consoles = nova.api.openstack.compute.plugins.v3.remote_consoles:RemoteConsoles
|
||||
|
Loading…
Reference in New Issue
Block a user