package Ġcom . github . ker ub istan . ker ub . planner . steps . storage . fs . convert . inplace Ċ Ċ import Ġcom . fasterxml . jackson . annotation . Json TypeName Ċ import Ġcom . github . ker ub istan . ker ub . model . Host Ċ import Ġcom . github . ker ub istan . ker ub . model . Virtual Storage Device Ċ import Ġcom . github . ker ub istan . ker ub . model . dynamic . Virtual Storage Fs Allocation Ċ import Ġcom . github . ker ub istan . ker ub . model . io . Virtual Disk Format Ċ import Ġcom . github . ker ub istan . ker ub . planner . Operation al State Ċ import Ġcom . github . ker ub istan . ker ub . planner . re servations . Host Storage Reservation Ċ import Ġcom . github . ker ub istan . ker ub . planner . re servations . Reservation Ċ import Ġcom . github . ker ub istan . ker ub . planner . re servations . Use Host Reservation Ċ import Ġcom . github . ker ub istan . ker ub . planner . steps . storage . fs . convert . Abstract Convert Image Ċ import Ġio . github . ker ub istan . k ro ki . collections . update Ċ Ċ @ Json TypeName (" in - place - convert - image ") Ċ data Ġclass ĠIn Place Convert Image ( Ċĉ ĉ override Ġval Ġvirtual Storage : ĠVirtual Storage Device , Ċĉ ĉ override Ġval Ġsource Allocation : ĠVirtual Storage Fs Allocation , Ċĉ ĉ val Ġhost : ĠHost , Ċĉ ĉ val Ġtarget Format Ġ: ĠVirtual Disk Format Ċ ) Ġ: ĠAbstract Convert Image () Ġ{ ĊĊ ĉ init Ġ{ Ċĉ ĉ check ( host . id Ġ== Ġsource Allocation . host Id ) Ġ{ Ċĉĉ ĉ " allocation Ġhost Ġid Ġ(${ source Allocation . host Id }) Ġdoes Ġnot Ġmatch Ġthe Ġhost Ġid Ġ(${ host . id })" Ċĉ ĉ } Ċĉ ĉ check ( host . capabilities ?. index ?. storage Capabilities ById ?. keys ?. let Ġ{ Ġsource Allocation . capability Id Ġin Ġit Ġ} Ġ?: Ġfalse ) Ġ{ Ċĉĉ ĉ " source Ġallocation Ġrefers Ġto Ġcapability Ġ(${ source Allocation . capability Id }) Ġnot Ġregistered Ġin Ġthe Ġhost Ġrecord ." Ġ+ Ċĉĉĉĉ ĉ " known Ġcapabilities Ġare Ġ${ host . capabilities ?. index ?. storage Capabilities ById }" Ċĉ ĉ } Ċĉ ĉ check ( source Allocation . type Ġ!= Ġtarget Format ) Ġ{ Ċĉĉ ĉ " It Ġis Ġpoint less Ġto Ġhave Ġthe Ġsame Ġformat Ġas Ġsource Ġand Ġtarget Ġ($ target Format )" Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ override Ġfun Ġtake ( state : ĠOperation al State ): ĠOperation al State Ġ= Ġstate . copy ( Ċĉĉ ĉ v Storage Ġ= Ġstate . v Storage . update ( virtual Storage . id ) Ġ{ Ċĉĉĉ ĉ it . copy ( Ċĉĉĉĉĉ ĉ dynamic Ġ= Ġit . dynamic !!. copy ( Ċĉĉĉĉĉĉĉ ĉ alloc ations Ġ= Ġit . dynamic . alloc ations Ġ- Ġsource Allocation Ġ+ Ġsource Allocation . copy ( Ċĉĉĉĉĉĉĉĉĉ ĉ type Ġ= Ġtarget Format , Ċĉĉĉĉĉĉĉĉĉ ĉ fileName Ġ= Ġ"${ source Allocation . mount Point }/${ virtual Storage . id }. $ target Format " Ċĉĉĉĉĉĉĉ ĉ ) Ċĉĉĉĉĉ ĉ ) Ċĉĉĉ ĉ ) Ċĉĉ ĉ } Ċ ĉ ) ĊĊ ĉ override Ġfun Ġre servations (): ĠList < Reservation <* >> Ġ= ĠlistOf ( Ċĉĉ ĉ // TODO : Ġthe Ġallocation Ġshould Ġbe Ġreserved Ġexclus ively Ċĉĉ ĉ Use Host Reservation ( host ), Ċĉĉ ĉ Host Storage Reservation ( Ċĉĉĉĉ ĉ host Ġ= Ġhost , Ċĉĉĉĉ ĉ storage Capability Id Ġ= Ġsource Allocation . capability Id , Ċĉĉĉĉ ĉ // Ġthis Ġmay Ġneed Ġsome Ġmore Ġprecision Ċĉĉĉĉ ĉ // Ġ- Ġconsider Ġthe Ġoverhead Ġof Ġthe Ġformat Ċĉĉĉĉ ĉ // Ġ- Ġconsider Ġthin Ġallocation Ġif Ġapplicable Ġto Ġsource Ġ/ Ġtarget Ċĉĉĉĉ ĉ reserved Storage Ġ= Ġvirtual Storage . size Ċĉĉ ĉ ) Ċ ĉ ) Ċ }