示例#1
0
// CreateSnapshot creates a pool wide snapshot.
func (pool *Pool) CreatePoolSnapshot(snapshotName string) error {
	name := C.CString(snapshotName)
	defer freeString(name)
	ret := C.rados_ioctx_snap_create(pool.context, name)
	if err := toRadosError(ret); err != nil {
		err.Message = fmt.Sprintf("Unable to create snapshot %s", snapshotName)
		return err
	}
	return nil
}
示例#2
0
func (r *RadosIoCtx) SnapCreate(snapname string) error {
	csnapname := C.CString(snapname)
	defer func() {
		C.free(unsafe.Pointer(csnapname))
	}()
	cerr := C.rados_ioctx_snap_create(*r.ctx, csnapname)
	if cerr < 0 {
		return errors.New("create snap failed")
	}

	return nil
}