@@ -230,15 +230,15 @@ public boolean provisionCertificate(final Host host, final Boolean reconnect, fi
230230
231231 private boolean provisionCertificateForced (Host host , Boolean reconnect , String caProvider ) {
232232 if (host .getType () == Host .Type .Routing && host .getHypervisorType () == com .cloud .hypervisor .Hypervisor .HypervisorType .KVM ) {
233- return provisionKvmHostViaSsh (host );
233+ return provisionKvmHostViaSsh (host , caProvider );
234234 } else if (host .getType () == Host .Type .ConsoleProxy || host .getType () == Host .Type .SecondaryStorageVM ) {
235- return provisionSystemVmViaSsh (host , reconnect );
235+ return provisionSystemVmViaSsh (host , reconnect , caProvider );
236236 }
237237 throw new CloudRuntimeException ("Forced certificate provisioning is only supported for KVM hosts and SystemVMs." );
238238 }
239239
240240 @ Override
241- public void provisionCertificateViaSsh (final Connection sshConnection , final String agentIp , final String agentHostname ) {
241+ public void provisionCertificateViaSsh (final Connection sshConnection , final String agentIp , final String agentHostname , final String caProvider ) {
242242 Integer validityPeriod = CAManager .CertValidityPeriod .value ();
243243 if (validityPeriod < 1 ) {
244244 validityPeriod = 1 ;
@@ -266,7 +266,7 @@ public void provisionCertificateViaSsh(final Connection sshConnection, final Str
266266 // 2. Issue Certificate based on returned CSR
267267 final String csr = keystoreSetupResult .getStdOut ();
268268 final Certificate certificate = issueCertificate (csr , Arrays .asList (agentHostname , agentIp ),
269- Collections .singletonList (agentIp ), null , null );
269+ Collections .singletonList (agentIp ), null , caProvider );
270270
271271 if (certificate == null || certificate .getClientCertificate () == null ) {
272272 throw new CloudRuntimeException ("Failed to issue certificates for host: " + agentIp );
@@ -297,7 +297,7 @@ public void provisionCertificateViaSsh(final Connection sshConnection, final Str
297297 }
298298 }
299299
300- private boolean provisionKvmHostViaSsh (Host host ) {
300+ private boolean provisionKvmHostViaSsh (Host host , String caProvider ) {
301301 final HostVO hostVO = (HostVO ) host ;
302302 hostDao .loadDetails (hostVO );
303303 String username = hostVO .getDetail (ApiConstants .USERNAME );
@@ -321,7 +321,7 @@ private boolean provisionKvmHostViaSsh(Host host) {
321321 }
322322 }
323323
324- provisionCertificateViaSsh (sshConnection , hostIp , host .getName ());
324+ provisionCertificateViaSsh (sshConnection , hostIp , host .getName (), caProvider );
325325
326326 SSHCmdHelper .sshExecuteCmd (sshConnection , "sudo service cloudstack-agent restart" );
327327 return true ;
@@ -335,7 +335,7 @@ private boolean provisionKvmHostViaSsh(Host host) {
335335 }
336336 }
337337
338- private boolean provisionSystemVmViaSsh (Host host , Boolean reconnect ) {
338+ private boolean provisionSystemVmViaSsh (Host host , Boolean reconnect , String caProvider ) {
339339 VMInstanceVO vm = vmInstanceDao .findVMByInstanceName (host .getName ());
340340 if (vm == null ) {
341341 throw new CloudRuntimeException ("Cannot find underlying VM for host: " + host .getName ());
@@ -352,7 +352,7 @@ private boolean provisionSystemVmViaSsh(Host host, Boolean reconnect) {
352352 }
353353
354354 final Certificate certificate = issueCertificate (null , Arrays .asList (vm .getHostName (), vm .getInstanceName ()),
355- new ArrayList <>(ipAddressDetails .values ()), CertValidityPeriod .value (), null );
355+ new ArrayList <>(ipAddressDetails .values ()), CertValidityPeriod .value (), caProvider );
356356 return deployCertificate (hypervisorHost , certificate , reconnect , sshAccessDetails );
357357 } catch (Exception e ) {
358358 logger .error ("Failed to provision system VM " + host .getName () + " via hypervisor SSH proxy. Ensure the hypervisor host is connected." , e );
0 commit comments