Bug 1547766

Summary: Differencing Disk on Network Drive Fails Smartstate if initial disk on Local DRive.
Product: Red Hat CloudForms Management Engine Reporter: Jerry Keselman <jkeselma>
Component: SmartState AnalysisAssignee: Jerry Keselman <jkeselma>
Status: CLOSED CURRENTRELEASE QA Contact: Brandon Squizzato <bsquizza>
Severity: high Docs Contact:
Priority: high    
Version: 5.8.0CC: bsquizza, cpelland, obarenbo
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.10.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1563720 1563721 (view as bug list) Environment:
Last Closed: 2019-02-11 14:08:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1563720, 1563721    

Description Jerry Keselman 2018-02-21 21:42:09 UTC
Description of problem: When running Smartstate on an SCVMM virtual machine, if a differencing disk is on a Network drive and the initial virtual disk is on a local drive, the attempt will fail with "Unable to access parent disk".


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


How reproducible:
100% of the time.

Steps to Reproduce:
1. SCVMM Virtual machine with disk on a local drive, and a parent disk. 
2. Migrate the parent disk to a network drive (beginning with "\\"
3. Run Smartstate Analysis

Actual results:
Failed as above

Expected results:
Success

Additional info:

Comment 2 Jerry Keselman 2018-02-21 21:45:54 UTC
When we read a virtual disk on a network drive we must used an elevated WinRM shell.  Currently if the initial virtual disk read for a VM is on a local drive we assume all the parent disks in the chain are the same, which is, of course, incorrect.

Comment 3 Jerry Keselman 2018-02-21 21:51:31 UTC
https://github.com/ManageIQ/manageiq-smartstate/pull/55 fixes this issue, and should be added to both FINE and GAPRINDASHVILI.

Comment 4 CFME Bot 2018-02-23 16:44:55 UTC
New commit detected on ManageIQ/manageiq-smartstate/master:
https://github.com/ManageIQ/manageiq-smartstate/commit/ea2d3411144e4a2868c90b9072f334e0efc6d7b9

commit ea2d3411144e4a2868c90b9072f334e0efc6d7b9
Author:     Jerry Keselman <jkeselma>
AuthorDate: Wed Feb 21 16:31:25 2018 -0500
Commit:     Jerry Keselman <jkeselma>
CommitDate: Wed Feb 21 16:31:25 2018 -0500

    Check Drivetype for Each Differencing VhdxDisk
    
    When running Smartstate Analysis on SCVMM VhdxDisks first we need to
    determine if the virtual disk file lives on a local disk or on a network disk.
    Accessing the network disk must be through an elevated WinRM call, while that is
    not necessary for local disks.
    
    Previously once the determination is made on the initial disk opened the same type
    is assumed for each differencing (parent) disk in the chain of snapshots for a VhdxDisk.
    
    This, of course, may be incorrect since not each disk in the chain is necessarily on either
    a local or network disk.  If the initial disk is local, and the parent is remote, this would
    cause an access error trying to read the parent disk.
    
    We are changing this to check the type of disk for each new one opened.
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1547766

 lib/MiqVm/miq_scvmm_vm.rb    | 1 +
 lib/disk/modules/VhdxDisk.rb | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

Comment 7 Brandon Squizzato 2018-10-05 17:15:55 UTC
Verified on 5.10.0.18

Set up a VM with a difference disk on the local hyper-V host. The parent of the difference disk sits on a network share. Ran SSA against this VM.

Confirmed non-elevated powershell commands are run when analyzing the local disk:

[----] D, [2018-10-05T13:07:38.569242 #14014:b80f74] DEBUG -- : Q-task_id([job_dispatcher]) Running powershell script on hypv2012-01.ms01.cfme2.lab.eng.rdu2.redhat.com as MS01\Administrator:
$file_stream   = [System.IO.File]::Open("H:\diffdisk.vhdx", "Open", "Read", "Read")

Confirmed elevated commands are run when analyzing the parent disk:

[----] D, [2018-10-05T13:07:42.077724 #14014:b80f74] DEBUG -- : Q-task_id([job_dispatcher]) Running powershell script elevated on hypv2012-01.ms01.cfme2.lab.eng.rdu2.redhat.com as MS01\Administrator:
(Get-Item "\\vmm2012-01\MS01SCVMM2012Library\VHDs\fedora-small.vhdx").length