Bug 1509588

Summary: [RFE][UI] - Allow import of VMs from storage domain with partial disks (UI only, API already exists).
Product: Red Hat Enterprise Virtualization Manager Reporter: Peter Manzella <pmanzell>
Component: ovirt-engineAssignee: Eyal Shenitzky <eshenitz>
Status: CLOSED ERRATA QA Contact: Kevin Alon Goldblatt <kgoldbla>
Severity: high Docs Contact:
Priority: high    
Version: 4.1.6CC: apinnick, ebenahar, eshenitz, gveitmic, lsurette, lveyde, mlipchuk, ratamir, rbalakri, Rhev-m-bugs, rhodain, rmcswain, srevivo, tnisan, ykaul, ylavi
Target Milestone: ovirt-4.2.2Keywords: FutureFeature
Target Release: ---Flags: lsvaty: testing_plan_complete-
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: ovirt-engine-4.2.2.1 Doc Type: If docs needed, set a value
Doc Text:
Previously, partial import of a virtual machine was only possible using the REST API. In the current release, an "Allow Partial" check box has been added to the Import Virtual Machine(s) window in the Manager.
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-05-15 17:45:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Storage RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
partial import screenshot none

Description Peter Manzella 2017-11-04 23:01:48 UTC
Description of problem:

Customer upgrading from RHEV 3.6 to RHV 4.1 using FC storage.

1. detached storage domain from RHEV 3.6 configuration
2. imported storage domain to RHV 4.1 configuration and activated the domain
3. imported the virtual machines
     37 out of 40 virtual machines imported properly
     3 VMs failed to import with an Operation Canceled dialog that reads as follows
    -----------------
    Error while executing action:

    <vm name>:
        . Cannot import VM. Storage Domain doesn't exist.
    -----------------

There appears to be literally nothing in the logs that informs about why the import failed.

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

   Red Hat Virtualization Manager Version: 4.1.6.2-0.1.el7

How reproducible:

   Unknown

Steps to Reproduce:
1.
2.
3.

Actual results:

   3 of 40 VMs failed to import from the imported storage domain.

Expected results:

   All VMs should import from the imported storage domain.

Additional info:

Comment 2 Allon Mureinik 2017-11-05 07:13:15 UTC
What about the logs?

Comment 18 Robert McSwain 2017-11-05 17:42:14 UTC
The customer has a system we can test with, win10test. Would anyone be able to provide the exact process for using the API for him to be able to perform the import in this way so that I can pass that along to him? For reference this is what was provided previously as an example:

~~~
POST /api/storagedomains/xxxxxxx-xxxx-xxxx-xxxxxx/vms/xxxxxxx-xxxx-xxxx-xxxxxx/register HTTP/1.1
Accept: application/xml
Content-type: application/xml

<action>
    <cluster id='bf5a9e9e-5b52-4b0d-aeba-4ee4493f1072'></cluster>
    <allow_partial_import>true</allow_partial_import>
</action>

That way, the user does not have to mess with the VM's OVF.
~~~

Comment 22 Robert McSwain 2017-11-06 00:28:41 UTC
Customer attempted to use the script. Initially he got errors but found that he'd missed some line breaks in the script. After fixing this he mentioned the following:

~~~
The script is now running, but it doesn’t appear to be doing anything, and there is no output after it runs.

Here is the curl that is sent 

curl --insecure --request POST --header "Accept: application/xml" --header "Content-Type: application/xml" --user "admin@intern:<password redacted>" --data "<action><cluster id=59efc2c5-028c-02f1-0195-000000000152></cluster><allow_partial_import>true</allow_partial_import></action>" localhost/ovirt-engine/api/storagedomains/5028de3a-605f-4f0f-9da2-0e76907a4449/vms/83c81a57-539f-4a6b-af49-4e1647abd4f1/register
~~~

followed by

~~~
Just to be sure the script was working, I did a straight curl from the command line.


curl --insecure --request POST --header "Accept: application/xml" --header "Content-Type: application/xml" --user "admin@internal:REDACTED" --data "<action><cluster id=59efc2c5-028c-02f1-0195-000000000152></cluster><allow_partial_import>true</allow_partial_import></action>" 127.0.0.1/ovirt-engine/api/storagedomains/5028de3a-605f-4f0f-9da2-0e76907a4449/vms/83c81a57-539f-4a6b-af49-4e1647abd4f1/register

