API and python bindings (pyone)

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!

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"
''')
1 Like

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

Thanks!