@@ -8,10 +8,10 @@ use crossterm::tty::IsTty;
88use feos_proto:: vm_service:: {
99 net_config, stream_vm_console_request as console_input, vm_service_client:: VmServiceClient ,
1010 AttachConsoleMessage , AttachDiskRequest , AttachNicRequest , ConsoleData , CpuConfig ,
11- CreateVmRequest , DeleteVmRequest , DiskConfig , GetVmRequest , ListVmsRequest , MemoryConfig ,
12- NetConfig , PauseVmRequest , PingVmRequest , RemoveDiskRequest , RemoveNicRequest , ResumeVmRequest ,
13- ShutdownVmRequest , StartVmRequest , StreamVmConsoleRequest , StreamVmEventsRequest , TapConfig ,
14- VfioPciConfig , VmConfig , VmState , VmStateChangedEvent ,
11+ CreateVmRequest , DeleteVmRequest , DetachDiskRequest , DetachNicRequest , DiskConfig ,
12+ GetVmRequest , ListVmsRequest , MemoryConfig , NetConfig , PauseVmRequest , PingVmRequest ,
13+ ResumeVmRequest , ShutdownVmRequest , StartVmRequest , StreamVmConsoleRequest ,
14+ StreamVmEventsRequest , TapConfig , VfioPciConfig , VmConfig , VmState , VmStateChangedEvent ,
1515} ;
1616use prost:: Message ;
1717use tokio:: io:: { AsyncReadExt , AsyncWriteExt } ;
@@ -153,14 +153,14 @@ pub enum VmCommand {
153153 #[ arg( long, required = true , help = "Path to the disk image file" ) ]
154154 path : String ,
155155 } ,
156- /// Remove a disk from a virtual machine
157- RemoveDisk {
156+ /// Detach a disk from a virtual machine
157+ DetachDisk {
158158 #[ arg( long, required = true , help = "VM identifier" ) ]
159159 vm_id : String ,
160160 #[ arg(
161161 long,
162162 required = true ,
163- help = "Device identifier of the disk to remove "
163+ help = "Device identifier of the disk to detach "
164164 ) ]
165165 device_id : String ,
166166 } ,
@@ -185,11 +185,11 @@ pub enum VmCommand {
185185 #[ arg( long, help = "Custom device identifier for the new interface" ) ]
186186 device_id : Option < String > ,
187187 } ,
188- /// Remove a network interface from a VM
189- RemoveNic {
188+ /// Detach a network interface from a VM
189+ DetachNic {
190190 #[ arg( long, required = true , help = "VM identifier" ) ]
191191 vm_id : String ,
192- #[ arg( long, required = true , help = "Device identifier of the NIC to remove " ) ]
192+ #[ arg( long, required = true , help = "Device identifier of the NIC to detach " ) ]
193193 device_id : String ,
194194 } ,
195195}
@@ -262,8 +262,8 @@ pub async fn handle_vm_command(args: VmArgs) -> Result<()> {
262262 VmCommand :: Events { vm_id } => watch_events ( & mut client, vm_id) . await ?,
263263 VmCommand :: Console { vm_id } => console_vm ( & mut client, vm_id) . await ?,
264264 VmCommand :: AttachDisk { vm_id, path } => attach_disk ( & mut client, vm_id, path) . await ?,
265- VmCommand :: RemoveDisk { vm_id, device_id } => {
266- remove_disk ( & mut client, vm_id, device_id) . await ?
265+ VmCommand :: DetachDisk { vm_id, device_id } => {
266+ detach_disk ( & mut client, vm_id, device_id) . await ?
267267 }
268268 VmCommand :: AttachNic {
269269 vm_id,
@@ -282,8 +282,8 @@ pub async fn handle_vm_command(args: VmArgs) -> Result<()> {
282282 )
283283 . await ?
284284 }
285- VmCommand :: RemoveNic { vm_id, device_id } => {
286- remove_nic ( & mut client, vm_id, device_id) . await ?
285+ VmCommand :: DetachNic { vm_id, device_id } => {
286+ detach_nic ( & mut client, vm_id, device_id) . await ?
287287 }
288288 }
289289
@@ -783,17 +783,17 @@ async fn attach_disk(
783783 Ok ( ( ) )
784784}
785785
786- async fn remove_disk (
786+ async fn detach_disk (
787787 client : & mut VmServiceClient < Channel > ,
788788 vm_id : String ,
789789 device_id : String ,
790790) -> Result < ( ) > {
791- let request = RemoveDiskRequest {
791+ let request = DetachDiskRequest {
792792 vm_id : vm_id. clone ( ) ,
793793 device_id : device_id. clone ( ) ,
794794 } ;
795- client. remove_disk ( request) . await ?;
796- println ! ( "Disk remove request sent for device {device_id} on VM {vm_id}" ) ;
795+ client. detach_disk ( request) . await ?;
796+ println ! ( "Disk detach request sent for device {device_id} on VM {vm_id}" ) ;
797797 Ok ( ( ) )
798798}
799799
@@ -833,16 +833,16 @@ async fn attach_nic(
833833 Ok ( ( ) )
834834}
835835
836- async fn remove_nic (
836+ async fn detach_nic (
837837 client : & mut VmServiceClient < Channel > ,
838838 vm_id : String ,
839839 device_id : String ,
840840) -> Result < ( ) > {
841- let request = RemoveNicRequest {
841+ let request = DetachNicRequest {
842842 vm_id : vm_id. clone ( ) ,
843843 device_id : device_id. clone ( ) ,
844844 } ;
845- client. remove_nic ( request) . await ?;
846- println ! ( "NIC remove request sent for device {device_id} on VM {vm_id}" ) ;
845+ client. detach_nic ( request) . await ?;
846+ println ! ( "NIC detach request sent for device {device_id} on VM {vm_id}" ) ;
847847 Ok ( ( ) )
848848}
0 commit comments