rbd: strict_strtoll: garbage at end of string. got: '10G'错误

笔者在使用ceph做块存储应用时,让KVM虚拟机中虚拟的硬盘使用ceph存储,ceph搭建步骤不再累赘,本文主要是做一个错误解决的记录过程。

在客户机安装好ceph客户端环境,软件包为ceph-common,命令正常安装,软件可以。但笔者在为虚拟机创建磁盘镜像时,报了以下错误:

➜  ~ rbd  create  vm2-image  --image-feature  layering --size  10G
rbd: strict_strtoll: garbage at end of string. got: '10G'

第一时间在网上查阅资料,并没有找到相关的解决方案,在这种情况下,只能尝试着自己找出问题所在了。

查看ceph-common软件的安装过程历史:

➜  ~ yum -y install ceph-common           
已加载插件:fastestmirror, langpacks
base                                               | 3.6 kB     00:00     
elrepo                                             | 2.9 kB     00:00     
epel/x86_64/metalink                               | 6.2 kB     00:00     
epel                                               | 3.2 kB     00:00     
extras                                             | 3.4 kB     00:00     
rhel7                                              | 4.1 kB     00:00     
updates                                            | 3.4 kB     00:00     
(1/2): epel/x86_64/updateinfo                        | 932 kB   00:01     
(2/2): epel/x86_64/primary                           | 3.5 MB   00:02     
Loading mirror speeds from cached hostfile
 * elrepo: repos.lax-noc.com
 * epel: mirrors.sohu.com
epel                                                          12587/12587
正在解决依赖关系
--> 正在检查事务
---> 软件包 ceph-common.x86_64.1.0.94.5-2.el7 将被 安装
--> 正在处理依赖关系 python-rbd = 1:0.94.5-2.el7,它被软件包 1:ceph-common-0.94.5-2.el7.x86_64 需要
--> 正在处理依赖关系 python-rados = 1:0.94.5-2.el7,它被软件包 1:ceph-common-0.94.5-2.el7.x86_64 需要
--> 正在处理依赖关系 hdparm,它被软件包 1:ceph-common-0.94.5-2.el7.x86_64 需要
--> 正在检查事务
---> 软件包 hdparm.x86_64.0.9.43-5.el7 将被 安装
---> 软件包 python-rados.x86_64.1.0.94.5-2.el7 将被 安装
---> 软件包 python-rbd.x86_64.1.0.94.5-2.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

==========================================================================
 Package            架构         版本                    源          大小
==========================================================================
正在安装:
 ceph-common        x86_64       1:0.94.5-2.el7          base       6.2 M
为依赖而安装:
 hdparm             x86_64       9.43-5.el7              base        83 k
 python-rados       x86_64       1:0.94.5-2.el7          base        39 k
 python-rbd         x86_64       1:0.94.5-2.el7          base        29 k

事务概要
==========================================================================
安装  1 软件包 (+3 依赖软件包)

总下载量:6.3 M
安装大小:25 M
Downloading packages:
(1/4): hdparm-9.43-5.el7.x86_64.rpm                  |  83 kB   00:00     
(2/4): python-rados-0.94.5-2.el7.x86_64.rpm          |  39 kB   00:00     
(3/4): python-rbd-0.94.5-2.el7.x86_64.rpm            |  29 kB   00:00     
(4/4): ceph-common-0.94.5-2.el7.x86_64.rpm           | 6.2 MB   00:00     
--------------------------------------------------------------------------
总计                                         6.3 MB/s | 6.3 MB  00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : 1:python-rados-0.94.5-2.el7.x86_64                    1/4 
  正在安装    : 1:python-rbd-0.94.5-2.el7.x86_64                      2/4 
  正在安装    : hdparm-9.43-5.el7.x86_64                              3/4 
  正在安装    : 1:ceph-common-0.94.5-2.el7.x86_64                     4/4 
  验证中      : 1:python-rbd-0.94.5-2.el7.x86_64                      1/4 
  验证中      : 1:python-rados-0.94.5-2.el7.x86_64                    2/4 
  验证中      : 1:ceph-common-0.94.5-2.el7.x86_64                     3/4 
  验证中      : hdparm-9.43-5.el7.x86_64                              4/4 

