Hide Forgot
In rest and in python sdk I can update cdrom when vm is paused. However there is no VMCdRom.update overload that accepts 'current' parameter. Here is java sdk code: package java_sdk_testing; import org.ovirt.engine.sdk.Api; import org.ovirt.engine.sdk.decorators.VM; import org.ovirt.engine.sdk.decorators.VMCdRom; import org.ovirt.engine.sdk.entities.File; public class JavaSDKTestDebug { private static final String URL = "https://ilia-rhevm.qa.lab.tlv.redhat.com:443/api"; private static final Boolean debug = true; private static final Boolean noHostVerifictaion = true; public static void main(String[] args) throws Exception { Api api = new Api(URL, "admin@internal", "123456", null, null, null, null, noHostVerifictaion, null, debug); File file = new File(); file.setId("en_windows_7_enterprise_x64_dvd_x15-70749.iso"); VM vm = api.getVMs().list().get(0); VMCdRom cdrom = vm.getCdRoms().list().get(0); cdrom.setFile(file); cdrom.update(); api.close(); } } and i'm getting next exception: Exception in thread "main" code : 400 reason: Bad Request detail: There was an attempt to change VM values while the VM is not down. Please shut down the VM in order to modify these properties. at org.ovirt.engine.sdk.web.HttpProxy.execute(HttpProxy.java:118) at org.ovirt.engine.sdk.web.HttpProxyBroker.update(HttpProxyBroker.java:104) at org.ovirt.engine.sdk.decorators.VMCdRom.update(VMCdRom.java:94) at java_sdk_testing.JavaSDKTestDebug.main(JavaSDKTestDebug.java:20) In engine log I can see: 2013-11-26 14:12:00,841 ERROR [org.ovirt.engine.core.utils.ObjectIdentityChecker] (ajp-/127.0.0.1:8702-12) [4a85616] Field isoPath can not be updated when status is Paused 2013-11-26 14:12:00,841 WARN [org.ovirt.engine.core.utils.ObjectIdentityChecker] (ajp-/127.0.0.1:8702-12) [4a85616] ObjectIdentityChecker.IsUpdateValid:: Not updatable field 'isoPath' was updated 2013-11-26 14:12:00,841 WARN [org.ovirt.engine.core.bll.UpdateVmCommand] (ajp-/127.0.0.1:8702-12) [4a85616] CanDoAction of action UpdateVm failed. Reasons:VAR__ACTION__UPDATE,VAR__TYPE__VM,VM_CANNOT_UPDATE_ILLEGAL_FIELD I'm getting the same result with python sdk when i'm not using 'current' parameter. when I'm using it everything works fine. thats why we need it. Python code: >>> from ovirtsdk.xml import params >>> from ovirtsdk.api import API >>> api = API(url='https://ilia-rhevm.qa.lab.tlv.redhat.com:443', username='admin@internal', password='123456', insecure=True) >>> f = params.File(id="en_windows_7_enterprise_x64_dvd_x15-70749.iso") >>> vm = api.vms.list()[0] >>> vm.get_cdroms().list() [<ovirtsdk.infrastructure.brokers.VMCdRom object at 0x3bc7f10>] >>> cdrom = vm.get_cdroms().list()[0] >>> cdrom.set_file(f) >>> cdrom.update() Traceback (most recent call last): File "<input>", line 1, in <module> File "/usr/lib/python2.6/site-packages/ovirtsdk/infrastructure/brokers.py", line 14009, in update headers={"Correlation-Id":correlation_id} File "/usr/lib/python2.6/site-packages/ovirtsdk/infrastructure/proxy.py", line 72, in update return self.request('PUT', url, body, headers) File "/usr/lib/python2.6/site-packages/ovirtsdk/infrastructure/proxy.py", line 112, in request persistent_auth=self._persistent_auth) File "/usr/lib/python2.6/site-packages/ovirtsdk/infrastructure/proxy.py", line 134, in __doRequest persistent_auth=persistent_auth File "/usr/lib/python2.6/site-packages/ovirtsdk/web/connection.py", line 133, in doRequest raise RequestError, response RequestError: status: 400 reason: Bad Request detail: There was an attempt to change VM values while the VM is not down. Please shut down the VM in order to modify these properties. >>> cdrom.update(current=True) <ovirtsdk.infrastructure.brokers.VMCdRom object at 0x3bbba90>
There is an "update" method that provides all the URL parameters, including the "current" parameter: public VMCdRom update(Boolean async, Boolean current, String correlationId) throws ClientProtocolException, ServerException, IOException { ... } This was added due to bug 1008176. Is this enough? If it is then I would suggest to close this bug as duplicate of bug 1008176.
I can see in rhevm-sdk-java-1.0.0.29-1-javadoc.jar: public VMCdRom update(Boolean async, Boolean current, String correlationId) throws org.apache.http.client.ClientProtocolException, ServerException, IOException Updates VMCdRom object. Parameters: cdrom - CdRom [cdrom.file.id] correlationId - [any string] async - [true|false] current - [true|false] Returns: VMCdRom Throws: org.apache.http.client.ClientProtocolException - Signals that HTTP/S protocol error has occurred. ServerException - Signals that an oVirt api error has occurred. IOException - Signals that an I/O exception of some sort has occurred. This update overload also appears in eclipse auto-completion.
Closing as part of 3.4.0