# VNET template and cluster IDs

**URL:** <https://forum.opennebula.io/t/vnet-template-and-cluster-ids/9253>\
**Category:** Product Support\
**Created:** [February 22, 2021, 2:24pm UTC](https://forum.opennebula.io/t/vnet-template-and-cluster-ids/9253 "2021-02-22T14:24:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yenya](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/yenya/32/4624_2.png) [@Yenya](https://forum.opennebula.io/u/Yenya)\
**Post date:** [February 22, 2021, 2:24pm UTC](https://forum.opennebula.io/t/vnet-template-and-cluster-ids/9253/1 "2021-02-22T14:24:46Z")

</div>

Hi all,

does anybody here use virtual network templates? I want to allow ordinary users to create their own VNets, so I created a VNet template and want to instantiate it under an ordinary user. The problem is that the resulting VNET gets assigned to the CLUSTER=0 regardless of what I set up in the template:

```auto

# onevntemplate show 0
TEMPLATE 0 INFORMATION                                                          
ID : 0                   
NAME : My VNET template        
USER : oneadmin            
GROUP : privgroup               
LOCK : None                
REGISTER TIME : 02/22 14:12:20      

PERMISSIONS                                                                     
OWNER : um-                 
GROUP : u--                 
OTHER : ---                 

TEMPLATE CONTENTS                                                               
AUTOMATIC_VLAN_ID="YES"
CLUSTER="101"
FILTER_MAC_SPOOFING="YES"
GUEST_MTU="1200"
INBOUND_AVG_BW="100"
OUTBOUND_AVG_BW="100"
PHYDEV="eth0"
VN_MAD="vxlan"

```

See the `CLUSTER=101` above. This is the cluster I want the instantiated vnets to be in.However, when I try to instantiate the VNET template 0:

```auto
# onevntemplate instantiate --name 'test-vxlan' 0
VN ID: 36
# onevnet show 36
VIRTUAL NETWORK 36 INFORMATION                                                  
ID : 36                  
NAME : test-vxlan          
USER : oneadmin            
GROUP : oneadmin            
LOCK : None                
CLUSTERS : 0                   
BRIDGE : onebr36             
VN_MAD : vxlan               
PHYSICAL DEVICE : eth0                
VLAN ID : 38                  
AUTOMATIC VLAN ID : YES                 
AUTOMATIC OUTER VLAN ID : NO                  
USED LEASES : 0                   

PERMISSIONS                                                                     
OWNER : um-                 
GROUP : ---                 
OTHER : ---                 

VIRTUAL NETWORK TEMPLATE                                                        
BRIDGE="onebr36"
BRIDGE_TYPE="linux"
CLUSTER="101"
FILTER_MAC_SPOOFING="YES"
GUEST_MTU="1200"
INBOUND_AVG_BW="100"
OUTBOUND_AVG_BW="100"
PHYDEV="eth0"
SECURITY_GROUPS="0"
TEMPLATE_ID="0"
VN_MAD="vxlan"

ADDRESS RANGE POOL                                                              

LEASES                                                                          
AR OWNER MAC IP IP6

VIRTUAL ROUTERS
#

```

The newly created VNET is added to CLUSTER=0 (only), and as such it cannot be used for new VMs in CLUSTER=101. Note that I am doing this under oneadmin, but instantiating the VNet template under an ordinary user (member of group `privgroup`, of course) yields the same result.

EDIT: also, when I open the VNet template in Sunstone (as oneadmin), and click on the “Clusters” tab, there is no cluster selected. Even when I click on “Select cluster”, select cluster 101, and click on “Apply changes”, there is still no cluster selected in the “Clusters” tab".

EDIT2: when I manually add parameter `CLUSTERS = "101"` to the template (note the plural), save the template, and then click on the “Clusters” tab, the cluster 101 is displayed as selected for this template. However, instantiating this template still results in the new VNet assigned to cluster 0.

* * *

**Versions of the related components and OS (frontend, hypervisors, VMs):**  
CentOS Linux 7, Qemu, ONe 5.12.0.1 CE  
EDIT 3: 5.12.0.3 CE - still the same behaviour.

**Steps to reproduce:**  
see above

**Current results:**

**Expected results:**

---

<div class="post-metadata">

**Author:** ![ruben](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/ruben/32/19_2.png) [@ruben](https://forum.opennebula.io/u/ruben)\
**Post date:** [February 23, 2021, 8:15am UTC](https://forum.opennebula.io/t/vnet-template-and-cluster-ids/9253/2 "2021-02-23T08:15:18Z")

</div>

It seems you are looking for CLUSTER\_ID **S** , more information here (look at the example):

[https://docs.opennebula.io/5.12/operation/network\_management/vn\_templates.html#virtual-network-template-definition](https://docs.opennebula.io/5.12/operation/network_management/vn_templates.html#virtual-network-template-definition)

---

<div class="post-metadata">

**Author:** ![Yenya](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/yenya/32/4624_2.png) [@Yenya](https://forum.opennebula.io/u/Yenya)\
**Post date:** [February 23, 2021, 9:17am UTC](https://forum.opennebula.io/t/vnet-template-and-cluster-ids/9253/3 "2021-02-23T09:17:38Z")

</div>

Rubén, thanks for the hint. After adding `CLUSTER_IDS="101"` to the template file, I can create the template using `onevntemplate create`, and after instantiation, the resulting VNet gets correctly assigned to the cluster 101:

```auto
NAME="VXLAN test"
AUTOMATIC_VLAN_ID="YES"
CLUSTER_IDS="101"
FILTER_MAC_SPOOFING="YES"
GUEST_MTU="1500"
INBOUND_AVG_BW="100000"
OUTBOUND_AVG_BW="100000"
PHYDEV="eth1"
VN_MAD="vxlan"

```

However, there are still problems with Sunstone: the template in my first post was entirely created by Sunstone (5.12.0.1), apart from adding the `CLUSTERS` parameter manually afterwards, as I describe in the previous post. So there is definitely a bug in Sunstone that it does not create a correct cluster assignmnent in the VNet template.

For 5.12.0.3, I am not even able to create the template described above in Sunstone - it complains that the `Physical device` field with value `eth1` is filled incorrectly: `One or more required fields are missing or malformed.` It complains even when I try to update the existing template created from file using `onevntemplate`, do not modify anything, and click on the `Update` again. The `PHYDEV=eth1` field `onevntemplate` accepts, is not accepted by Sunstone.

In Sunstone view of this template, there are no clusters selected neither in the `Clusters` tab, nor when I click to `Select cluster`. In the `Info` tab, there is `CLUSTER_IDS=101` parameter, but it seems that Sunstone is trying to use something else in its `Clusters` tab.

Thanks!

-Yenya

---

<div class="post-metadata">

**Author:** ![Yenya](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/yenya/32/4624_2.png) [@Yenya](https://forum.opennebula.io/u/Yenya)\
**Post date:** [February 26, 2021, 11:06am UTC](https://forum.opennebula.io/t/vnet-template-and-cluster-ids/9253/4 "2021-02-26T11:06:29Z")

</div>

Created an issue at Github:

> <https://github.com/OpenNebula/one/issues/5267>
>
> Description
> Originally discussed here: https://forum.opennebula.io/t/vnet-template-and-cluster-ids/9253/3
> When I try to create a VNet template in Sunstone (5.12.0.3 CE, as oneadmin) it fails with One...