已安装:
  ceph-common.x86_64 1:0.94.5-2.el7                                       

作为依赖被安装:
  hdparm.x86_64 0:9.43-5.el7         python-rados.x86_64 1:0.94.5-2.el7  
  python-rbd.x86_64 1:0.94.5-2.el7  
完毕!

再查看ceph-common版本:

➜  ~ yum info ceph-common
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * elrepo: repos.lax-noc.com
 * epel: mirrors.sohu.com
已安装的软件包
名称    :ceph-common
架构    :x86_64
时期       :1
版本    :0.94.5
发布    :2.el7
大小    :24 M
源    :installed
来自源:base
简介    : Ceph Common
网址    :http://ceph.com/
协议    : GPLv2
描述    : Common utilities to mount and interact with a ceph storage
         : cluster.

发现ceph-common软件版本为0.94.5,我在另一台使用正常的ceph客户机上查看ceph-common版本:

➜  ~ yum info ceph-common                                          
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * elrepo: repos.lax-noc.com
 * epel: mirrors.tongji.edu.cn
已安装的软件包
名称    :ceph-common
架构    :x86_64
时期       :1
版本    :10.2.2
发布    :38.el7cp
大小    :57 M
源    :installed
来自源:Tools
简介    : Ceph Common
网址    :http://ceph.com/
协议    : LGPL-2.1 and CC-BY-SA-1.0 and GPL-2.0 and BSL-1.0 and
         : GPL-2.0-with-autoconf-exception and BSD-3-Clause and MIT
描述    : Common utilities to mount and interact with a ceph storage
         : cluster. Comprised of files that are common to Ceph clients and
         : servers.

使用正常的客户机的ceph-common版本是10.2.2
找到问题所在了。
笔者把旧版本的ceph-common卸载:

➜  ~ yum -y remove ceph-common.x86_64

但是再安装时还是装成旧版本的。

在网络下载一个高版本的rpm包,笔者这里下载的时10.2.2版本的包:
ceph-10.2.2-0.el7.x86_64.rpm

➜  ~  wget http://mirrors.aliyun.com/ceph/rpm-jewel/el7/x86_64/ceph-10.2.2-0.el7.x86_64.rpm

使用yum安装(注意下载的ceph-10.2.2-0.el7.x86_64.rpm 需要在当前目录才能这样使用yum安装),但是有三个依赖包是rhel7.4镜像里面没有的

➜  ~ yum -y install ceph-10.2.2-0.el7.x86_64.rpm
……
错误:软件包:1:ceph-10.2.2-0.el7.x86_64 (/ceph-10.2.2-0.el7.x86_64)
          需要:ceph-mon = 1:10.2.2-0.el7
错误:软件包:1:ceph-10.2.2-0.el7.x86_64 (/ceph-10.2.2-0.el7.x86_64)
          需要:ceph-mds = 1:10.2.2-0.el7
错误:软件包:1:ceph-10.2.2-0.el7.x86_64 (/ceph-10.2.2-0.el7.x86_64)
          需要:ceph-osd = 1:10.2.2-0.el7
……

需要挂载rhcs镜像,搭建镜像源

➜  ~ mount rhcs2.0-rhosp9-20161113-x86_64.iso /myrhcs
mount: /dev/loop1 写保护,将以只读方式挂载
➜  ~ cat /etc/yum.repos.d/rhcs.repo 
[mon]
name=mon
baseurl=file:///myrhcs/rhceph-2.0-rhel-7-x86_64/MON
enable=1
gpgcheck=0

[osd]
name=osd
baseurl=file:///myrhcs/rhceph-2.0-rhel-7-x86_64/OSD
enable=1
gpgcheck=0


