Bug #1025

oneimage create should fail if file not readable

Added by Ilkka Tengvall over 9 years ago. Updated over 9 years ago.

Status:ClosedStart date:12/12/2011
Priority:NormalDue date:
Assignee:Ruben S. Montero% Done:

0%

Category:-
Target version:-
Resolution:worksforme Pull request:
Affected Versions:OpenNebula 3.2

Description

I installed OpenNebula (git head) and started adding an OS image. I didn't notice that iscsi device had 660 rights for root.disk. which opennebula is not part of. Thus it could not read the image from device. oneimage list still shows it:

------------------------------------
[oneadmin@onebula ~]$ oneimage list
ID USER GROUP NAME SIZE TYPE REGTIME PUB PER STAT RVMS
0 oneadmin oneadmin ipxe-london 0M CD 12/09 17:26:41 Yes No rdy 0
1 oneadmin oneadmin f16-minimal 0M OS 12/09 17:30:05 Yes No err 0
------------------------------------

but does not allow to remove it:

------------------------------------
[oneadmin@onebula ~]$ oneimage delete f16-minimal
[ImageInfo] Error getting image [1].
------------------------------------

So there is two checks to be added:

  1. oneimage create: check if image is readable before adding it into db
  2. oneimage delete: remove the image from db even though the image doesn't exist on disk.

The sunstone doesn't either get rid of it.

History

#1 Updated by Ruben S. Montero over 9 years ago

  • Status changed from New to Closed
  • Assignee set to Ruben S. Montero
  • Resolution set to worksforme

Hi,

I can not reproduce this one. My template is

> cat img
NAME=test
PATH=/etc/shadow

then I register the image, and it fails as:

> oneimage list
  ID USER     GROUP    NAME            SIZE TYPE          REGTIME PUB PER STAT  RVMS
   2 ruben    oneadmin test              0M   OS   12/13 11:35:12  No  No  err     0

The error is shown in the image

> oneimage show 2
IMAGE 2 INFORMATION                                                             
ID             : 2                   
NAME           : test                
USER           : ruben               
GROUP          : oneadmin            
TYPE           : OS                  
REGISTER TIME  : 12/13 11:35:12      
PUBLIC         : No                  
PERSISTENT     : No                  
SOURCE         :                     
PATH           : /etc/shadow         
SIZE           : 0                   
STATE          : err                 
RUNNING_VMS    : 0                   

IMAGE TEMPLATE                                                                  
DEV_PREFIX=hd
ERROR=[
  MESSAGE="Error copying image in the repository: Error copying /etc/shadow to /home/ruben/one_test/var/images/aeda78f0337b6366244a1f593a35bbc8",
  TIMESTAMP="Tue Dec 13 11:35:12 2011" ]

I can delete the image


> oneimage delete 2

> oneimage list
  ID USER     GROUP    NAME            SIZE TYPE          REGTIME PUB PER STAT  RVMS

I am closing this one. Maybe you can post your image template file... or oned.log files o check where the error could be.

#2 Updated by Ilkka Tengvall over 9 years ago

my image was a iscsi target, so a block device, not file. I noticed now that iscsi disks can not be given as a disk for the guest in OpenNebula, which I didn't understand at the time I added the disk to oned. Nevertheless, I can't delete it from my db via oneimage.

#3 Updated by Ilkka Tengvall over 9 years ago

[oneadmin@onebula ~]$ oneimage list
ID USER GROUP NAME SIZE TYPE REGTIME PUB PER STAT RVMS
0 oneadmin oneadmin ipxe-london 0M CD 12/09 17:26:41 Yes No rdy 0
1 oneadmin oneadmin f16-minimal 0M OS 12/09 17:30:05 Yes No err 0
2 oneadmin oneadmin f16-min 0M OS 12/12 08:29:05 Yes No err 0
3 oneadmin oneadmin f16-minimal. 0M OS 12/13 09:23:03 Yes No used 5
[oneadmin@onebula ~]$ oneimage show 1
IMAGE 1 INFORMATION
ID : 1
NAME : f16-minimal
USER : oneadmin
GROUP : oneadmin
TYPE : OS
REGISTER TIME : 12/09 17:30:05
PUBLIC : Yes
PERSISTENT : No
SOURCE : /dev/disk/by-path/ip-192.168.117.1:3260-iscsi-iqn.2009-02.net.nsn-net:whipper.f16-min-lun-0
SIZE : 0
STATE : err
RUNNING_VMS : 0

IMAGE TEMPLATE
BUS=virtio
DESCRIPTION="minimal fedora 16 x86_64 image"
DEV_PREFIX=hd
ERROR=[
MESSAGE="Error removing image from repository. Remove file /dev/disk/by-path/ip-192.168.117.1:3260-iscsi-iqn.2009-02.net.nsn-net:whipper.f16-min-lun-0 to completely delete image.: Error deleting /dev/disk/by-path/ip-192.168.117.1:3260-iscsi-iqn.2009-02.net.nsn-net:whipper.f16-min-lun-0",
TIMESTAMP="Mon Dec 12 07:56:56 2011" ]
NAME=f16-minimal
SOURCE=/dev/disk/by-path/ip-192.168.117.1:3260-iscsi-iqn.2009-02.net.nsn-net:whipper.f16-min-lun-0
TYPE=OS
[oneadmin@onebula ~]$ oneimage delete 1
[oneadmin@onebula ~]$ oneimage list
ID USER GROUP NAME SIZE TYPE REGTIME PUB PER STAT RVMS
0 oneadmin oneadmin ipxe-london 0M CD 12/09 17:26:41 Yes No rdy 0
1 oneadmin oneadmin f16-minimal 0M OS 12/09 17:30:05 Yes No err 0
2 oneadmin oneadmin f16-min 0M OS 12/12 08:29:05 Yes No err 0
3 oneadmin oneadmin f16-minimal. 0M OS 12/13 09:23:03 Yes No used 5

#4 Updated by Ruben S. Montero over 9 years ago

OK. Also, you should be able to use iSCSI block devices with DISK=[TYPE=block,SOURCE=<path_to_dev>....]. Anyway, any other hint to reproduce the error will be more than welcome.

Thanks!

Also available in: Atom PDF