There was no error, no output, and the VM was not imported.
~~~

Should the user be "admin" or the full "admin@internal"? And if admin@internal is correct then what might be the issue here?

Comment 24 Robert McSwain 2017-11-06 02:11:04 UTC
A python script that was able to resolve the issues with importing VMs:


~~~
#!/usr/bin/python

import ovirtsdk4 as sdk
import ovirtsdk4.types as types

def register_vm(vm):
    vm_service = vms_service.vm_service(vm.id)
    vm_service.register(
        cluster=types.Cluster(
            id='59efc2c5-028c-02f1-0195-000000000152',
        ),
        reassign_bad_macs=True,
        allow_partial_import=True
)

connection = sdk.Connection(
    url='https://FQDN/ovirt-engine/api',
    username='admin@internal',
    password='REDACTED',
    insecure=True,
)

storage_domains_service = connection.system_service().storage_domains_service()
storage_domain_service = storage_domains_service.storage_domain_service('5028de3a-605f-4f0f-9da2-0e76907a4449')
vms_service = storage_domain_service.vms_service()

for vm in vms_service.list(unregistered=True):
    print vm.name
    register_vm(vm)

# Close the connection to the server:
connection.close()
~~~

The customer impact is over as the VMs have now been imported, however I'll leave the bug open for the sake of dealing with the OVF impact. Thanks all for the support this weekend!

Comment 25 Germano Veit Michel 2017-11-06 06:51:45 UTC
I just reproduced this whole issue for RCA but I'm confused about what is going to be tracked on this specific BZ.

I guess (sorry if I'm wrong) this current BZ is going to track adding allow_partial_import to the GUI, so I opened this other BZ here[1] to track the issue of the snapshot memory volumes not being moved to a target SD when the VMs disks were moved, couldn't find any other BZ along those lines.

Feel free to close as dup in case this is going to be handled here, I'm just confused on what this BZ is for, sorry.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1509807

Comment 26 Maor 2017-11-06 10:31:22 UTC
(In reply to Germano Veit Michel from comment #25)
> I just reproduced this whole issue for RCA but I'm confused about what is
> going to be tracked on this specific BZ.
> 
> I guess (sorry if I'm wrong) this current BZ is going to track adding
> allow_partial_import to the GUI

Yaniv, 

I noticed you mentioned the GUI part of allow_partial_import in https://bugzilla.redhat.com/1380365#c11
Should we change this bug to an RFE? Which version should we target it?

Comment 27 Yaniv Lavi 2017-11-07 11:57:38 UTC
Done.
Germano, please document a KB with your script.

Comment 28 Germano Veit Michel 2017-11-08 00:29:57 UTC
(In reply to Yaniv Lavi from comment #27)
> Done.
> Germano, please document a KB with your script.

Done.

Comment 30 Allon Mureinik 2017-11-23 12:39:21 UTC
Eyal, is this covered by you recent work?

Comment 33 Eyal Shenitzky 2017-11-26 12:11:09 UTC
No, I added the functionality of partial_import in case there are disks that were attached to an unregistered VM and registered to the environment separately from the VM / template.

No UI work was done in this patch.

Comment 36 Eyal Shenitzky 2018-02-21 08:08:40 UTC
Created attachment 1398565 [details]
partial import screenshot

Comment 39 Kevin Alon Goldblatt 2018-03-19 11:12:14 UTC
Verified with the following code:
------------------------------------------
ovirt-engine-4.2.2.2-0.1.el7.noarch
vdsm-4.20.20-1.el7ev.x86_64

Verified with the following scenario:
------------------------------------------
1. Create a VM with disks on storage domain A and storage domain B.
2. Deactivate and detach storage domain A.
5. Remove the VM from step 1 that remains in the data center (have only one disk on storage domain B)
3. Attach storage domain A back to the data center.
4. Try to register the VM from step 1 (have only one disk on storage domain A) - will fail
5. Try to register the VM from step 1 and mark the 'partial import' checkbox (have only one disk on storage domain A) - will succeed


Moving to VERIFIED

Comment 43 errata-xmlrpc 2018-05-15 17:45:44 UTC
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://access.redhat.com/errata/RHEA-2018:1488

Comment 44 Franta Kust 2019-05-16 13:07:58 UTC
BZ<2>Jira Resync