// UpdatePersistentStorage updates cluster persistent storage configuration.
UpdatePersistentStorage updates cluster persistent storage configuration.
// UpdatePersistentStorage updates cluster persistent storage configuration .
func (o *Operator) UpdatePersistentStorage(ctx context.Context, req ops.UpdatePersistentStorageRequest) error {
	if o.cfg.OpenEBS == nil {
		return trace.BadParameter("persistent storage is not configured")
	}
	ndmConfig, err := o.cfg.OpenEBS.GetNDMConfig()
	if err != nil && !trace.IsNotFound(err) {
		return trace.Wrap(err)
	}
	if trace.IsNotFound(err) {
		ndmConfig = storage.DefaultNDMConfig()
	}
	ndmConfig.Apply(req.Resource)
	err = o.cfg.OpenEBS.UpdateNDMConfig(ndmConfig)
	if err != nil {
		return trace.Wrap(err)
	}
	events.Emit(ctx, o, events.PersistentStorageUpdated)
	err = o.cfg.OpenEBS.RestartNDM()
	if err != nil {
		return trace.Wrap(err)
	}
	return nil
}
func ( o * Operator ) UpdatePersistentStorage ( ctx context . Context , req ops . UpdatePersistentStorageRequest ) error { if o . cfg . OpenEBS == nil { return trace . BadParameter ( " " ) } ndmConfig , err := o . cfg . OpenEBS . GetNDMConfig ( ) if err != nil && ! trace . IsNotFound ( err ) { return trace . Wrap ( err ) } if trace . IsNotFound ( err ) { ndmConfig = storage . DefaultNDMConfig ( ) } ndmConfig . Apply ( req . Resource ) err = o . cfg . OpenEBS . UpdateNDMConfig ( ndmConfig ) if err != nil { return trace . Wrap ( err ) } events . Emit ( ctx , o , events . PersistentStorageUpdated ) err = o . cfg . OpenEBS . RestartNDM ( ) if err != nil { return trace . Wrap ( err ) } return nil }
UpdatePersistentStorage updates cluster persistent storage configuration.
UpdatePersistentStorage updates cluster persistent storage configuration .