Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1408823 - [z-stream clone - 4.0.7] Unable to set instance type via python SDK without separately setting the console type first
[z-stream clone - 4.0.7] Unable to set instance type via python SDK without s...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine (Show other bugs)
4.0.3
Unspecified Unspecified
unspecified Severity medium
: ovirt-4.0.7
: ---
Assigned To: Sharon Gratch
sefi litmanovich
: ZStream
Depends On: 1396153
Blocks:
  Show dependency treegraph
 
Reported: 2016-12-27 08:11 EST by rhev-integ
Modified: 2017-04-03 09:26 EDT (History)
12 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1396153
Environment:
Last Closed: 2017-03-16 11:30:43 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: Virt
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
oVirt gerrit 69147 None None None 2016-12-27 08:12 EST
oVirt gerrit 69174 ovirt-engine-4.1 MERGED engine: set a valid singleQxlPci value for v2v VMs 2016-12-28 07:21 EST
oVirt gerrit 69185 ovirt-engine-4.0 MERGED engine: set a valid singleQxlPci value for v2v VMs 2016-12-29 04:43 EST
Red Hat Product Errata RHBA-2017:0542 normal SHIPPED_LIVE Red Hat Virtualization Manager 4.0.7 2017-03-16 15:25:04 EDT

  None (edit)
Description rhev-integ 2016-12-27 08:11:31 EST
+++ This bug is a downstream clone. The original bug is: +++
+++   bug 1396153 +++
======================================================================

Description of problem:

As reported from the customer:

------8<-----------

After we import a VM from KVM we have certain operations we need to complete... including setting the Instance Type, Optimizing for Server and picking it's network... However through the API when we attempt to alter the instance type we get an error from RHVM.

This will impact our migration of close to 800 VMs over the coming months.

---

    vms_service = connection.system_service().vms_service()

    vm = vms_service.list(search='name=' + vm_name)
    if len(vm) != 1:
        print 'not found, or duplicate'
        exit()

    vm = vm[0]

    it_service = connection.system_service().instance_types_service().list()
    vm_instance_type_obj = None
    for it in it_service:
        if it.name == vm_instance_type:
            vm_instance_type_obj = it
            break
    if vm_instance_type_obj == None:
        print 'could not find instant type'
        exit()

    # GET OUR VM
    vm_service = vms_service.vm_service(vm.id)

    # UPDATE OUR VM
    vm_service.update(
        types.Vm(
            instance_type=vm_instance_type_obj
        )
    )

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/fabric/main.py", line 743, in main
    *args, **kwargs
  File "/usr/local/lib/python2.7/site-packages/fabric/tasks.py", line 427, in execute
    results['<local-only>'] = task.run(*args, **new_kwargs)
  File "/usr/local/lib/python2.7/site-packages/fabric/tasks.py", line 174, in run
    return self.wrapped(*args, **kwargs)
  File "/Users/ccrawford40/git/capella/uops-systems-code/fabric/builds/rhev_ops.py", line 103, in rhev_dr_import_config
    instance_type=vm_instance_type_obj
  File "/usr/local/lib/python2.7/site-packages/ovirtsdk4/services.py", line 24130, in update
    self._check_fault(response)
  File "/usr/local/lib/python2.7/site-packages/ovirtsdk4/service.py", line 98, in _check_fault
    Service._raise_error(response, fault)
  File "/usr/local/lib/python2.7/site-packages/ovirtsdk4/service.py", line 71, in _raise_error
    raise Error(msg)
ovirtsdk4.Error: Fault reason is "Operation Failed". Fault detail is "[Cannot edit VM. Cannot set single display device via VNC display.]". HTTP response code is 400.

------8<-----------


If the customer first modifies the console from CIRRUS to QXL, the above code snippet works without issues. Similarly, if they perform the following via the SDK, this also works without issue:

------8<-----------
 
  vm_service.update(
        types.Vm(
            display=types.Display(
            single_qxl_pci=False
            )
        )
    )

    vm_service.update(
        types.Vm(
            instance_type=vm_instance_type_obj
        )
    )

------8<-----------


Version-Release number of selected component (if applicable):
rhevm-4.0.4.4-0.1

How reproducible:
Always for customer

Steps to Reproduce:
1. Import a VM from KVM
2. Attempt to update the VM's instance type
3.

Actual results:

Unless the console type is set first (explicitly), then the above error is returned.

Expected results:

Instance type should be set without error.
Additional info:

(Originally by jhunsaker)
Comment 1 rhev-integ 2016-12-27 08:11:39 EST
Python SDK just pass through the values user will set.

The issue here is that default values at the engine backend side aren't correctly 
set based on the values set by the user.

Jakub, can you please take a look?

(Originally by Ondra Machacek)
Comment 10 sefi litmanovich 2017-01-30 04:50:32 EST
Verified with rhevm-4.0.7-0.1.el7ev.noarch.
Imported vms from kvm:
1. VM with VNC-CIRRUS chose OS type 'linux' on import menu. Result: Vm imported wth VNC CIRRUS and single pci disalbed.
2. VM with VNC-CIRRUS chose OS type 'other_os' on import menu. Result: Vm imported wth VNC CIRRUS and single pci disalbed.
3. VM with SPICE-QXL chose OS type 'linux' on import menu. Result: Vm imported with SPICE QXL and single pci enabled.
4. VM with SPICE-QXL chose OS type 'other_os' on import menu. Result: Vm imported with SPICE QXL and single pci disabled.

All the imports results are correct and expected.
Comment 12 errata-xmlrpc 2017-03-16 11:30:43 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2017-0542.html

Note You need to log in before you can comment on or make changes to this bug.