feat(base-images): add managed base image bundles with cache retention, hosted manifests, and opt-in integration boot testing
This commit is contained in:
+15
-11
@@ -54,6 +54,16 @@ export class MicroVM {
|
||||
}
|
||||
}
|
||||
|
||||
private getSocketClient(operation: string): SocketClient {
|
||||
if (!this.socketClient) {
|
||||
throw new SmartVMError(
|
||||
`Cannot ${operation}: socket client not initialized`,
|
||||
'NO_CLIENT',
|
||||
);
|
||||
}
|
||||
return this.socketClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the MicroVM.
|
||||
* Validates config, starts the Firecracker process, applies pre-boot configuration, and boots the VM.
|
||||
@@ -244,7 +254,7 @@ export class MicroVM {
|
||||
*/
|
||||
public async getMetadata(): Promise<any> {
|
||||
this.assertState(['running', 'paused'], 'getMetadata');
|
||||
const response = await this.socketClient!.get('/mmds');
|
||||
const response = await this.getSocketClient('getMetadata').get('/mmds');
|
||||
return response.body;
|
||||
}
|
||||
|
||||
@@ -282,7 +292,7 @@ export class MicroVM {
|
||||
* Get VM instance info.
|
||||
*/
|
||||
public async getInfo(): Promise<any> {
|
||||
const response = await this.socketClient!.get('/');
|
||||
const response = await this.getSocketClient('getInfo').get('/');
|
||||
return response.body;
|
||||
}
|
||||
|
||||
@@ -290,7 +300,7 @@ export class MicroVM {
|
||||
* Get Firecracker version info.
|
||||
*/
|
||||
public async getVersion(): Promise<any> {
|
||||
const response = await this.socketClient!.get('/version');
|
||||
const response = await this.getSocketClient('getVersion').get('/version');
|
||||
return response.body;
|
||||
}
|
||||
|
||||
@@ -334,10 +344,7 @@ export class MicroVM {
|
||||
* Helper: PUT request with error handling.
|
||||
*/
|
||||
private async apiPut(path: string, body: Record<string, any>): Promise<void> {
|
||||
if (!this.socketClient) {
|
||||
throw new SmartVMError('Socket client not initialized', 'NO_CLIENT');
|
||||
}
|
||||
const response = await this.socketClient.put(path, body);
|
||||
const response = await this.getSocketClient(`PUT ${path}`).put(path, body);
|
||||
if (!response.ok) {
|
||||
throw new SmartVMError(
|
||||
`API PUT ${path} failed with status ${response.statusCode}: ${JSON.stringify(response.body)}`,
|
||||
@@ -352,10 +359,7 @@ export class MicroVM {
|
||||
* Helper: PATCH request with error handling.
|
||||
*/
|
||||
private async apiPatch(path: string, body: Record<string, any>): Promise<void> {
|
||||
if (!this.socketClient) {
|
||||
throw new SmartVMError('Socket client not initialized', 'NO_CLIENT');
|
||||
}
|
||||
const response = await this.socketClient.patch(path, body);
|
||||
const response = await this.getSocketClient(`PATCH ${path}`).patch(path, body);
|
||||
if (!response.ok) {
|
||||
throw new SmartVMError(
|
||||
`API PATCH ${path} failed with status ${response.statusCode}: ${JSON.stringify(response.body)}`,
|
||||
|
||||
Reference in New Issue
Block a user