aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
Diffstat (limited to 'block.c')
-rw-r--r--block.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/block.c b/block.c
index ba2aecf87a..8f718f9f29 100644
--- a/block.c
+++ b/block.c
@@ -796,6 +796,13 @@ static int bdrv_assign_node_name(BlockDriverState *bs,
return -EINVAL;
}
+ /* takes care of avoiding namespaces collisions */
+ if (bdrv_find(node_name)) {
+ error_setg(errp, "node-name=%s is conflicting with a device id",
+ node_name);
+ return -EINVAL;
+ }
+
/* takes care of avoiding duplicates node names */
if (bdrv_find_node(node_name)) {
error_setg(errp, "Duplicate node name");
@@ -977,9 +984,8 @@ int bdrv_file_open(BlockDriverState **pbs, const char *filename,
}
QDECREF(options);
- bs = bdrv_find(reference);
+ bs = bdrv_lookup_bs(reference, reference, errp);
if (!bs) {
- error_setg(errp, "Cannot find block device '%s'", reference);
return -ENODEV;
}
bdrv_ref(bs);