提交 57297465 编写于 作者: N Nitesh Konkar 提交者: Michal Privoznik

Ensure disk names follow the disk name regex

Currently disk names do not follow the
(regex) /^[fhv]d[a-z]+[0-9]*$/ completely
and hence one can assign disk names like
vd2 etc. This patch ensures that the
disk names follow the regex mentioned.
This patch also adds a testcase.
Signed-off-by: NNitesh Konkar <nitkon12@linux.vnet.ibm.com>
上级 2dc1cf19
......@@ -563,7 +563,7 @@ int virDiskNameParse(const char *name, int *disk, int *partition)
}
}
if (!ptr)
if (!ptr || !c_islower(*ptr))
return -1;
for (i = 0; *ptr; i++) {
......
......@@ -37,7 +37,8 @@ static struct testDiskName diskNamesPart[] = {
};
static const char* diskNamesInvalid[] = {
"sda00", "sda01", "sdb-1"
"sda00", "sda01", "sdb-1",
"vd2"
};
static int
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册