This patch solves the problem below:
./bin/ceph osd crush move osd.0 root=foo rack=foo-rack host=foo-host
moved item id 0 name 'osd.0' to location {host=foo-host,rack=foo-rack,root=foo} in crush map
./bin/ceph osd crush rule create-replicated foo-rule foo host ssd
Error EINVAL: root foo has no devices with class ssd
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
if [ "$out" == "" ]; then
return 1
fi
+
+ ceph osd crush rule create-replicated foo-rule foo host abc || return 1
}
main crush-classes "$@"
ldout(cct, 5) << "insert_item max_devices now " << crush->max_devices
<< dendl;
}
+ r = rebuild_roots_with_classes();
+ if (r < 0) {
+ ldout(cct, 0) << __func__ << " unable to rebuild roots with classes: "
+ << cpp_strerror(r) << dendl;
+ return r;
+ }
return 0;
}