The EntityName ctor leaves type == 0. If we encode and
then decode that value, we end up calling set(), which
tries (and fails) to populate the type_id string, leaving
you with an instance that renders as 'unknown.' instead
of ''.
Signed-off-by: Sage Weil <sage@redhat.com>
type = type_;
id = id_;
- std::ostringstream oss;
- oss << ceph_entity_type_name(type_) << "." << id_;
- type_id = oss.str();
+ if (type) {
+ std::ostringstream oss;
+ oss << ceph_entity_type_name(type_) << "." << id_;
+ type_id = oss.str();
+ } else {
+ type_id.clear();
+ }
}
int EntityName::