Skip to content

Commit 225f45e

Browse files
committed
feat: Add method to check if ISO is mounted for a VM
Introduce `isMountedIso` method to verify if an ISO is attached to a virtual machine. This includes input validation for VM ID and retrieves the mounting status from the API response.
1 parent 77fe5bf commit 225f45e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/RootServer/RootServer.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,17 @@ public function getIsos(): mixed
7979
return $this->client->get('vm/list/iso');
8080
}
8181

82+
/**
83+
* @param int $vm_id
84+
* @return bool
85+
* @throws GuzzleException
86+
*/
87+
public function isMountedIso(int $vm_id): bool
88+
{
89+
$this->validateVMId($vm_id);
90+
return $this->client->get("vm/{$vm_id}/config")['data']['config']['iso']['attached'] ?? false;
91+
}
92+
8293
/**
8394
* @param int $vm_id
8495
* @param string $iso

0 commit comments

Comments
 (0)