[Tools]
name=Tools
baseurl=file:///myrhcs/rhceph-2.0-rhel-7-x86_64/Tools
enable=1
gpgcheck=0

检查yum源

➜  ~ yum repolist
……     
Loading mirror speeds from cached hostfile
源标识     源名称     状态
Tools       Tools       33
mon         mon         41
osd         osd         28
!rhel7      dvd         4,986
repolist: 5,088

再安装软件包ceph-10.2.2-0.el7.x86_64.rpm

➜  ~ yum -y install ceph-10.2.2-0.el7.x86_64.rpm
……
正在检查 ceph-10.2.2-0.el7.x86_64.rpm: 1:ceph-10.2.2-0.el7.x86_64
ceph-10.2.2-0.el7.x86_64.rpm 将被安装
正在解决依赖关系
--> 正在检查事务
---> 软件包 ceph.x86_64.1.10.2.2-0.el7 将被 安装
--> 正在处理依赖关系 ceph-osd = 1:10.2.2-0.el7,它被软件包 1:ceph-10.2.2-0.el7.x86_64 需要
file:///mydvd/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /mydvd/repodata/repomd.xml"
正在尝试其它镜像。
Loading mirror speeds from cached hostfile
--> 正在处理依赖关系 ceph-mds = 1:10.2.2-0.el7,它被软件包 1:ceph-10.2.2-0.el7.x86_64 需要
--> 正在处理依赖关系 ceph-mon = 1:10.2.2-0.el7,它被软件包 1:ceph-10.2.2-0.el7.x86_64 需要
--> 解决依赖关系完成
错误:软件包:1:ceph-10.2.2-0.el7.x86_64 (/ceph-10.2.2-0.el7.x86_64)
          需要:ceph-mds = 1:10.2.2-0.el7
          可用: 1:ceph-mds-10.2.2-38.el7cp.x86_64 (Tools)
              ceph-mds = 1:10.2.2-38.el7cp
错误:软件包:1:ceph-10.2.2-0.el7.x86_64 (/ceph-10.2.2-0.el7.x86_64)
          需要:ceph-mon = 1:10.2.2-0.el7
          可用: 1:ceph-mon-10.2.2-38.el7cp.x86_64 (mon)
              ceph-mon = 1:10.2.2-38.el7cp
错误:软件包:1:ceph-10.2.2-0.el7.x86_64 (/ceph-10.2.2-0.el7.x86_64)
          需要:ceph-osd = 1:10.2.2-0.el7
          可用: 1:ceph-osd-10.2.2-38.el7cp.x86_64 (osd)
              ceph-osd = 1:10.2.2-38.el7cp
 您可以尝试添加 --skip-broken 选项来解决该问题

安装过程中会显示一些错误信息,但是笔者在后面的使用中发现并不会造成什么影响,接下来查看ceph-common的软件信息:

➜  ~ yum info ceph-common                                          
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * elrepo: repos.lax-noc.com
 * epel: mirrors.tongji.edu.cn
已安装的软件包
名称    :ceph-common
架构    :x86_64
时期       :1
版本    :10.2.2
发布    :38.el7cp
大小    :57 M
源    :installed
来自源:Tools
简介    : Ceph Common
网址    :http://ceph.com/
协议    : LGPL-2.1 and CC-BY-SA-1.0 and GPL-2.0 and BSL-1.0 and
         : GPL-2.0-with-autoconf-exception and BSD-3-Clause and MIT
描述    : Common utilities to mount and interact with a ceph storage
         : cluster. Comprised of files that are common to Ceph clients and
         : servers.

回到开头,创建磁盘镜像:

➜  ~ rbd  create  vm1-image  --image-feature  layering --size  10G
➜  ~ rbd list
demo-image
vm1-image

rbd: strict_strtoll: garbage at end of string. got: ‘10G’错误不再显示,问题解决。

猜你喜欢

转载自blog.csdn.net/bacteriumx/article/details/80775244
rbd