Skip to contentSkip to conversation

qemu-ga: Don't display errors to the user on thaw command

PATCH In review Sameeh Jubran 2 participants 4 messages Mar 21, 2017 – Apr 5, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu-ga: Don't display errors to the user on thaw command

Errors that are related to ur inner implementation for the thaw command shouldn't be displayed to the user.

---
 qga/vss-win32/requester.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
qga/vss-win32/requester.cpp +4 -4
index 0cd2f0e..272e71b 100644
@@ -463,7 +463,7 @@ void requester_thaw(int *num_vols, ErrorSet *errset)
             hr = WaitForAsync(pAsync);
         }
         if (FAILED(hr)) {
-            err_set(errset, hr, "failed to complete backup");
+            fprintf(stderr, "failed to complete backup");
         }
         break;
 
@@ -480,18 +480,18 @@ void requester_thaw(int *num_vols, ErrorSet *errset)
 
     case VSS_E_UNEXPECTED_PROVIDER_ERROR:
         if (WaitForSingleObject(vss_ctx.hEventTimeout, 0) != WAIT_OBJECT_0) {
-            err_set(errset, hr, "unexpected error in VSS provider");
+            fprintf(stderr, "unexpected error in VSS provider");
             break;
         }
         /* fall through if hEventTimeout is signaled */
 
     case (HRESULT)VSS_E_HOLD_WRITES_TIMEOUT:
-        err_set(errset, hr, "couldn't hold writes: "
+        fprintf(stderr, "couldn't hold writes: "
                 "fsfreeze is limited up to 10 seconds");
         break;
 
     default:
-        err_set(errset, hr, "failed to do snapshot set");
+        fprintf(stderr, "failed to do snapshot set");
     }
 
     if (err_is_set(errset)) {
Signature · 1 line
2.9.3
#1 lore raw

Ping.

Quoted 48 lines · Sameeh Jubran

Errors that are related to ur inner implementation for the thaw command shouldn't be displayed to the user.

---
 qga/vss-win32/requester.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
qga/vss-win32/requester.cpp +4 -4
index 0cd2f0e..272e71b 100644
@@ -463,7 +463,7 @@ void requester_thaw(int *num_vols, ErrorSet *errset)
             hr = WaitForAsync(pAsync);
         }
         if (FAILED(hr)) {
-            err_set(errset, hr, "failed to complete backup");
+            fprintf(stderr, "failed to complete backup");
         }
         break;
 
@@ -480,18 +480,18 @@ void requester_thaw(int *num_vols, ErrorSet *errset)
 
     case VSS_E_UNEXPECTED_PROVIDER_ERROR:
         if (WaitForSingleObject(vss_ctx.hEventTimeout, 0) !=
 WAIT_OBJECT_0) {
-            err_set(errset, hr, "unexpected error in VSS provider");
+            fprintf(stderr, "unexpected error in VSS provider");
             break;
         }
         /* fall through if hEventTimeout is signaled */
 
     case (HRESULT)VSS_E_HOLD_WRITES_TIMEOUT:
-        err_set(errset, hr, "couldn't hold writes: "
+        fprintf(stderr, "couldn't hold writes: "
                 "fsfreeze is limited up to 10 seconds");
         break;
 
     default:
-        err_set(errset, hr, "failed to do snapshot set");
+        fprintf(stderr, "failed to do snapshot set");
     }
 
     if (err_is_set(errset)) {

--
2.9.3

Signature · 4 lines
Respectfully,
*Sameeh Jubran*
*Linkedin <https://il.linkedin.com/pub/sameeh-jubran/87/747/a8a>*
*Software Engineer @ Daynix <http://www.daynix.com>.*
#2 lore raw
In reply to Sameeh Jubran

Quoting Sameeh Jubran (2017-03-21 09:14:35)

Quoted 13 lines

Errors that are related to ur inner implementation for the thaw command shouldn't be displayed to the user.

---
 qga/vss-win32/requester.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
qga/vss-win32/requester.cpp +0 -0
index 0cd2f0e..272e71b 100644

qga/vss-win32/requester.cpp void requester_thaw(int *num_vols, ErrorSet *errset) · line 466

Quoted 4 lines
qga/vss-win32/requester.cpp +0 -1
@@ -463,7 +463,7 @@ void requester_thaw(int *num_vols, ErrorSet *errset)
             hr = WaitForAsync(pAsync);
         }
         if (FAILED(hr)) {
-            err_set(errset, hr, "failed to complete backup");

We cannot do this. If the freeze operation didn't successfully maintain the frozen state for entire duration we *must* report an error to the user, otherwise users have no way to know that their snapshot might be completely corrupted. Well, I suppose they can look at guest-fsfreeze-thaw's return value and check that it matches the number of volumes that were originally frozen, but that aspect is intended as a sanity check to identify situations outside of qemu-ga's control, like another user/application unfreezing the filesystems before qemu-ga. This situation *is* within qemu-ga's control, and should be reported as an error. Same for the other failures below.

Quoted 29 lines
qga/vss-win32/requester.cpp +4 -3
+            fprintf(stderr, "failed to complete backup");
         }
         break;
 
