Cannot create snapshot for CentOS7 guest

Hello,

I have Opennebula 4.12 on CentOS 7.1. I have installed from the Marketplace
CentOS 7 - KVM.

I am able to instantiate it and it runs fine. However, when I click on the running VM --> Snapshots --> Take snapshot, It doesn’t get created and in the log there is this:

Mon Apr 13 14:55:14 2015 [Z0][VMM][I]: Command execution fail: 'if [ -x "/var/tmp/one/vmm/kvm/snapshot_create" ]; then /var/tmp/one/vmm/kvm/snapshot_create one-13 0 13 localhost; else exit 42; fi'
Mon Apr 13 14:55:14 2015 [Z0][VMM][I]: Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
Mon Apr 13 14:55:14 2015 [Z0][VMM][I]: error: unsupported configuration: internal snapshot for disk hdb unsupported for storage type raw
Mon Apr 13 14:55:14 2015 [Z0][VMM][E]: Could not create snapshot for domain one-13.
Mon Apr 13 14:55:14 2015 [Z0][VMM][I]: ExitCode: 255
Mon Apr 13 14:55:14 2015 [Z0][VMM][E]: Error creating new VM Snapshot: Could not create snapshot for domain one-13.

Please, note that the image is from the Marketplace and is supposed to be qcow2, e.g. to support snapshots.
I tried both with the image set to “Persistent: no” and “Persistent: yes”.

What could be the problem?
Thanks!

I believe this is the main issue:

Mon Apr 13 14:55:14 2015 [Z0][VMM][I]: error: unsupported configuration: internal snapshot for disk hdb unsupported for storage type raw

Having a qcow2 image is better for snapshotting. Raw images can be cloned and such, but raw doesn’t support live snapshotting.

You can convert the raw image using the follwing steps:

  1. Bring down the VM

  2. Convert the image file from raw to qcow2:

    qemu-img convert -f raw raw_image_file -O qcow2 new_image_file.qcow

  3. You can check what type if image you have using this command:

    qemu-img info image_file

  4. You can now upload the new qcow image to OpenNebula using this command:

    oneimage create -d 127 --name New_CentOS_Image_qcow–type OS --driver qcow2 --fstype qcow2 --path new_image_file.qcow

    The -d points to your datastore.

  5. And last but not least, modify yout machine template (point to the new image file), make sure the template uses the qcow2 driver for the image, and after that you should be able to have a running VM again (but this time with snapshot capabilities).

Hope this helps.

You can check what type if image you have using this command:
qemu-img info image_file

Here is the output:

$ qemu-img info 79af5156fe8c870cbd0e7d5f49b331f9
image: 79af5156fe8c870cbd0e7d5f49b331f9
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: 1.5G
cluster_size: 65536
Format specific information:
    compat: 0.10

Please, note that the image is from the Marketplace and is supposed to be qcow2. See the attached screen shot.

Can you provide your image datastore configuration. There are DS_MAD drivers that convert images when importing to the datastore.

The configuration is default, but if there is something specific I need to provide, please, tell me how.

Run as oneadmin user:

$ onedatastore list
ID NAME SIZE AVAIL CLUSTER IMAGES TYPE DS TM STAT
0 system 100G 97% - 0 sys - shared on
1 default 100G 97% - 0 img fs shared on
2 files 100G 97% system-ssh-c 0 fil fs ssh on

By default the ‘img’ datastore is with id 1 and name ‘default’:

$ onedatastore show 1
DATASTORE 1 INFORMATION
ID : 1
NAME : default
USER : oneadmin
GROUP : oneadmin
CLUSTER : -
TYPE : IMAGE
DS_MAD : fs
TM_MAD : shared
BASE PATH : /var/lib/one//datastores/1
DISK_TYPE : FILE
STATE : READY

DATASTORE CAPACITY
TOTAL: : 100G
FREE: : 96.7G
USED: : 3.3G
LIMIT: : -

PERMISSIONS
OWNER : um-
GROUP : u–
OTHER : —

DATASTORE TEMPLATE
BASE_PATH="/var/lib/one//datastores/"
CLONE_TARGET="SYSTEM"
DISK_TYPE="FILE"
DS_MAD="fs"
LN_TARGET="NONE"
TM_MAD="shared"
TYPE=“IMAGE_DS”

IMAGES

It might then be a case of the template or image not properly being configured inside OpenNebula.

Template
Inside your template, in the storage tab for your OS image:

Driver: qcow2

Image
And modify your OS image in your datastore with these settings:

Filesystem type  qcow2
DRIVER           qcow2

(if not already present)

Hope this helps.

$ onedatastore list
  ID NAME                SIZE AVAIL CLUSTER      IMAGES TYPE DS      TM      STAT
   0 system              7.3T 99%   -                 0 sys  -       shared  on  
   1 default             7.3T 99%   -                 5 img  fs      shared  on  
   2 files               7.3T 99%   -                 0 fil  fs      ssh     on  

$ onedatastore show 1
DATASTORE 1 INFORMATION                                                         
ID             : 1                   
NAME           : default             
USER           : oneadmin            
GROUP          : oneadmin            
CLUSTER        : -                   
TYPE           : IMAGE               
DS_MAD         : fs                  
TM_MAD         : shared              
BASE PATH      : /var/lib/one//datastores/1
DISK_TYPE      : FILE                
STATE          : READY               

DATASTORE CAPACITY                                                              
TOTAL:         : 7.3T                
FREE:          : 7.2T                
USED:          : 58.5G               
LIMIT:         : -                   

PERMISSIONS                                                                     
OWNER          : um-                 
GROUP          : u--                 
OTHER          : ---                 

DATASTORE TEMPLATE                                                              
BASE_PATH="/var/lib/one//datastores/"
CLONE_TARGET="SYSTEM"
DISK_TYPE="FILE"
DS_MAD="fs"
LN_TARGET="NONE"
TM_MAD="shared"
TYPE="IMAGE_DS"

IMAGES         
0              
1              
3              
4              
5

Template
Inside your template, in the storage tab for your OS image:

Driver: qcow2

In the template the driver wasn’t specified. Now I specified it. Then I tried again to create a snapshot - still the same problem.

A question to the developers: Shouldn’t it be specified by default when you import it from the marketplace?

Is there a reason not to?

And modify your OS image in your datastore with these settings:

Filesystem type qcow2
DRIVER qcow2

The image has DRIVER qcow2, but Filesystem type is empty and I can’t find a way to change it.

Is the VM using anyother disk, (e.g. swap)? The original log refers to hdb. Probably hdb is not the main disk and it refers to other device? Note that all devices needs to be qcow2.

Yes, I added a volatile image for swap, utilizing the wonderful customization feature.

Then that’s the problem, AFAIK swap cannot be qcow2, and all the images
needs to be qcow2 for the snapshot to work. Try to use a swap file within
the main disk.

Ruben, you nailed it! Awesome, thank you, now it works. :slight_smile:

It’s a pity I can’t use volatile disk for swap because now I will have to inflate my main image with a couple of GB just for swap.