<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Template creation is failing, because
      Engine is not receiving the alias which apparently is required
      since 3.5.<br>
      This is the XML sent to engine. Alias is there.<br>
      API bug?<br>
      <br>
      &lt;template&gt;
      <br>
          &lt;name&gt;UDSP_ovirt-22&lt;/name&gt;
      <br>
          &lt;description&gt;UDS pub for ovirt at 2015-05-09
      08:36:58&lt;/description&gt;
      <br>
          &lt;vm id="3774dcd0-9e1a-47af-9560-fde85f46bfa1"&gt;
      <br>
              &lt;disks&gt;
      <br>
                  &lt;disk id="f96b3718-3ccf-42f4-8537-e20dc5dd7bc3"&gt;
      <br>
                      &lt;name&gt;test&lt;/name&gt;
      <br>
      <b>                &lt;alias&gt;test&lt;/alias&gt;
      </b><br>
                      &lt;storage_domains&gt;
      <br>
                          &lt;storage_domain
      id="07326302-2c80-4d55-a7a2-ea79c55855e3"/&gt;
      <br>
                      &lt;/storage_domains&gt;
      <br>
                  &lt;/disk&gt;
      <br>
              &lt;/disks&gt;
      <br>
          &lt;/vm&gt;
      <br>
          &lt;cluster id="00000001-0001-0001-0001-00000000019d"/&gt;
      <br>
      &lt;/template&gt;
      <br>
      <br>
      On 09-05-2015 3:34, Adolfo wrote:<br>
    </div>
    <blockquote cite="mid:554DAA90.6090707@virtualcable.es" type="cite">Hello
      all,
      <br>
      <br>
      My name is Adolfo, i'm in charge of developing of UDS (you can see
      something about it on ovirt home page, the case study
      <a class="moz-txt-link-freetext" href="http://www.ovirt.org/Universidad_de_Sevilla_Case_Study">http://www.ovirt.org/Universidad_de_Sevilla_Case_Study</a>. ).
      <br>
      <br>
      Recently (a couple of days ago), i started to test UDS against
      ovirt 3.5, and sudenlty Template creation as was supported
      previously does not works. :(
      <br>
      <br>
      The idea is allow to create the template in the storage that the
      administrator of UDS selects.
      <br>
      <br>
      The process is simple and was working perfectly before to 3.5
      release (on 3.4, 3.3, 3.2 as long as i can remember). After
      getting all the data we need, we do the following (code follows):
      <br>
      <br>
      vm is the origin vm:
      <br>
      <br>
                  # Create disks description to be created in specified
      storage domain, one for each disk
      <br>
                  sd =
params.StorageDomains(storage_domain=[params.StorageDomain(id=storageId)])<br>
      <br>
                  dsks = []
      <br>
                  for dsk in vm.disks.list():
      <br>
                      dks.append(params.Disk(id=dsk.get_id(),
      storage_domains=sd, name='test', alias='test'))
      <br>
      <br>
                  disks = params.Disks(disk=dsks)
      <br>
      <br>
                  template = params.Template(
      <br>
                      name=name,
      <br>
                      vm=params.VM(id=vm.get_id(), disks=disks),
      <br>
                      cluster=params.Cluster(id=cluster.get_id()),
      <br>
                      description=comments
      <br>
                  )
      <br>
      <br>
                  return api.templates.add(template).get_id()
      <br>
      <br>
      This is the debug output of the request:
      <br>
      <br>
      POST /api/templates HTTP/1.1
      <br>
      Host: ovirt.dkmon.com
      <br>
      Accept-Encoding: identity
      <br>
      Content-Length: 2656
      <br>
      Filter: False
      <br>
      cookie: JSESSIONID=2Ihu3uUWFhvl2xbsi5i7yBip.undefined
      <br>
      Prefer: persistent-auth
      <br>
      Content-type: application/xml
      <br>
      Accept: application/xml
      <br>
      <br>
      &lt;template&gt;
      <br>
          &lt;name&gt;UDSP_ovirt-21&lt;/name&gt;
      <br>
          &lt;description&gt;UDS pub for ovirt at 2015-05-09
      08:27:06&lt;/description&gt;
      <br>
          &lt;vm id="3774dcd0-9e1a-47af-9560-fde85f46bfa1"&gt;
      <br>
              &lt;disks&gt;
      <br>
                  &lt;disk
      href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3"
      id="f96b3718-3ccf-42f4-8537-e20dc5dd7bc3"&gt;
      <br>
                      &lt;actions&gt;
      <br>
                          &lt;link
      href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/deactivate"
      rel="deactivate"/&gt;
      <br>
                          &lt;link
      href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/activate"
      rel="activate"/&gt;
      <br>
                          &lt;link
      href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/export"
      rel="export"/&gt;
      <br>
                          &lt;link
      href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/move"
      rel="move"/&gt;
      <br>
                      &lt;/actions&gt;
      <br>
                      &lt;name&gt;no-os_Dsk1&lt;/name&gt;
      <br>
                      &lt;description&gt;Small empty
      disk&lt;/description&gt;
      <br>
                      &lt;link
      href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/permissions"
      rel="permissions"/&gt;
      <br>
                      &lt;link
      href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/statistics"
      rel="statistics"/&gt;
      <br>
                      &lt;vm
      href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1"
      id="3774dcd0-9e1a-47af-9560-fde85f46bfa1"/&gt;
      <br>
                      &lt;alias&gt;no-os_Dsk1&lt;/alias&gt;
      <br>
&lt;image_id&gt;a79f7fe7-bcae-4cc3-8b11-d60702a46147&lt;/image_id&gt;
      <br>
                      &lt;storage_domains&gt;
      <br>
                          &lt;storage_domain
      id="a893809b-2ba9-4910-a7f3-9bfdde2efbb8"/&gt;
      <br>
                      &lt;/storage_domains&gt;
      <br>
                      &lt;size&gt;1073741824&lt;/size&gt;
      <br>
      &lt;provisioned_size&gt;1073741824&lt;/provisioned_size&gt;
      <br>
                      &lt;actual_size&gt;0&lt;/actual_size&gt;
      <br>
                      &lt;status&gt;
      <br>
                          &lt;state&gt;ok&lt;/state&gt;
      <br>
                      &lt;/status&gt;
      <br>
                      &lt;interface&gt;virtio&lt;/interface&gt;
      <br>
                      &lt;format&gt;raw&lt;/format&gt;
      <br>
                      &lt;sparse&gt;true&lt;/sparse&gt;
      <br>
                      &lt;bootable&gt;true&lt;/bootable&gt;
      <br>
                      &lt;shareable&gt;false&lt;/shareable&gt;
      <br>
      &lt;wipe_after_delete&gt;false&lt;/wipe_after_delete&gt;
      <br>
      &lt;propagate_errors&gt;false&lt;/propagate_errors&gt;
      <br>
                      &lt;active&gt;true&lt;/active&gt;
      <br>
                      &lt;read_only&gt;false&lt;/read_only&gt;
      <br>
                      &lt;disk_profile
      href="/api/diskprofiles/40def02e-3802-4122-a768-cb6b9518896e"
      id="40def02e-3802-4122-a768-cb6b9518896e"/&gt;
      <br>
                  &lt;/disk&gt;
      <br>
              &lt;/disks&gt;
      <br>
          &lt;/vm&gt;
      <br>
          &lt;cluster id="00000001-0001-0001-0001-00000000019d"/&gt;
      <br>
      &lt;/template&gt;
      <br>
      <br>
      reply: 'HTTP/1.1 400 Bad Request\r\n'
      <br>
      header: Date: Sat, 09 May 2015 06:27:13 GMT
      <br>
      header: Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips
      <br>
      header: JSESSIONID: 2Ihu3uUWFhvl2xbsi5i7yBip.undefined
      <br>
      header: Content-Type: application/xml
      <br>
      header: Content-Length: 180
      <br>
      header: Connection: close
      <br>
      <br>
      The response : Cannot add Template with an empty disk alias
      <br>
      <br>
      On server, i got this on ovirt log:
      <br>
      <br>
      2015-05-09 08:14:16,940 WARN
      [org.ovirt.engine.core.bll.AddVmTemplateCommand]
      (ajp--127.0.0.1-8702-8) CanDoAction of action AddVmTemplate failed
      for user admin@internal. Reasons:
VAR__ACTION__ADD,VAR__TYPE__VM_TEMPLATE,ACTION_TYPE_FAILED_TEMPLATE_CANNOT_BE_CREATED_WITH_EMPTY_DISK_ALIAS<br>
      <br>
      After a lot of tests, i have no idea how to resolve this, and if
      this is related to the change that was made to admin interface
      that alias is required when creating a template (googling have
      found something related to that change). The case is that even
      sending an "alias" (the alias is unique anyway, but is hardcoded
      in the example because of tests... :) )
      <br>
      <br>
      I don't know where to ask for help on this, if this is my own
      fault of is something that was missing on ovirt engine. We need to
      be able to create machines templates on whatever storage is
      decided... :(
      <br>
      <br>
      Thank you very much
      <br>
      <br>
      Adolfo Gómez
      <br>
      <br>
      _______________________________________________
      <br>
      Devel mailing list
      <br>
      <a class="moz-txt-link-abbreviated" href="mailto:Devel@ovirt.org">Devel@ovirt.org</a>
      <br>
      <a class="moz-txt-link-freetext" href="http://lists.ovirt.org/mailman/listinfo/devel">http://lists.ovirt.org/mailman/listinfo/devel</a><br>
    </blockquote>
    <br>
    <br>
    <div class="moz-signature">-- <br>
      <style>
.signature, .small-signature {
        font-family:"Calibri","sans-serif";mso-fareast-font-family:"Times New Roman";
        color:#7F7F7F;
}

.signature {
        font-size:10pt;
}

.small-signature {
        font-size:8pt;
}
</style>
      <p class="signature">
        <b>J. Christopher Pereira</b><br>
        Gerente General<br>
        IMATRONIX S.A.<br>
        <a class="moz-txt-link-abbreviated" href="http://www.imatronix.com">www.imatronix.com</a><br>
      </p>
      <p class="small-signature">
        Móvil : (09) 72 188 630<br>
        <br>
        Santiago: (+56) (02) 28 99 44 60 + anexo 800<br>
        Valparaíso: (+56) (32) 2 76 80 77 + anexo 800<br>
      </p>
    </div>
  </body>
</html>