@@ -480,18 +480,18 @@ void requester_thaw(int *num_vols, ErrorSet *errset)
 
     case VSS_E_UNEXPECTED_PROVIDER_ERROR:
         if (WaitForSingleObject(vss_ctx.hEventTimeout, 0) != WAIT_OBJECT_0) {
-            err_set(errset, hr, "unexpected error in VSS provider");
+            fprintf(stderr, "unexpected error in VSS provider");
             break;
         }
         /* fall through if hEventTimeout is signaled */
 
     case (HRESULT)VSS_E_HOLD_WRITES_TIMEOUT:
-        err_set(errset, hr, "couldn't hold writes: "
+        fprintf(stderr, "couldn't hold writes: "
                 "fsfreeze is limited up to 10 seconds");
         break;
 
     default:
-        err_set(errset, hr, "failed to do snapshot set");
+        fprintf(stderr, "failed to do snapshot set");
     }
 
     if (err_is_set(errset)) {
Signature · 1 line
2.9.3
#3 lore raw
Quoted 21 lines · Michael Roth

Quoting Sameeh Jubran (2017-03-21 09:14:35)

Quoted 13 lines

Errors that are related to ur inner implementation for the thaw command shouldn't be displayed to the user.

---
 qga/vss-win32/requester.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
qga/vss-win32/requester.cpp +0 -0
index 0cd2f0e..272e71b 100644

qga/vss-win32/requester.cpp void requester_thaw(int *num_vols, ErrorSet *errset) · line 466

Quoted 4 lines
qga/vss-win32/requester.cpp +0 -1
@@ -463,7 +463,7 @@ void requester_thaw(int *num_vols, ErrorSet *errset)
             hr = WaitForAsync(pAsync);
         }
         if (FAILED(hr)) {
-            err_set(errset, hr, "failed to complete backup");

We cannot do this. If the freeze operation didn't successfully maintain the frozen state for entire duration we *must* report an error to the

Quoted 8 lines

user, otherwise users have no way to know that their snapshot might be completely corrupted. Well, I suppose they can look at guest-fsfreeze-thaw's return value and check that it matches the number of volumes that were originally frozen, but that aspect is intended as a sanity check to identify situations outside of qemu-ga's control, like another user/application unfreezing the filesystems before qemu-ga. This situation *is* within qemu-ga's control, and should be reported as an error. Same for the other failures below.

This patch was introduced to hide the error "{"error": {"class":
"GenericError", "desc": "couldn't hold writes: fsfreeze is limited up to 10
seconds: "}" which shows up whenever we
execute thaw after 10 seconds have passed from freeze event and in order to align the behaviour Windows with Linux. However I agree with you about informing the user about possible
corruption during the backup operation.

Quoted 36 lines

qga/vss-win32/requester.cpp void requester_thaw(int *num_vols, ErrorSet

Quoted 8 lines
qga/vss-win32/requester.cpp +1 -0
+            fprintf(stderr, "failed to complete backup");
         }
         break;
 
@@ -480,18 +480,18 @@ void requester_thaw(int *num_vols, ErrorSet

*errset)

qga/vss-win32/requester.cpp void requester_thaw(int *num_vols, ErrorSet · line 481

Quoted 3 lines
qga/vss-win32/requester.cpp +0 -0
     case VSS_E_UNEXPECTED_PROVIDER_ERROR:
         if (WaitForSingleObject(vss_ctx.hEventTimeout, 0) !=

WAIT_OBJECT_0) {

Quoted 21 lines
qga/vss-win32/requester.cpp +3 -4
-            err_set(errset, hr, "unexpected error in VSS provider");
+            fprintf(stderr, "unexpected error in VSS provider");
             break;
         }
         /* fall through if hEventTimeout is signaled */
 
     case (HRESULT)VSS_E_HOLD_WRITES_TIMEOUT:
-        err_set(errset, hr, "couldn't hold writes: "
+        fprintf(stderr, "couldn't hold writes: "
                 "fsfreeze is limited up to 10 seconds");
         break;
 
     default:
-        err_set(errset, hr, "failed to do snapshot set");
+        fprintf(stderr, "failed to do snapshot set");
     }
 
     if (err_is_set(errset)) {
--

2.9.3

Signature · 4 lines
Respectfully,
*Sameeh Jubran*
*Linkedin <https://il.linkedin.com/pub/sameeh-jubran/87/747/a8a>*
*Software Engineer @ Daynix <http://www.daynix.com>.*