Bug 1129261

Summary: prepareImage api call fails with [Errno 2] No such file or directory
Product: [Retired] oVirt Reporter: Jiri Moskovcak <jmoskovc>
Component: ovirt-hosted-engine-haAssignee: Jiri Moskovcak <jmoskovc>
Status: CLOSED CURRENTRELEASE QA Contact: Nikolai Sednev <nsednev>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 3.5CC: amureini, bazulay, bugs, dfediuck, ecohen, fsimonce, gklein, iheim, jmoskovc, mgoldboi, rbalakri, sbonazzo, yeylon
Target Milestone: ---Keywords: TestBlocker, Triaged
Target Release: 3.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: sla
Fixed In Version: ovirt-3.5.0_rc2 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1130038 (view as bug list) Environment:
Last Closed: 2014-10-17 12:28:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: SLA RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1139019    
Bug Blocks: 1067162, 1073943    
Attachments:
Description Flags
vdsm logs
none
logs and test none

Description Jiri Moskovcak 2014-08-12 12:25:41 UTC
Created attachment 926064 [details]
vdsm logs

Description of problem:
when hosted engine broker tries to connect it's storage using vdsm it fail with: [Errno 2] No such file or directory

Version-Release number of selected component (if applicable):
vdsm-4.16.1-6.gita4a4614.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. install hosted-engine
2. reboot the machine
3. check if the hosted engine storage is up'n'running
4. /rhev/data-center/mnt/blockSD/3498465f-eb04-49f3-81d2-f7713b392e5a/ha_agent/hosted-engine.metadata points to volume which is not activated

Actual results:
ha-agent doesn't run

Expected results:
storage connected, ha-agent running

Additional info:
vdsm log attached

Comment 1 Jiri Moskovcak 2014-08-12 12:28:11 UTC
after additional testing, it seems like it actually activates the lvm device, but fails to create some symlink and returns non-zero error code which makes the he-broker think that it fails even though the storage is actually available.

Comment 2 Dan Kenigsberg 2014-08-12 14:21:50 UTC
Thread-1205::ERROR::2014-08-12 14:13:03,605::blockSD::1054::Storage.StorageDomain::(linkBCImage) Failed to create path to image directory: /rhev/data-center/84cfc3d9-03cf-4ec5-9f29-a18ba1f6f02f/3498465f-eb04-49f3-81d2-f7713b392e5a/images/04f6b652-5e14-40d8-973c-ca384ffc0c50
Thread-1205::ERROR::2014-08-12 14:13:03,605::task::866::Storage.TaskManager.Task::(_setError) Task=`0ffda0cc-8afc-46bb-8b80-49e0a4291a68`::Unexpected error
Traceback (most recent call last):
  File "/usr/share/vdsm/storage/task.py", line 873, in _run
    return fn(*args, **kargs)
  File "/usr/share/vdsm/logUtils.py", line 45, in wrapper
    res = f(*args, **kwargs)
  File "/usr/share/vdsm/storage/hsm.py", line 3213, in prepareImage
    runImgPath = dom.linkBCImage(imgPath, imgUUID)
  File "/usr/share/vdsm/storage/blockSD.py", line 1047, in linkBCImage
    os.symlink(imgPath, dst)
OSError: [Errno 2] No such file or directory

Comment 3 Federico Simoncelli 2014-08-13 15:52:06 UTC
The request fails because you're not connected to a pool. To prepare an image when you're not connected to a pool (general HE use case) you should specify a blank pool uuid (00000000-0000-0000-0000-000000000000). E.g.:

prepareImage(sdUUID='3498465f-eb04-49f3-81d2-f7713b392e5a', spUUID='00000000-0000-0000-0000-000000000000', imgUUID='e3449f52-b227-4666-a4d5-9fdc56f000ce', leafUUID='04f6b652-5e14-40d8-973c-ca384ffc0c50')

Comment 4 Jiri Moskovcak 2014-08-14 07:33:25 UTC
(In reply to Federico Simoncelli from comment #3)
> The request fails because you're not connected to a pool. To prepare an
> image when you're not connected to a pool (general HE use case) you should
> specify a blank pool uuid (00000000-0000-0000-0000-000000000000). E.g.:
> 
> prepareImage(sdUUID='3498465f-eb04-49f3-81d2-f7713b392e5a',
> spUUID='00000000-0000-0000-0000-000000000000',
> imgUUID='e3449f52-b227-4666-a4d5-9fdc56f000ce',
> leafUUID='04f6b652-5e14-40d8-973c-ca384ffc0c50')

- thanks for the hint, going to try that, btw, I'm pretty sure it used to work back in May when we start using vdsm api for storage creation.

Comment 5 Jiri Moskovcak 2014-08-14 07:47:59 UTC
btw, does the same apply for getVolumePath ?

Comment 6 Jiri Moskovcak 2014-08-14 08:06:09 UTC
This is what I get if I use blank pool:

Thread-199::ERROR::2014-08-14 10:04:35,846::task::866::Storage.TaskManager.Task::(_setError) Task=`95689457-eec0-405c-8d0c-3f81e2556121`::Unexpected error
Traceback (most recent call last):
  File "/usr/share/vdsm/storage/task.py", line 873, in _run
    return fn(*args, **kargs)
  File "/usr/share/vdsm/logUtils.py", line 45, in wrapper
    res = f(*args, **kwargs)
  File "/usr/share/vdsm/storage/hsm.py", line 3237, in prepareImage
    return {'path': leafPath, 'info': leafInfo,
UnboundLocalError: local variable 'leafInfo' referenced before assignment

Comment 7 Federico Simoncelli 2014-08-18 08:21:23 UTC
(In reply to Jiri Moskovcak from comment #6)
> This is what I get if I use blank pool:
> 
> Thread-199::ERROR::2014-08-14
> 10:04:35,846::task::866::Storage.TaskManager.Task::(_setError)
> Task=`95689457-eec0-405c-8d0c-3f81e2556121`::Unexpected error
> Traceback (most recent call last):
>   File "/usr/share/vdsm/storage/task.py", line 873, in _run
>     return fn(*args, **kargs)
>   File "/usr/share/vdsm/logUtils.py", line 45, in wrapper
>     res = f(*args, **kwargs)
>   File "/usr/share/vdsm/storage/hsm.py", line 3237, in prepareImage
>     return {'path': leafPath, 'info': leafInfo,
> UnboundLocalError: local variable 'leafInfo' referenced before assignment

You haven't attached any log

Comment 8 Jiri Moskovcak 2014-08-20 15:06:56 UTC
Created attachment 928864 [details]
logs and test

Comment 9 Sandro Bonazzola 2014-10-17 12:28:57 UTC
oVirt 3.5 has been released and should include the fix for this issue.

Comment 10 Nikolai Sednev 2015-02-17 11:23:24 UTC
Works for me.