[Openstack] Heat templates and Quantum resources

Simon Pasquier pasquier.simon at gmail.com
Tue Feb 5 09:40:47 UTC 2013


Hi all,

I have some questions regarding the integration of Quantum in Heat:
- I haven't found a way to attach an instance resource to a Quantum port
that already exists. Is it possible?
- When I create a Quantum port in my template and binds the instance to
that port, why does Heat still create an additional port to the
tenant-owned network?

I have created a very simple template to test:

{
  "AWSTemplateFormatVersion" : "2010-09-09",

  "Description" : "Test creation of Quantum resources with a very simple
instance",

  "Parameters" : {

    "KeyName" : {
      "Description" : "Name of an existing EC2 KeyPair to enable SSH access
to the instances",
      "Type" : "String"
    },

    "NetworkUuid" : {
      "Description" : "Network UUID",
      "Type" : "String"
    },

    "SubnetUuid" : {
      "Description" : "Network UUID",
      "Type" : "String"
    }
  },

  "Resources" : {
    "QuantumPort": {
      "Type": "OS::Quantum::Port",
      "Properties": {
        "network_id": { "Ref" : "NetworkUuid" },
        "device_id": { "Ref": "CirrosInstance" },
        "fixed_ips": [{
          "subnet_id": { "Ref" : "SubnetUuid" },
          "ip_address": "10.0.0.100"
        }]
      }
    },

    "DefaultSecurityGroup" : {
      "Type" : "AWS::EC2::SecurityGroup",
      "Properties" : {
        "GroupDescription" : "Enable ICMP plus SSH access",
        "SecurityGroupIngress" : [
          {"IpProtocol" : "icmp", "FromPort" : "-1", "ToPort" : "-1",
"CidrIp" : "0.0.0.0/0"},
          {"IpProtocol" : "tcp", "FromPort" : "22", "ToPort" : "22",
"CidrIp" : "0.0.0.0/0"}
        ]
      }
    },

    "CirrosInstance": {
      "Type": "AWS::EC2::Instance",
      "Properties": {
        "ImageId" : "cirros-0.3.0-x86_64-uec",
        "InstanceType"   : "m1.nano",
        "KeyName"        : { "Ref" : "KeyName" },
        "SecurityGroups" : [ {"Ref" : "DefaultSecurityGroup"} ]
      }
    }
  },

  "Outputs" : {
    "InstanceIPAddress" : {
      "Value" : { "Fn::GetAtt" : ["CirrosInstance", "PrivateIp"] },
      "Description": "Private IP address of the instance"
    }
  }
}

For my tests, I use devstack and the Open vSwitch plugin. After the stack
is created, the instance is up and running but it is connected to 2 ports:

$ heat stack-show cirros
+----------------------+-----------------------------------------------------------------------------------------------------------------+
| Property             | Value
                                                              |
+----------------------+-----------------------------------------------------------------------------------------------------------------+
| capabilities         | []
                                                             |
| creation_time        | 2013-02-05T09:11:39Z
                                                             |
| description          | Test creation of Quantum resources with a very
simple                                                           |
|                      | instance
                                                             |
| disable_rollback     | True
                                                             |
| id                   | 8c161ed2-691e-42e8-a872-e90f26a83ac5
                                                             |
| links                |
http://192.168.1.94:8004/v1/bc7d29521a444d59b1d68f1e0a81ce90/stacks/cirros/8c161ed2-691e-42e8-a872-e90f26a83ac5|
| notification_topics  | []
                                                             |
| outputs              | [
                                                              |
|                      |   {
                                                              |
|                      |     "output_value": "10.0.0.3",
                                                              |
|                      |     "description": "Private IP address of the
instance",                                                        |
|                      |     "output_key": "InstanceIPAddress"
                                                              |
|                      |   }
                                                              |
|                      | ]
                                                              |
