# API and python bindings (pyone)

**URL:** <https://forum.opennebula.io/t/api-and-python-bindings-pyone/7512>\
**Category:** Installation & Configuration\
**Created:** [August 1, 2019, 8:26am UTC](https://forum.opennebula.io/t/api-and-python-bindings-pyone/7512 "2019-08-01T08:26:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![roman.saprykin](https://avatars.discourse-cdn.com/v4/letter/r/278dde/32.png) [@roman.saprykin](https://forum.opennebula.io/u/roman.saprykin)\
**Post date:** [August 1, 2019, 8:26am UTC](https://forum.opennebula.io/t/api-and-python-bindings-pyone/7512/1 "2019-08-01T08:26:59Z")

</div>

Hello!  
I’m trying to create VM or VM template with several disks using pyone lib, but it looks like there is an issue or something.  
Here is a code sample I use:  
#!/usr/bin/python

```
     import pyone
 
     one = pyone.OneServer("http://10.10.10.100:2633/RPC2", session="oneadmin:oneadmin")
     
     one.template.allocate(
       {
         'TEMPLATE': {
           'NAME': 'test100',
           'MEMORY': '1024',
           'DISK': { 'IMAGE_ID': '314'},
           'DISK': { 'IMAGE_ID': '310'},
           'CPU' : '1',
           'VCPU' : '2'
         }
       })

```

When I run it, ONE creates the template with only one disk - the last one I specified.  
Here is the result template:  
CPU = “1”  
DISK = [  
IMAGE\_ID = “310” ]  
MEMORY = “1024”  
VCPU = “2”

Any ideas why is that? Maybe I made a mistake in template description?

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![jorel](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/jorel/32/6552_2.png) [@jorel](https://forum.opennebula.io/u/jorel)\
**Post date:** [August 5, 2019, 8:58am UTC](https://forum.opennebula.io/t/api-and-python-bindings-pyone/7512/2 "2019-08-05T08:58:33Z")

</div>

Yes, this is a limitation. If there are duplicate entries in the template you need to pass it in ONE template format already, like this:

> ```
> one.template.allocate('''
> NAME="test100"
> MEMORY="1024"
> DISK=[IMAGE_ID= "314"]
> DISK=[IMAGE_ID= "310"]
> CPU="1"
> VCPU="2"
> ''')
> 
> ```

---

<div class="post-metadata">

**Author:** ![roman.saprykin](https://avatars.discourse-cdn.com/v4/letter/r/278dde/32.png) [@roman.saprykin](https://forum.opennebula.io/u/roman.saprykin)\
**Post date:** [August 5, 2019, 10:42am UTC](https://forum.opennebula.io/t/api-and-python-bindings-pyone/7512/3 "2019-08-05T10:42:15Z")

</div>

Thanks a lot, It works now.  
Is the information about limitation anywhere in documentation?

Thanks!
