Here is that part:
template_id = '91e35bf5-b338-4115-ab63-309372a819ac'
#Ubuntu-14.04 template
template = api.templates.get(id=template_id)
template_disk_id = template.disks.list()[0].id
storage_id = 'UUID' #random storage id from storage list
cluster = api.clusters.get(name=vm_data['cluster_name'])
cpuparams = params.CPU(topology = params.CpuTopology(cores = 1,
sockets = vm_data['vm_cpus']))
disks = params.Disks(clone=True,
disk=[params.Disk(id=template_disk_id,
storage_domains=params.StorageDomains(storage_domain=[params.StorageDomain(id=storage_id)]))])
vmparams = params.VM(
id = vm_data['vm_id'],
name = vm_data['vm_name'],
memory = vm_data['vm_memory'] * MB,
cluster=cluster,
template=template,
cpu = cpuparams,
disks = disks,
custom_properties = custom_properties,
)
vmparams.set_type = 'server'
vm = api.vms.add(vmparams)
Every thing works fine, just showing blank template id instead of ubuntu
template id.
Thanks,
enax
On 05/04/2016 12:44 PM, Michal Skrivanek wrote:
> On 04 May 2016, at 12:43, Dobó László <laszlo.dobo(a)ezit.hu>
wrote:
>
> That vm is based on ubuntu template, the general subtab showing right.
and how exactly did you create that VM? anything special about it? if you now create a
new VM, is it showing the same behavior?
>
> On 05/04/2016 12:08 PM, Michal Skrivanek wrote:
>>> On 04 May 2016, at 10:52, Dobó László <laszlo.dobo(a)ezit.hu> wrote:
>>>
>>> I just realize there is two general tab on web ui, so i understand now where
the blank id come.
>>>
>>> Yeah its looks like a bug, from the attachment picture will be clear what is
the problem.
>> ok, so it is based off blank, it’s just the general subtab of the main view
showing something else
>>
>>> Thanks,
>>>
>>> enax
>>>
>>>
>>> On 05/04/2016 10:31 AM, Michal Skrivanek wrote:
>>>>> On 04 May 2016, at 10:24, Dobó László <laszlo.dobo(a)ezit.hu>
wrote:
>>>>>
>>>>> Yes, its cloned from different template than Blank, and later i need
to know which one was that template.
>>>>>
>>>>>
>>>>> Thanks,
>>>>>
>>>>> enax
>>>>>
>>>>>
>>>>> On 05/04/2016 09:49 AM, Michal Skrivanek wrote:
>>>>>>> On 02 May 2016, at 13:13, Dobó László
<laszlo.dobo(a)ezit.hu> wrote:
>>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> How can i get back the original template id after vm is
cloned with python sdk?
>>>>>>> print api.vms.get(id=vm_id).template.id
>>>>>>> result: 00000000-0000-0000-0000-000000000000 (blank
template)
>>>>>>>
>>>>>>> However under vm general tab on web ui, the tamplate name is
showing correctli.
>>>>>> what do you mean correctly - what does it show? Did you clone it
from a different template or is it a new VM from Blank
>>>> ah, ok, so you’re saying it shows blank id in REST API but it shows the
correct id in the UI, right?
>>>>
>>>> filing a bug sounds like a good idea.
>>>>
>>>> Thanks,
>>>> michal
>>>>
>>>>>> Thanks,
>>>>>> michal
>>>>>>
>>>>>>> regards,
>>>>>>> enax
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Users mailing list
>>>>>>> Users(a)ovirt.org
>>>>>>>
http://lists.ovirt.org/mailman/listinfo/users
>>>>>>>
>>>>>>>
>>> <vm.png>