Created attachment 785404 [details] engine log Description of problem: Version-Release number of selected component (if applicable): IS9 How reproducible: 100% Steps to Reproduce: 1. create DC + cluster 2. force remove DC using RESTAPI / CLI DELETE /api/datacenters/f2f208b0-cb00-4398-b35a-6f821482d275 <action> <force>=true</force> </action> remove datacenter MyDC --force Actual results: Data Center MyDC was removed by user@domain Expected results: Data Center MyDC was forcibly removed by user@domain Additional info:
When executing: remove datacenter MyDC --force (only through the cli/api) The forceDelete parameter is false for some reason.
cli expects a boolean argument (see 'help remove datacenter dc_01') do remove datacenter MyDC --force true and not remove datacenter MyDC --force We should consider opening a new bug for the missing parameter not triggering an error message (not specifically for the --force parameter). I've sent an email to a PM about it.
Thanks for noticing. Yes, this is definitely a bug. If --force is stated in CLI we should have "true" as default, a success/failure output message and 0/1 exit code accordingly(just like any other linux CLI command standard) Arthur
This bug was about the wrong message recived in th task monitor. In the RFE (https://bugzilla.redhat.com/show_bug.cgi?id=922504) there should be a different message for forece and regular DC remove. Actually, it seems that the force remove DC action is not working using API: DELETE /api/datacenters/fb3072a9-4ae0-470d-9b3a-4eb17a733d39 HTTP/1.1 Accept: application/xml Content-type: application/xml <action> <force>true</force> </action> Response: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <fault> <reason>Operation Failed</reason> <detail>[Cannot remove an active Data Center.]</detail> </fault> same response for the CLI, naturally: [RHEVM shell (connected@localhost)]# remove datacenter f8835417-ef89-4313-94c6-3560ce5ac678 --force true error: status: 409 reason: Conflict detail: Cannot remove an active Data Center. Therefore I re-open the bug.
Can you please attach engine.log?
Created attachment 841410 [details] engine log
Michael, Did we do some generic work on this issue ?
(In reply to Barak Dagan from comment #4) > This bug was about the wrong message recived in th task monitor. > In the RFE (https://bugzilla.redhat.com/show_bug.cgi?id=922504) there should > be a different message for forece and regular DC remove. > > Actually, it seems that the force remove DC action is not working using API: > > > DELETE /api/datacenters/fb3072a9-4ae0-470d-9b3a-4eb17a733d39 HTTP/1.1 > Accept: application/xml > Content-type: application/xml > > <action> > <force>true</force> > </action> > > Response: > > <?xml version="1.0" encoding="UTF-8" standalone="yes"?> > <fault> > <reason>Operation Failed</reason> > <detail>[Cannot remove an active Data Center.]</detail> > </fault> > > same response for the CLI, naturally: > > [RHEVM shell (connected@localhost)]# remove datacenter > f8835417-ef89-4313-94c6-3560ce5ac678 --force true > > error: > status: 409 > reason: Conflict > detail: Cannot remove an active Data Center. > > Therefore I re-open the bug. i'm not sure your expectations from 'force' are correct, Iatamar, should we be able removing 'active' DC?, see RemoveStoragePoolCommand#canDoAction
(In reply to Arthur Berezin from comment #3) > Thanks for noticing. > > Yes, this is definitely a bug. > > If --force is stated in CLI we should have "true" as default, a > success/failure output message and 0/1 exit code accordingly(just like any > other linux CLI command standard) > > > > Arthur this is not a bug, but current behaviour of cli, we have RFE (bug 1006918) to treat boolean options as flags.
Indeed, canDoAction of the command clearly shows that an active data center will not be removed. the check of the "force" flag is used in other conditions at the canDoAction. Do we want to change this behavior?
Yair, in which cases/conditions do we take "force" under account today? Force is mostly used to remove an object which is not operational, but has dependencies which prevent the user to issue a standard "delete" command.
Again, this is not about the boolean of the cli. it is about not be able to do action, which can be done from the UI, using the API. As can be seen it doesn't work using the REST xml as well. I added the CLI, since it is easier IMO. I do think it should be solved in 3.3.0 or 3.3.1.
(In reply to Arthur Berezin from comment #12) > Yair, in which cases/conditions do we take "force" under account today? > > Force is mostly used to remove an object which is not operational, but has > dependencies which prevent the user to issue a standard "delete" command. Arthur - force will work in all cases except for the following cases where it will fail on validation: 1. DataCenter is up 2. There are active or locked storage domains 3. When one of the host is not in maintainence.
(In reply to Yair Zaslavsky from comment #15) > (In reply to Arthur Berezin from comment #12) > > Yair, in which cases/conditions do we take "force" under account today? > > > > Force is mostly used to remove an object which is not operational, but has > > dependencies which prevent the user to issue a standard "delete" command. > > Arthur - force will work in all cases except for the following cases where > it will fail on validation: > > 1. DataCenter is up > 2. There are active or locked storage domains > 3. When one of the host is not in maintainence. So bottom line - what is the bug here? If server gets the force flag, which behavior should change?
Verified by both Juan and myself - this works via API. Command used: curl \ -k \ -X DELETE \ -H "Accept: application/xml" \ -H "Content-Type: application/xml" \ -u admin@internal:123456 \ -d '<action><force>true</force></action>' \ http://localhost:8080/ovirt-engine/api/datacenters/329304cb-727e-4db4-b9e1-f749f6a52ffe Needs JBoss 7.1.1
Moving to ON-QA
Verified on av2.1 [oVirt shell (connected)]# list datacenters id : ed2509b5-d32b-4c69-b9a2-ee260e39d90b name : MyDC id : 00000002-0002-0002-0002-0000000000b2 name : Default description: The default Data Center [oVirt shell (connected)]# show datacenter MyDC id : ed2509b5-d32b-4c69-b9a2-ee260e39d90b name : MyDC local : False status-state : up storage_format : v3 supported_versions-version-major: 3 supported_versions-version-minor: 4 version-major : 3 version-minor : 4 [oVirt shell (connected)]# list clusters --show-all | egrep 'name|id|data' id : 24f48f99-d97d-485d-b181-c099fef572a0 name : MyCL data_center-id : ed2509b5-d32b-4c69-b9a2-ee260e39d90b id : 00000001-0001-0001-0001-0000000000ea name : Default data_center-id : 00000002-0002-0002-0002-0000000000b2 [oVirt shell (connected)]# list vms --show-all | egrep 'name|cluster' name : VM-0 cluster-id : 24f48f99-d97d-485d-b181-c099fef572a0 name : VM-1 cluster-id : 24f48f99-d97d-485d-b181-c099fef572a0 name : VM-2 cluster-id : 24f48f99-d97d-485d-b181-c099fef572a0 name : VM-3 cluster-id : 24f48f99-d97d-485d-b181-c099fef572a0 name : VM-4 cluster-id : 24f48f99-d97d-485d-b181-c099fef572a0 [oVirt shell (connected)]# remove datacenter MyDC --force true ================================================= ERROR ============================================== status: 409 reason: Conflict detail: Cannot remove an active Data Center. ====================================================================================================== Log: 2014-03-11 09:12:47,553 INFO [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (ajp-/127.0.0.1:8702-10) Correlation ID: null, Call Stack: null, Custom Event ID: -1, Message: User admin logged in. 2014-03-11 09:13:39,868 WARN [org.ovirt.engine.core.bll.storage.RemoveStoragePoolCommand] (ajp-/127.0.0.1:8702-10) [2fdfb6c2] CanDoAction of action RemoveStoragePool failed. Reasons:VAR__TYPE__STORAGE__POOL,VAR__ACTION__REMOVE,ERROR_CANNOT_REMOVE_ACTIVE_STORAGE_POOL 2014-03-11 09:13:39,877 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (ajp-/127.0.0.1:8702-10) Operation Failed: [Cannot remove an active Data Center.] ============================================================================== Shutting down VM, moving host to maintenance: [oVirt shell (connected)]# remove datacenter MyDC --force true job-id : a0133eac-3e50-4803-801a-b38302629ebc status-state: complete Task Monitor: "Data Center DC10 was forcibly removed by admin". Seems that the Bug was in the UI - datacenter could be force removed when it shouldn't.
Closing as part of 3.4.0