@@ -134,6 +134,7 @@ type atomic =
134134 | VBD_detach of Vbd .id
135135 | VBD_insert of Vbd .id * disk
136136 | VBD_set_active of Vbd .id * bool
137+ | VBD_resize_online of Vbd .id * int64
137138 | VM_remove of Vm .id
138139 | PCI_plug of Pci .id * bool (* use Qmp.add_device *)
139140 | PCI_unplug of Pci .id
@@ -223,6 +224,8 @@ let rec name_of_atomic = function
223224 " VBD_insert"
224225 | VBD_set_active _ ->
225226 " VBD_set_active"
227+ | VBD_resize_online _ ->
228+ " VBD_resize_online"
226229 | VM_remove _ ->
227230 " VM_remove"
228231 | PCI_plug _ ->
@@ -2138,6 +2141,17 @@ let rec perform_atomic ~progress_callback ?result (op : atomic)
21382141 | _ ->
21392142 raise (Xenopsd_error (Bad_power_state (power, Running )))
21402143 )
2144+ | VBD_resize_online (id , new_size ) -> (
2145+ debug " VBD.resize_online %s" (VBD_DB. string_of_id id) ;
2146+ let vbd_t = VBD_DB. read_exn id in
2147+ let power = (B.VM. get_state (VM_DB. read_exn (fst id))).Vm. power_state in
2148+ match power with
2149+ | Running | Paused ->
2150+ B.VBD. resize_online t (VBD_DB. vm_of id) vbd_t new_size ;
2151+ VBD_DB. signal id
2152+ | _ ->
2153+ raise (Xenopsd_error (Bad_power_state (power, Running )))
2154+ )
21412155 | VM_remove id -> (
21422156 debug " VM.remove %s" id ;
21432157 let vm_t = VM_DB. read_exn id in
@@ -2624,6 +2638,7 @@ and trigger_cleanup_after_failure_atom op t =
26242638 | VBD_unplug (id, _)
26252639 | VBD_deactivate (id, _)
26262640 | VBD_detach id
2641+ | VBD_resize_online (id, _)
26272642 | VBD_insert (id , _ ) ->
26282643 immediate_operation dbg (fst id) (VBD_check_state id)
26292644 | VIF_plug id
@@ -3555,6 +3570,9 @@ module VBD = struct
35553570 Debug. with_thread_associated dbg
35563571 (fun () -> debug " VBD.list %s" vm ; DB. list vm)
35573572 ()
3573+
3574+ let resize_online _ dbg id new_size =
3575+ queue_operation dbg (DB. vm_of id) (Atomic (VBD_resize_online (id, new_size)))
35583576end
35593577
35603578module VIF = struct
@@ -4421,6 +4439,7 @@ let _ =
44214439 Server.VBD. unplug (VBD. unplug () ) ;
44224440 Server.VBD. eject (VBD. eject () ) ;
44234441 Server.VBD. insert (VBD. insert () ) ;
4442+ Server.VBD. resize_online (VBD. resize_online () ) ;
44244443 Server.VUSB. add (VUSB. add () ) ;
44254444 Server.VUSB. remove (VUSB. remove () ) ;
44264445 Server.VUSB. stat (VUSB. stat () ) ;
0 commit comments