提交 29439964 编写于 作者: N Nikolay Shirokovskiy 提交者: Maxim Nestratov

vz: fix boot check to use new disk id

Current implementation does not detect all incompatible configurations.
For example if we have in vzsdk bootorder "cdrom1, cdrom0" (that is
"hdb, hda" in case of ide cdroms) and cdroms do not have disk
images inserted. In this case boot order check code fails to
distiguish them at all as for both PrlVmDev_GetFriendlyName gives "".
Well the consequences are only missing warnings but as
we just have introduced all the necessary tools to face the problem -
let's fix it.
Signed-off-by: NNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
上级 c7ba6200
......@@ -1309,10 +1309,11 @@ prlsdkBootOrderCheck(PRL_HANDLE sdkdom, PRL_DEVICE_TYPE sdkType, int sdkIndex,
virDomainDefPtr def, int bootIndex)
{
char *sdkName = NULL;
const char *bootName;
PRL_HANDLE dev = PRL_INVALID_HANDLE;
virDomainDiskDefPtr disk;
virDomainDiskDevice device;
int bus;
char *dst = NULL;
int ret = -1;
dev = prlsdkGetDevByDevIndex(sdkdom, sdkType, sdkIndex);
......@@ -1326,9 +1327,6 @@ prlsdkBootOrderCheck(PRL_HANDLE sdkdom, PRL_DEVICE_TYPE sdkType, int sdkIndex,
switch (sdkType) {
case PDE_OPTICAL_DISK:
case PDE_HARD_DISK:
if (!(sdkName = prlsdkGetStringParamVar(PrlVmDev_GetFriendlyName, dev)))
goto cleanup;
switch (sdkType) {
case PDE_OPTICAL_DISK:
device = VIR_DOMAIN_DISK_DEVICE_CDROM;
......@@ -1349,7 +1347,11 @@ prlsdkBootOrderCheck(PRL_HANDLE sdkdom, PRL_DEVICE_TYPE sdkType, int sdkIndex,
goto cleanup;
}
bootName = disk->src->path;
if (prlsdkGetDiskId(dev, false, &bus, &dst) < 0)
goto cleanup;
if (!(bus == disk->bus && STREQ(disk->dst, dst)))
VIR_WARN("Unrepresentable boot order configuration");
break;
case PDE_GENERIC_NETWORK_ADAPTER:
......@@ -1364,7 +1366,8 @@ prlsdkBootOrderCheck(PRL_HANDLE sdkdom, PRL_DEVICE_TYPE sdkType, int sdkIndex,
goto cleanup;
}
bootName = def->nets[bootIndex]->ifname;
if (STRNEQ(sdkName, def->nets[bootIndex]->ifname))
VIR_WARN("Unrepresentable boot order configuration");
break;
default:
......@@ -1373,15 +1376,13 @@ prlsdkBootOrderCheck(PRL_HANDLE sdkdom, PRL_DEVICE_TYPE sdkType, int sdkIndex,
goto cleanup;
}
if (STRNEQ(sdkName, bootName))
VIR_WARN("Unrepresentable boot order configuration");
ret = 0;
cleanup:
VIR_FREE(sdkName);
PrlHandle_Free(dev);
VIR_FREE(dst);
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册