Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions internal/controllers/machine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,12 @@ func (r *MachineReconciler) Start(ctx context.Context) error {
}

func (r *MachineReconciler) startCheckAndEnqueueVolumeResize(ctx context.Context, log logr.Logger) {
if r.resyncIntervalVolumeSize == 0 {
return
}

wait.UntilWithContext(ctx, func(ctx context.Context) {
log.V(1).Info("starting volume resize loop")
machines, err := r.machines.List(ctx)
if err != nil {
log.Error(err, "failed to list machines")
Expand Down Expand Up @@ -306,6 +311,7 @@ func (r *MachineReconciler) startEnqueueMachineByLibvirtEvent(ctx context.Contex

func (r *MachineReconciler) startGarbageCollector(ctx context.Context, log logr.Logger) {
wait.UntilWithContext(ctx, func(ctx context.Context) {
log.V(1).Info("starting garbage-collector loop")
machines, err := r.machines.List(ctx)
if err != nil {
log.Error(err, "failed to list machines")
Expand Down
5 changes: 4 additions & 1 deletion internal/plugins/volume/ceph/size.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func connectToRados(ctx context.Context, monitors, user, keyfile string) (*rados
if err != nil {
return nil, fmt.Errorf("creating a new connection failed: %w", err)
}

err = conn.ParseCmdLineArgs(args)
if err != nil {
return nil, fmt.Errorf("parsing cmdline args (%v) failed: %w", args, err)
Expand Down Expand Up @@ -108,13 +109,15 @@ func (p *plugin) GetSize(ctx context.Context, spec *api.VolumeSpec) (int64, erro
if err != nil {
return 0, fmt.Errorf("failed to open connection: %w", err)
}
defer conn.Shutdown()

ioCtx, err := conn.OpenIOContext(poolName)
if err != nil {
return 0, fmt.Errorf("failed to open io context: %w", err)
}
defer ioCtx.Destroy()

image, err := rbd.OpenImage(ioCtx, imageName, rbd.NoSnapshot)
image, err := rbd.OpenImageReadOnly(ioCtx, imageName, rbd.NoSnapshot)
if err != nil {
return 0, fmt.Errorf("failed to open image: %w", err)
}
Expand Down
Loading