Re: [ovirt-devel] REST api and template creation
The fix looks simple enough. Amit - can you backport it please? - Original Message - > From: "Juan Hernández" > To: "Christopher Pereira" , devel@ovirt.org, "Allon > Mureinik" , > aavi...@redhat.com > Sent: Monday, May 11, 2015 12:48:49 PM > Subject: Re: [ovirt-devel] REST api and template creation > > On 05/09/2015 09:08 AM, Christopher Pereira wrote: > > Template creation is failing, because Engine is not receiving the alias > > which apparently is required since 3.5. > > This is the XML sent to engine. Alias is there. > > API bug? > > > > Yes, this is a bug in the API. It is fixed already in 3.6: > > SDK and REST ignore template's disk attributes > https://bugzilla.redhat.com/1110798 > > It didn't happen before 3.5 because the backend didn't check the content > of the alias. That changed in 3.5 as part of the fix for a different bug: > > Create template from vm with empty disk alias should block with > canDoAction > https://bugzilla.redhat.com/1110304 > > As far as I know there is no workaround, so you will have to wait for a > release containing the fix. Currently it is targeted for 3.6, but we > could retarget for 3.5. > > Allon, Amit, can we retarget bug 1110798 to the next 3.5.z? > > > > > UDSP_ovirt-22 > > UDS pub for ovirt at 2015-05-09 08:36:58 > > > > > > > > test > > *test * > > > > > id="07326302-2c80-4d55-a7a2-ea79c55855e3"/> > > > > > > > > > > > > > > > > On 09-05-2015 3:34, Adolfo wrote: > >> Hello all, > >> > >> 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 > >> http://www.ovirt.org/Universidad_de_Sevilla_Case_Study. ). > >> > >> 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. :( > >> > >> The idea is allow to create the template in the storage that the > >> administrator of UDS selects. > >> > >> 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): > >> > >> vm is the origin vm: > >> > >> # Create disks description to be created in specified > >> storage domain, one for each disk > >> sd = > >> params.StorageDomains(storage_domain=[params.StorageDomain(id=storageId)]) > >> > >> dsks = [] > >> for dsk in vm.disks.list(): > >> dks.append(params.Disk(id=dsk.get_id(), > >> storage_domains=sd, name='test', alias='test')) > >> > >> disks = params.Disks(disk=dsks) > >> > >> template = params.Template( > >> name=name, > >> vm=params.VM(id=vm.get_id(), disks=disks), > >> cluster=params.Cluster(id=cluster.get_id()), > >> description=comments > >> ) > >> > >> return api.templates.add(template).get_id() > >> > >> This is the debug output of the request: > >> > >> POST /api/templates HTTP/1.1 > >> Host: ovirt.dkmon.com > >> Accept-Encoding: identity > >> Content-Length: 2656 > >> Filter: False > >> cookie: JSESSIONID=2Ihu3uUWFhvl2xbsi5i7yBip.undefined > >> Prefer: persistent-auth > >> Content-type: application/xml > >> Accept: application/xml > >> > >> > >> UDSP_ovirt-21 > >> UDS pub for ovirt at 2015-05-09 08:27:06 > >> > >> > >> >> href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3" > >> id="f96b3718-3ccf-42f4-8537-e20dc5dd7bc3"> > >> > >> >> href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/deactivate" > >> rel="deactivate"/> > >> >> href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42
Re: [ovirt-devel] REST api and template creation
On 05/09/2015 09:08 AM, Christopher Pereira wrote: > Template creation is failing, because Engine is not receiving the alias > which apparently is required since 3.5. > This is the XML sent to engine. Alias is there. > API bug? > Yes, this is a bug in the API. It is fixed already in 3.6: SDK and REST ignore template's disk attributes https://bugzilla.redhat.com/1110798 It didn't happen before 3.5 because the backend didn't check the content of the alias. That changed in 3.5 as part of the fix for a different bug: Create template from vm with empty disk alias should block with canDoAction https://bugzilla.redhat.com/1110304 As far as I know there is no workaround, so you will have to wait for a release containing the fix. Currently it is targeted for 3.6, but we could retarget for 3.5. Allon, Amit, can we retarget bug 1110798 to the next 3.5.z? > > UDSP_ovirt-22 > UDS pub for ovirt at 2015-05-09 08:36:58 > > > > test > *test * > > id="07326302-2c80-4d55-a7a2-ea79c55855e3"/> > > > > > > > > On 09-05-2015 3:34, Adolfo wrote: >> Hello all, >> >> 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 >> http://www.ovirt.org/Universidad_de_Sevilla_Case_Study. ). >> >> 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. :( >> >> The idea is allow to create the template in the storage that the >> administrator of UDS selects. >> >> 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): >> >> vm is the origin vm: >> >> # Create disks description to be created in specified >> storage domain, one for each disk >> sd = >> params.StorageDomains(storage_domain=[params.StorageDomain(id=storageId)]) >> >> dsks = [] >> for dsk in vm.disks.list(): >> dks.append(params.Disk(id=dsk.get_id(), >> storage_domains=sd, name='test', alias='test')) >> >> disks = params.Disks(disk=dsks) >> >> template = params.Template( >> name=name, >> vm=params.VM(id=vm.get_id(), disks=disks), >> cluster=params.Cluster(id=cluster.get_id()), >> description=comments >> ) >> >> return api.templates.add(template).get_id() >> >> This is the debug output of the request: >> >> POST /api/templates HTTP/1.1 >> Host: ovirt.dkmon.com >> Accept-Encoding: identity >> Content-Length: 2656 >> Filter: False >> cookie: JSESSIONID=2Ihu3uUWFhvl2xbsi5i7yBip.undefined >> Prefer: persistent-auth >> Content-type: application/xml >> Accept: application/xml >> >> >> UDSP_ovirt-21 >> UDS pub for ovirt at 2015-05-09 08:27:06 >> >> >> > href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3" >> id="f96b3718-3ccf-42f4-8537-e20dc5dd7bc3"> >> >> > href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/deactivate" >> rel="deactivate"/> >> > href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/activate" >> rel="activate"/> >> > href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/export" >> rel="export"/> >> > href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/move" >> rel="move"/> >> >> no-os_Dsk1 >> Small empty disk >> > href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/permissions" >> rel="permissions"/> >> > href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/statistics" >> rel="statistics"/> >> > href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1" >> id="3774dcd0-9e1a-47af-9560-fde85f46bfa1"/> >> no-os_Dsk1 >> a79f7fe7-bcae-4cc3-8b11-d60702a46147 >> >> > id="a893809b-2ba9-4910-a7f3-9bfdde2efbb8"/> >> >> 1073741824 >> 1073741824 >> 0 >> >> ok >> >> virtio >> raw >> true >> true >> false >> false >> false >> true >> false >> > href="/api/diskprofiles/40def02e-3802-4122-a768-cb6b9518896e" >> id="40def02e-3802-4122-a768-cb6b9518896e"/> >>
Re: [ovirt-devel] REST api and template creation
Template creation is failing, because Engine is not receiving the alias which apparently is required since 3.5. This is the XML sent to engine. Alias is there. API bug? UDSP_ovirt-22 UDS pub for ovirt at 2015-05-09 08:36:58 test *test * id="07326302-2c80-4d55-a7a2-ea79c55855e3"/> On 09-05-2015 3:34, Adolfo wrote: Hello all, 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 http://www.ovirt.org/Universidad_de_Sevilla_Case_Study. ). 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. :( The idea is allow to create the template in the storage that the administrator of UDS selects. 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): vm is the origin vm: # Create disks description to be created in specified storage domain, one for each disk sd = params.StorageDomains(storage_domain=[params.StorageDomain(id=storageId)]) dsks = [] for dsk in vm.disks.list(): dks.append(params.Disk(id=dsk.get_id(), storage_domains=sd, name='test', alias='test')) disks = params.Disks(disk=dsks) template = params.Template( name=name, vm=params.VM(id=vm.get_id(), disks=disks), cluster=params.Cluster(id=cluster.get_id()), description=comments ) return api.templates.add(template).get_id() This is the debug output of the request: POST /api/templates HTTP/1.1 Host: ovirt.dkmon.com Accept-Encoding: identity Content-Length: 2656 Filter: False cookie: JSESSIONID=2Ihu3uUWFhvl2xbsi5i7yBip.undefined Prefer: persistent-auth Content-type: application/xml Accept: application/xml UDSP_ovirt-21 UDS pub for ovirt at 2015-05-09 08:27:06 href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3" id="f96b3718-3ccf-42f4-8537-e20dc5dd7bc3"> href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/deactivate" rel="deactivate"/> href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/activate" rel="activate"/> href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/export" rel="export"/> href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/move" rel="move"/> no-os_Dsk1 Small empty disk href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/permissions" rel="permissions"/> href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/statistics" rel="statistics"/> href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1" id="3774dcd0-9e1a-47af-9560-fde85f46bfa1"/> no-os_Dsk1 a79f7fe7-bcae-4cc3-8b11-d60702a46147 id="a893809b-2ba9-4910-a7f3-9bfdde2efbb8"/> 1073741824 1073741824 0 ok virtio raw true true false false false true false href="/api/diskprofiles/40def02e-3802-4122-a768-cb6b9518896e" id="40def02e-3802-4122-a768-cb6b9518896e"/> reply: 'HTTP/1.1 400 Bad Request\r\n' header: Date: Sat, 09 May 2015 06:27:13 GMT header: Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips header: JSESSIONID: 2Ihu3uUWFhvl2xbsi5i7yBip.undefined header: Content-Type: application/xml header: Content-Length: 180 header: Connection: close The response : Cannot add Template with an empty disk alias On server, i got this on ovirt log: 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 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
Re: [ovirt-devel] REST api and template creation
Sorry, the test included was copying the original disks... this is the test related to the posted code: POST /api/templates HTTP/1.1 Host: ovirt.dkmon.com Accept-Encoding: identity Content-Length: 577 Filter: False cookie: JSESSIONID=k1UQgGlccQgVsar+umnQPepE.undefined Prefer: persistent-auth Content-type: application/xml Accept: application/xml UDSP_ovirt-22 UDS pub for ovirt at 2015-05-09 08:36:58 test test id="07326302-2c80-4d55-a7a2-ea79c55855e3"/> Same result ofc... :) Again, sorry for the inconvenience El 09/05/2015 a las 8:34, Adolfo escribió: Hello all, 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 http://www.ovirt.org/Universidad_de_Sevilla_Case_Study. ). 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. :( The idea is allow to create the template in the storage that the administrator of UDS selects. 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): vm is the origin vm: # Create disks description to be created in specified storage domain, one for each disk sd = params.StorageDomains(storage_domain=[params.StorageDomain(id=storageId)]) dsks = [] for dsk in vm.disks.list(): dks.append(params.Disk(id=dsk.get_id(), storage_domains=sd, name='test', alias='test')) disks = params.Disks(disk=dsks) template = params.Template( name=name, vm=params.VM(id=vm.get_id(), disks=disks), cluster=params.Cluster(id=cluster.get_id()), description=comments ) return api.templates.add(template).get_id() This is the debug output of the request: POST /api/templates HTTP/1.1 Host: ovirt.dkmon.com Accept-Encoding: identity Content-Length: 2656 Filter: False cookie: JSESSIONID=2Ihu3uUWFhvl2xbsi5i7yBip.undefined Prefer: persistent-auth Content-type: application/xml Accept: application/xml UDSP_ovirt-21 UDS pub for ovirt at 2015-05-09 08:27:06 href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3" id="f96b3718-3ccf-42f4-8537-e20dc5dd7bc3"> href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/deactivate" rel="deactivate"/> href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/activate" rel="activate"/> href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/export" rel="export"/> href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/move" rel="move"/> no-os_Dsk1 Small empty disk href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/permissions" rel="permissions"/> href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/statistics" rel="statistics"/> href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1" id="3774dcd0-9e1a-47af-9560-fde85f46bfa1"/> no-os_Dsk1 a79f7fe7-bcae-4cc3-8b11-d60702a46147 id="a893809b-2ba9-4910-a7f3-9bfdde2efbb8"/> 1073741824 1073741824 0 ok virtio raw true true false false false true false href="/api/diskprofiles/40def02e-3802-4122-a768-cb6b9518896e" id="40def02e-3802-4122-a768-cb6b9518896e"/> reply: 'HTTP/1.1 400 Bad Request\r\n' header: Date: Sat, 09 May 2015 06:27:13 GMT header: Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips header: JSESSIONID: 2Ihu3uUWFhvl2xbsi5i7yBip.undefined header: Content-Type: application/xml header: Content-Length: 180 header: Connection: close The response : Cannot add Template with an empty disk alias On server, i got this on ovirt log: 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 After a lot of tests, i have no idea how to resolve th
[ovirt-devel] REST api and template creation
Hello all, 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 http://www.ovirt.org/Universidad_de_Sevilla_Case_Study. ). 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. :( The idea is allow to create the template in the storage that the administrator of UDS selects. 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): vm is the origin vm: # Create disks description to be created in specified storage domain, one for each disk sd = params.StorageDomains(storage_domain=[params.StorageDomain(id=storageId)]) dsks = [] for dsk in vm.disks.list(): dks.append(params.Disk(id=dsk.get_id(), storage_domains=sd, name='test', alias='test')) disks = params.Disks(disk=dsks) template = params.Template( name=name, vm=params.VM(id=vm.get_id(), disks=disks), cluster=params.Cluster(id=cluster.get_id()), description=comments ) return api.templates.add(template).get_id() This is the debug output of the request: POST /api/templates HTTP/1.1 Host: ovirt.dkmon.com Accept-Encoding: identity Content-Length: 2656 Filter: False cookie: JSESSIONID=2Ihu3uUWFhvl2xbsi5i7yBip.undefined Prefer: persistent-auth Content-type: application/xml Accept: application/xml UDSP_ovirt-21 UDS pub for ovirt at 2015-05-09 08:27:06 href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3" id="f96b3718-3ccf-42f4-8537-e20dc5dd7bc3"> href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/deactivate" rel="deactivate"/> href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/activate" rel="activate"/> href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/export" rel="export"/> href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/move" rel="move"/> no-os_Dsk1 Small empty disk href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/permissions" rel="permissions"/> href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1/disks/f96b3718-3ccf-42f4-8537-e20dc5dd7bc3/statistics" rel="statistics"/> href="/api/vms/3774dcd0-9e1a-47af-9560-fde85f46bfa1" id="3774dcd0-9e1a-47af-9560-fde85f46bfa1"/> no-os_Dsk1 a79f7fe7-bcae-4cc3-8b11-d60702a46147 id="a893809b-2ba9-4910-a7f3-9bfdde2efbb8"/> 1073741824 1073741824 0 ok virtio raw true true false false false true false href="/api/diskprofiles/40def02e-3802-4122-a768-cb6b9518896e" id="40def02e-3802-4122-a768-cb6b9518896e"/> reply: 'HTTP/1.1 400 Bad Request\r\n' header: Date: Sat, 09 May 2015 06:27:13 GMT header: Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips header: JSESSIONID: 2Ihu3uUWFhvl2xbsi5i7yBip.undefined header: Content-Type: application/xml header: Content-Length: 180 header: Connection: close The response : Cannot add Template with an empty disk alias On server, i got this on ovirt log: 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 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... :) ) 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... :( Thank you very much Adolfo Gómez ___ Devel mailing list Devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/devel