[libvirt] [PATCH] vz: fix disk enumeration

If we want to delete all disks for container or vm we should make a loop from 0 to NumberOfDisks and always use zero index in PrlVmCfg_GetHardDisk to get disk handle. When we delete first disk after that numbers of other disks will be changed, start from 0 to NumberOfDisks-1. That's why we should always use zero index. --- src/vz/vz_sdk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c index 8cc8430..70d61e5 100644 --- a/src/vz/vz_sdk.c +++ b/src/vz/vz_sdk.c @@ -3810,7 +3810,7 @@ prlsdkDetachDomainHardDisks(PRL_HANDLE sdkdom) prlsdkCheckRetGoto(pret, cleanup); for (i = 0; i < hddCount; ++i) { - pret = PrlVmCfg_GetHardDisk(sdkdom, i, &sdkdisk); + pret = PrlVmCfg_GetHardDisk(sdkdom, 0, &sdkdisk); prlsdkCheckRetGoto(pret, cleanup); pret = PrlVmDev_Remove(sdkdisk); -- 1.8.3.1

On 27.04.2016 18:37, Mikhail Feoktistov wrote:
If we want to delete all disks for container or vm we should make a loop from 0 to NumberOfDisks and always use zero index in PrlVmCfg_GetHardDisk to get disk handle. When we delete first disk after that numbers of other disks will be changed, start from 0 to NumberOfDisks-1. That's why we should always use zero index. --- src/vz/vz_sdk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c index 8cc8430..70d61e5 100644 --- a/src/vz/vz_sdk.c +++ b/src/vz/vz_sdk.c @@ -3810,7 +3810,7 @@ prlsdkDetachDomainHardDisks(PRL_HANDLE sdkdom) prlsdkCheckRetGoto(pret, cleanup);
for (i = 0; i < hddCount; ++i) { - pret = PrlVmCfg_GetHardDisk(sdkdom, i, &sdkdisk); + pret = PrlVmCfg_GetHardDisk(sdkdom, 0, &sdkdisk); prlsdkCheckRetGoto(pret, cleanup);
pret = PrlVmDev_Remove(sdkdisk);
ACK

On Thu, Apr 28, 2016 at 10:20:58 +0300, Nikolay Shirokovskiy wrote:
On 27.04.2016 18:37, Mikhail Feoktistov wrote:
If we want to delete all disks for container or vm we should make a loop from 0 to NumberOfDisks and always use zero index in PrlVmCfg_GetHardDisk to get disk handle. When we delete first disk after that numbers of other disks will be changed, start from 0 to NumberOfDisks-1. That's why we should always use zero index. --- src/vz/vz_sdk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c index 8cc8430..70d61e5 100644 --- a/src/vz/vz_sdk.c +++ b/src/vz/vz_sdk.c @@ -3810,7 +3810,7 @@ prlsdkDetachDomainHardDisks(PRL_HANDLE sdkdom) prlsdkCheckRetGoto(pret, cleanup);
for (i = 0; i < hddCount; ++i) { - pret = PrlVmCfg_GetHardDisk(sdkdom, i, &sdkdisk); + pret = PrlVmCfg_GetHardDisk(sdkdom, 0, &sdkdisk); prlsdkCheckRetGoto(pret, cleanup);
pret = PrlVmDev_Remove(sdkdisk);
ACK
And pushed now. Jirka
participants (3)
-
Jiri Denemark
-
Mikhail Feoktistov
-
Nikolay Shirokovskiy