@@ -99,6 +99,14 @@ func (client *client) updateVMConfig(startConfig types.StartConfig, vm *virtualM
9999 }
100100 }
101101
102+ // we want to set the shared dir password on-the-fly to be used
103+ // we do not want this value to be persisted to disk
104+ if startConfig .SharedDirPassword != "" {
105+ if err := setSharedDirPassword (vm .Host , startConfig .SharedDirPassword ); err != nil {
106+ return fmt .Errorf ("Failed to set shared dir password: %w" , err )
107+ }
108+ }
109+
102110 return nil
103111}
104112
@@ -178,6 +186,11 @@ func configureSharedDirs(vm *virtualMachine, sshRunner *crcssh.Runner) error {
178186 if _ , _ , err := sshRunner .RunPrivileged (fmt .Sprintf ("Mounting %s" , mount .Target ), "mount" , "-o" , "context=\" system_u:object_r:container_file_t:s0\" " , "-t" , mount .Type , mount .Tag , mount .Target ); err != nil {
179187 return err
180188 }
189+ case "cifs" :
190+ smbUncPath := fmt .Sprintf ("//%s/%s" , hostVirtualIP , mount .Tag )
191+ if _ , _ , err := sshRunner .RunPrivate ("sudo" , "mount" , "-o" , fmt .Sprintf ("rw,uid=core,gid=core,username='%s',password='%s'" , mount .Username , mount .Password ), "-t" , mount .Type , smbUncPath , mount .Target ); err != nil {
192+ return fmt .Errorf ("Failed to mount CIFS/SMB share '%s' please make sure configured password is correct: %w" , mount .Tag , err )
193+ }
181194 default :
182195 return fmt .Errorf ("Unknown Shared dir type requested: %s" , mount .Type )
183196 }
@@ -233,19 +246,21 @@ func (client *client) Start(ctx context.Context, startConfig types.StartConfig)
233246 }
234247
235248 machineConfig := config.MachineConfig {
236- Name : client .name ,
237- BundleName : bundleName ,
238- CPUs : startConfig .CPUs ,
239- Memory : startConfig .Memory ,
240- DiskSize : startConfig .DiskSize ,
241- NetworkMode : client .networkMode (),
242- ImageSourcePath : crcBundleMetadata .GetDiskImagePath (),
243- ImageFormat : crcBundleMetadata .GetDiskImageFormat (),
244- SSHKeyPath : crcBundleMetadata .GetSSHKeyPath (),
245- KernelCmdLine : crcBundleMetadata .GetKernelCommandLine (),
246- Initramfs : crcBundleMetadata .GetInitramfsPath (),
247- Kernel : crcBundleMetadata .GetKernelPath (),
248- SharedDirs : sharedDirs ,
249+ Name : client .name ,
250+ BundleName : bundleName ,
251+ CPUs : startConfig .CPUs ,
252+ Memory : startConfig .Memory ,
253+ DiskSize : startConfig .DiskSize ,
254+ NetworkMode : client .networkMode (),
255+ ImageSourcePath : crcBundleMetadata .GetDiskImagePath (),
256+ ImageFormat : crcBundleMetadata .GetDiskImageFormat (),
257+ SSHKeyPath : crcBundleMetadata .GetSSHKeyPath (),
258+ KernelCmdLine : crcBundleMetadata .GetKernelCommandLine (),
259+ Initramfs : crcBundleMetadata .GetInitramfsPath (),
260+ Kernel : crcBundleMetadata .GetKernelPath (),
261+ SharedDirs : sharedDirs ,
262+ SharedDirPassword : startConfig .SharedDirPassword ,
263+ SharedDirUsername : startConfig .SharedDirUsername ,
249264 }
250265 if crcBundleMetadata .IsOpenShift () {
251266 machineConfig .KubeConfig = crcBundleMetadata .GetKubeConfigPath ()
0 commit comments