Hi Patrick,

when you clone, you clone from a snapshot. This snapshot must be protected and 
above all, you RBD image must be format 2.

Are all of these elements true?

JC



On Mar 28, 2014, at 09:30, COPINE Patrick <patrick.cop...@gmail.com> wrote:

> Hi,
> 
> I would like create a clone with a Python code, but I have a syntax error. In 
> first, I have created an image (type 2), and after a snapshot. The code is 
> here. 
> 
> Best regards,
> 
> root@ceph-clt:~/src# cat v4.py
> 
> # -*- coding:utf-8 -*-
> 
> import rbd
> 
> import rados
> 
> 
> 
> FCONF='/etc/ceph/ceph.conf'
> 
> POOL='rbd'
> 
> 
> 
> try:
> 
>   # connexion au cluster
> 
>   cluster = rados.Rados(conffile=FCONF)
> 
>   cluster.connect()
> 
> 
> 
>   # utilisation du pool 'rbd'
> 
>   p_ioctx = cluster.open_ioctx(POOL)
> 
>   c_ioctx = cluster.open_ioctx(POOL)
> 
> 
> 
>   try:
> 
>     # instanciation d'un objet de type 'rbd' pour cloner l'image
> 
>     rbd_inst = rbd.RBD()
> 
> 
> 
>     # création du clone "c1-foo3
> 
>     rbd_inst.clone(p_ioctx, 'foo3', 's1-foo3', c_ioctx, 'c1-foo3') 
> 
> 
> 
>   finally:
> 
>     p_ioctx.close()
> 
>     c_ioctx.close()
> 
> finally:
> 
>   cluster.shutdown()
> 
> 
> root@ceph-clt:~/src# python v4.py
> 
> Traceback (most recent call last):
> 
>   File "v4.py", line 22, in <module>
> 
>     rbd_inst.clone(p_ioctx, 'foo3', 's1-foo3', c_ioctx, 'c1-foo3', 0, 0) 
> 
>   File "/usr/lib/python2.7/dist-packages/rbd.py", line 239, in clone
> 
>     raise make_ex(ret, 'error creating clone')
> 
> rbd.InvalidArgument: error creating clone
> 
> 
> 
> 
> Patrick COPINE (tél: +33680117101, +33652566319)
> _______________________________________________
> ceph-users mailing list
> ceph-users@lists.ceph.com
> http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com

_______________________________________________
ceph-users mailing list
ceph-users@lists.ceph.com
http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com

Reply via email to