cloud: fix %v in cases where we should use %w

Change-Id: I161fe87fbc2bf8c4c2c7756074fc1050f268121e
Reviewed-on: https://review.monogon.dev/c/monogon/+/3099
Tested-by: Jenkins CI
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/cloud/agent/hwreport.go b/cloud/agent/hwreport.go
index 31ccef4..33a7149 100644
--- a/cloud/agent/hwreport.go
+++ b/cloud/agent/hwreport.go
@@ -129,15 +129,15 @@
 		cpu.Vendor = scannedVals["vendor_id"]
 		family, err := strconv.Atoi(scannedVals["cpu family"])
 		if err != nil {
-			return fmt.Errorf("unable to parse CPU family to int: %v", err)
+			return fmt.Errorf("unable to parse CPU family to int: %w", err)
 		}
 		model, err := strconv.Atoi(scannedVals["model"])
 		if err != nil {
-			return fmt.Errorf("unable to parse CPU model to int: %v", err)
+			return fmt.Errorf("unable to parse CPU model to int: %w", err)
 		}
 		stepping, err := strconv.Atoi(scannedVals["stepping"])
 		if err != nil {
-			return fmt.Errorf("unable to parse CPU stepping to int: %v", err)
+			return fmt.Errorf("unable to parse CPU stepping to int: %w", err)
 		}
 		cpu.Architecture = &api.CPU_X86_64_{
 			X86_64: &api.CPU_X86_64{
diff --git a/cloud/agent/install.go b/cloud/agent/install.go
index 5b0c209..126d365 100644
--- a/cloud/agent/install.go
+++ b/cloud/agent/install.go
@@ -74,7 +74,7 @@
 		bundleRes, err := http.Get(req.BundleUrl)
 		if err != nil {
 			l.Warningf("Metropolis bundle request failed: %v", err)
-			return fmt.Errorf("HTTP request failed: %v", err)
+			return fmt.Errorf("HTTP request failed: %w", err)
 		}
 		defer bundleRes.Body.Close()
 		switch bundleRes.StatusCode {
@@ -103,7 +103,7 @@
 		return nil
 	}, b)
 	if err != nil {
-		return fmt.Errorf("error downloading Metropolis bundle: %v", err)
+		return fmt.Errorf("error downloading Metropolis bundle: %w", err)
 	}
 	l.Info("Metropolis Bundle downloaded")
 	bundle, err := zip.NewReader(bytes.NewReader(bundleRaw.Bytes()), int64(bundleRaw.Len()))
diff --git a/cloud/agent/takeover/takeover.go b/cloud/agent/takeover/takeover.go
index 094c688..645b27e 100644
--- a/cloud/agent/takeover/takeover.go
+++ b/cloud/agent/takeover/takeover.go
@@ -120,7 +120,7 @@
 	}
 	agentInitRaw, err := proto.Marshal(&agentInit)
 	if err != nil {
-		return nil, fmt.Errorf("unable to marshal AgentInit message: %v", err)
+		return nil, fmt.Errorf("unable to marshal AgentInit message: %w", err)
 	}
 
 	// Append AgentInit spec to initramfs
diff --git a/cloud/bmaas/scruffy/bmdb_stats.go b/cloud/bmaas/scruffy/bmdb_stats.go
index 68de363..338c91a 100644
--- a/cloud/bmaas/scruffy/bmdb_stats.go
+++ b/cloud/bmaas/scruffy/bmdb_stats.go
@@ -179,7 +179,7 @@
 		for _, c := range b.collectors {
 			res, err := c.def.query(q, ctx)
 			if err != nil {
-				return fmt.Errorf("collecting %s failed: %v", c.def.name, err)
+				return fmt.Errorf("collecting %s failed: %w", c.def.name, err)
 			} else {
 				results[c.def.name] = res
 			}
diff --git a/cloud/shepherd/manager/fake_ssh_client.go b/cloud/shepherd/manager/fake_ssh_client.go
index db13b5b..cc8c42a 100644
--- a/cloud/shepherd/manager/fake_ssh_client.go
+++ b/cloud/shepherd/manager/fake_ssh_client.go
@@ -28,13 +28,13 @@
 func (f *fakeSSHConnection) Execute(ctx context.Context, command string, stdin []byte) (stdout []byte, stderr []byte, err error) {
 	var aim apb.TakeoverInit
 	if err := proto.Unmarshal(stdin, &aim); err != nil {
-		return nil, nil, fmt.Errorf("while unmarshaling TakeoverInit message: %v", err)
+		return nil, nil, fmt.Errorf("while unmarshaling TakeoverInit message: %w", err)
 	}
 
 	// Agent should send back apb.TakeoverResponse on its standard output.
 	pub, _, err := ed25519.GenerateKey(rand.Reader)
 	if err != nil {
-		return nil, nil, fmt.Errorf("while generating agent public key: %v", err)
+		return nil, nil, fmt.Errorf("while generating agent public key: %w", err)
 	}
 	arsp := apb.TakeoverResponse{
 		Result: &apb.TakeoverResponse_Success{Success: &apb.TakeoverSuccess{
@@ -44,7 +44,7 @@
 	}
 	arspb, err := proto.Marshal(&arsp)
 	if err != nil {
-		return nil, nil, fmt.Errorf("while marshaling TakeoverResponse message: %v", err)
+		return nil, nil, fmt.Errorf("while marshaling TakeoverResponse message: %w", err)
 	}
 	return arspb, nil, nil
 }
diff --git a/cloud/shepherd/manager/initializer.go b/cloud/shepherd/manager/initializer.go
index a380a8f..1961fe2 100644
--- a/cloud/shepherd/manager/initializer.go
+++ b/cloud/shepherd/manager/initializer.go
@@ -169,7 +169,7 @@
 func (i *Initializer) processMachine(ctx context.Context, t *task) error {
 	machine, err := i.p.GetMachine(ctx, shepherd.ProviderID(t.machine.ProviderID))
 	if err != nil {
-		return fmt.Errorf("while fetching machine %q: %v", t.machine.ProviderID, err)
+		return fmt.Errorf("while fetching machine %q: %w", t.machine.ProviderID, err)
 	}
 
 	// Start the agent.
diff --git a/cloud/shepherd/mini/main.go b/cloud/shepherd/mini/main.go
index 0d7b11f..a5fb799 100644
--- a/cloud/shepherd/mini/main.go
+++ b/cloud/shepherd/mini/main.go
@@ -86,7 +86,7 @@
 	var r io.Reader
 	u, err := url.Parse(s)
 	if err != nil {
-		return nil, fmt.Errorf("failed parsing device list url: %v", err)
+		return nil, fmt.Errorf("failed parsing device list url: %w", err)
 	}
 
 	if u.Scheme != "file" {