Repository: metal3-io/baremetal-operator (go)

Issue:
 baremetal IPI power_interface for irmc miss IPMI credentials
When we deployed bare metal using IPI, we encountered the following errors:
```
| last_error             | Failed to validate power driver interface for node e88070b5-afe2-4132-b697-93ee2bf10c1b. Error: Missing the following IPMI credentials in node's driver_info: ['ipmi_address']
```
Check that there is no ipmi related information in driver_info
```
| driver_info            | {​​​​​​​'deploy_kernel': 'http://192.168.20.2:80/images/ironic-python-agent.kernel', 'deploy_ramdisk': 'http://192.168.20.2:80/images/ironic-python-agent.initramfs', 'irmc_address': '192.168.30.25', 'irmc_password': '******', 'irmc_username': 'admin'}​​​​​​​ |
```
But in our previous use, there will be ipmi information in driver_info.

I think it may be related to this PR. https://github.com/metal3-io/baremetal-operator/pull/848

Pull request description:
Fix error: missing the following IPMI credentials in node's driver_info: ['ipmi_address']
Signed-off-by: Zou Yu <zouy.fnst@cn.fujitsu.com>

Fixes #879 

Patch:
diff --git a/Makefile b/Makefile
index 4c8a4675..f61fbaa8 100644
--- a/Makefile
+++ b/Makefile
@@ -64,14 +64,11 @@ test: generate lint manifests unit ## Run common developer tests
 .PHONY: unit
 unit: ## Run unit tests
 	go test ./... $(GO_TEST_FLAGS) -coverprofile $(COVER_PROFILE)
-	cd apis/ && go test ./... $(GO_TEST_FLAGS) -coverprofile $(COVER_PROFILE)
 
 .PHONY: unit-cover
 unit-cover: ## Run unit tests with code coverage
 	go test -coverprofile=$(COVER_PROFILE) $(GO_TEST_FLAGS) ./...
 	go tool cover -func=$(COVER_PROFILE)
-	cd apis/ && go test -coverprofile=$(COVER_PROFILE) $(GO_TEST_FLAGS) ./...
-	cd apis/ && go tool cover -func=$(COVER_PROFILE)
 
 .PHONY: unit-verbose
 unit-verbose: ## Run unit tests with verbose output
diff --git a/pkg/bmc/irmc.go b/pkg/bmc/irmc.go
index 0e6a2a0b..8cf78939 100644
--- a/pkg/bmc/irmc.go
+++ b/pkg/bmc/irmc.go
@@ -52,6 +52,9 @@ func (a *iRMCAccessDetails) DriverInfo(bmcCreds Credentials) map[string]interfac
 		"irmc_username": bmcCreds.Username,
 		"irmc_password": bmcCreds.Password,
 		"irmc_address":  a.hostname,
+		"ipmi_username": bmcCreds.Username,
+		"ipmi_password": bmcCreds.Password,
+		"ipmi_address":  a.hostname,
 	}
 
 	if a.disableCertificateVerification {


Test patch:
diff --git a/pkg/bmc/access_test.go b/pkg/bmc/access_test.go
index c80b7874..3c15e667 100644
--- a/pkg/bmc/access_test.go
+++ b/pkg/bmc/access_test.go
@@ -763,6 +763,9 @@ func TestDriverInfo(t *testing.T) {
 				"irmc_address":   "192.168.122.1",
 				"irmc_password":  "",
 				"irmc_username":  "",
+				"ipmi_address":   "192.168.122.1",
+				"ipmi_password":  "",
+				"ipmi_username":  "",
 				"irmc_verify_ca": false,
 			},
 		},
@@ -775,6 +778,9 @@ func TestDriverInfo(t *testing.T) {
 				"irmc_port":      "8080",
 				"irmc_password":  "",
 				"irmc_username":  "",
+				"ipmi_address":   "192.168.122.1",
+				"ipmi_password":  "",
+				"ipmi_username":  "",
 				"irmc_verify_ca": false,
 			},
 		},
@@ -786,6 +792,9 @@ func TestDriverInfo(t *testing.T) {
 				"irmc_address":   "fe80::fc33:62ff:fe83:8a76",
 				"irmc_password":  "",
 				"irmc_username":  "",
+				"ipmi_address":   "fe80::fc33:62ff:fe83:8a76",
+				"ipmi_password":  "",
+				"ipmi_username":  "",
 				"irmc_verify_ca": false,
 			},
 		},
@@ -798,6 +807,9 @@ func TestDriverInfo(t *testing.T) {
 				"irmc_port":      "8080",
 				"irmc_password":  "",
 				"irmc_username":  "",
+				"ipmi_address":   "fe80::fc33:62ff:fe83:8a76",
+				"ipmi_password":  "",
+				"ipmi_username":  "",
 				"irmc_verify_ca": false,
 			},
 		},