qga-vss: Misc cleanup
cover qga-vss: Misc cleanup
Kostiantyn Kostiuk (2):
qga-vss: Replace asserts with condition and report error
qga-vss: Remove unused dependencies
qga/vss-win32/meson.build | 4 +--- qga/vss-win32/requester.cpp | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-)
Signature · 1 line
2.50.1
PATCH 1/2 qga-vss: Replace asserts with condition and report error
Signed-off-by Kostiantyn Kostiuk <[email protected]>
--- qga/vss-win32/requester.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
qga/vss-win32/requester.cpp +16 -3
@@ -347,7 +347,12 @@ void requester_freeze(int *num_vols, void *mountpoints, ErrorSet *errset) goto out; } - assert(pCreateVssBackupComponents != NULL); + if (!pCreateVssBackupComponents) { + err_set(errset, (HRESULT)ERROR_PROC_NOT_FOUND, + "CreateVssBackupComponents proc address absent. Did you call requester_init()?"); + goto out; + } + hr = pCreateVssBackupComponents(&vss_ctx.pVssbc); if (FAILED(hr)) { err_set(errset, hr, "failed to create VSS backup components");
@@ -579,8 +584,16 @@ void requester_thaw(int *num_vols, void *mountpints, ErrorSet *errset) /* Tell the provider that the snapshot is finished. */ SetEvent(vss_ctx.hEventThaw); - assert(vss_ctx.pVssbc); - assert(vss_ctx.pAsyncSnapshot); + if (!vss_ctx.pVssbc) { + err_set(errset, (HRESULT)VSS_E_BAD_STATE, + "CreateVssBackupComponents is missing. Did you freeze the volumes?"); + return; + } + if (!vss_ctx.pAsyncSnapshot) { + err_set(errset, (HRESULT)VSS_E_BAD_STATE, + "AsyncSnapshot set is missing. Did you freeze the volumes?"); + return; + } HRESULT hr = WaitForAsync(vss_ctx.pAsyncSnapshot); switch (hr) {
Signature · 1 line
2.50.1
Re: [PATCH 1/2] qga-vss: Replace asserts with condition and report error
Quoted 44 lines · Kostiantyn Kostiuk
Signed-off-by Kostiantyn Kostiuk <[email protected]>--- qga/vss-win32/requester.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)qga/vss-win32/requester.cpp +16
-4@@ -347,7 +347,12 @@ void requester_freeze(int *num_vols, void *mountpoints, ErrorSet *errset) goto out; } - assert(pCreateVssBackupComponents != NULL); + if (!pCreateVssBackupComponents) { + err_set(errset, (HRESULT)ERROR_PROC_NOT_FOUND, + "CreateVssBackupComponents proc address absent. Did you call requester_init()?"); + goto out; + } + hr = pCreateVssBackupComponents(&vss_ctx.pVssbc); if (FAILED(hr)) { err_set(errset, hr, "failed to create VSS backup components");@@ -579,8 +584,16 @@ void requester_thaw(int *num_vols, void *mountpints, ErrorSet *errset) /* Tell the provider that the snapshot is finished. */ SetEvent(vss_ctx.hEventThaw); - assert(vss_ctx.pVssbc); - assert(vss_ctx.pAsyncSnapshot); + if (!vss_ctx.pVssbc) { + err_set(errset, (HRESULT)VSS_E_BAD_STATE, + "CreateVssBackupComponents is missing. Did you freeze the volumes?"); + return; + } + if (!vss_ctx.pAsyncSnapshot) { + err_set(errset, (HRESULT)VSS_E_BAD_STATE, + "AsyncSnapshot set is missing. Did you freeze the volumes?"); + return; + } HRESULT hr = WaitForAsync(vss_ctx.pAsyncSnapshot); switch (hr) { --
Quoted 2 lines
2.50.1
Reviewed-by Yan Vugenfirer <[email protected]>
PATCH 2/2 qga-vss: Remove unused dependencies
In reply to Kostiantyn KostiukSigned-off-by Kostiantyn Kostiuk <[email protected]>
--- qga/vss-win32/meson.build | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
qga/vss-win32/meson.build +1 -3
@@ -13,13 +13,11 @@ qga_vss = shared_module( link_args: link_args, vs_module_defs: 'qga-vss.def', dependencies: [ - glib, socket, cc.find_library('ole32'), cc.find_library('oleaut32'), cc.find_library('shlwapi'), - cc.find_library('uuid'), - cc.find_library('intl') + cc.find_library('uuid') ] )
Signature · 1 line
2.50.1
Re: [PATCH 2/2] qga-vss: Remove unused dependencies
Quoted 26 lines · Kostiantyn Kostiuk
Signed-off-by Kostiantyn Kostiuk <[email protected]>--- qga/vss-win32/meson.build | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)qga/vss-win32/meson.build +1
-4@@ -13,13 +13,11 @@ qga_vss = shared_module( link_args: link_args, vs_module_defs: 'qga-vss.def', dependencies: [ - glib, socket, cc.find_library('ole32'), cc.find_library('oleaut32'), cc.find_library('shlwapi'), - cc.find_library('uuid'), - cc.find_library('intl') + cc.find_library('uuid') ] ) --
Quoted 2 lines
2.50.1
Reviewed-by Yan Vugenfirer <[email protected]>