| parameters           | {
                                                              |
|                      |   "NetworkUuid":
"e5b6584f-9ca8-4219-b2d4-1a2f56a502fe",
                   |
|                      |   "SubnetUuid":
"1aa32a3e-ec28-44aa-867c-fcb4f774fa43",
                    |
|                      |   "AWS::StackName": "cirros",
                                                              |
|                      |   "KeyName": "test",
                                                             |
|                      |   "AWS::Region": "ap-southeast-1"
                                                              |
|                      | }
                                                              |
| stack_name           | cirros
                                                             |
| stack_status         | CREATE_COMPLETE
                                                              |
| stack_status_reason  | Stack successfully created
                                                             |
| template_description | Test creation of Quantum resources with a very
simple                                                           |
|                      | instance
                                                             |
| timeout_mins         | 60
                                                             |
| updated_time         | 2013-02-05T09:12:02Z
                                                             |
+----------------------+-----------------------------------------------------------------------------------------------------------------+
$ nova show cirros.CirrosInstance
+-------------------------------------+----------------------------------------------------------------+
| Property                            | Value
                           |
+-------------------------------------+----------------------------------------------------------------+
| OS-DCF:diskConfig                   | MANUAL
                            |
| OS-EXT-SRV-ATTR:host                | controller
                            |
| OS-EXT-SRV-ATTR:hypervisor_hostname | controller
                            |
| OS-EXT-SRV-ATTR:instance_name       | instance-00000015
                           |
| OS-EXT-STS:power_state              | 1
                           |
| OS-EXT-STS:task_state               | None
                            |
| OS-EXT-STS:vm_state                 | active
                            |
| accessIPv4                          |
                           |
| accessIPv6                          |
                           |
| config_drive                        |
                           |
| created                             | 2013-02-05T09:11:43Z
                            |
| flavor                              | m1.nano (42)
                            |
| hostId                              |
495aafe7667bb70bb90e80cbfff9921d2929d909bef01bb93189b631       |
| id                                  |
46f1542b-3c4c-4849-bf05-488aba266e06                           |
| image                               | cirros-0.3.0-x86_64-uec
(3fecb845-3833-4731-beb6-cee4b6aca969) |
| key_name                            | test
                            |
| metadata                            | {}
                            |
| name                                | cirros.CirrosInstance
                           |
| private network                     | 10.0.0.3, 10.0.0.100
                            |
| progress                            | 0
                           |
| security_groups                     | [{u'name':
u'cirros.DefaultSecurityGroup'}]                    |
| status                              | ACTIVE
                            |
| tenant_id                           | bc7d29521a444d59b1d68f1e0a81ce90
                            |
| updated                             | 2013-02-05T09:12:00Z
                            |
| user_id                             | b8827fae4f7c4a0194b77ea3784d25d7
                            |
+-------------------------------------+----------------------------------------------------------------+

And the port created by the heat template is in DOWN state:

$ quantum port-show e22bda12-e062-4c13-ad99-85f0ea994e9e
+----------------------+-----------------------------------------------------------------------------------+
| Field                | Value
                                |
+----------------------+-----------------------------------------------------------------------------------+
| admin_state_up       | True
                               |
| binding:capabilities | {"port_filter": false}
                               |
| binding:vif_type     | ovs
                                |
| device_id            | 46f1542b-3c4c-4849-bf05-488aba266e06
                               |
| device_owner         |
                                |
| fixed_ips            | {"subnet_id":
"1aa32a3e-ec28-44aa-867c-fcb4f774fa43", "ip_address": "10.0.0.100"} |
| id                   | e22bda12-e062-4c13-ad99-85f0ea994e9e
                               |
| mac_address          | fa:16:3e:04:8a:56
                                |
| name                 | QuantumPort
                                |
| network_id           | e5b6584f-9ca8-4219-b2d4-1a2f56a502fe
                               |
| status               | DOWN
                               |
| tenant_id            | bc7d29521a444d59b1d68f1e0a81ce90
                               |
+----------------------+-----------------------------------------------------------------------------------+

Thanks in advance for the answers,

Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20130205/f5bca612/attachment.html>


More information about the Openstack mailing list