-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Task/m calm 20742 vm recovery point changes (#76)
* recovery point changes for bps * Adding api changes * Adding get commands * Adding final validations and substrate fixes for vm_recovery_spec * Adding tests for recovery point bp launches * Minor fix * Minor fix in substrate * Fix serial_port_list for ahv_vm.py * Adding minor log * Added catch to check exception * Minor fix * Test fix * Test fix * Fixing network name in test blueprint
- Loading branch information
1 parent
4d4da6b
commit 905fce3
Showing
19 changed files
with
1,007 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from .resource import ResourceAPI | ||
|
||
|
||
class TaskAPI(ResourceAPI): | ||
def __init__(self, connection): | ||
super().__init__(connection, resource_type="tasks") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from .resource import ResourceAPI | ||
|
||
|
||
class VmRecoveryPointAPI(ResourceAPI): | ||
def __init__(self, connection): | ||
super().__init__(connection, resource_type="nutanix/v1/vm_recovery_points") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import sys | ||
import uuid | ||
|
||
from .entity import Entity, EntityType | ||
from .validator import PropertyValidator | ||
from .helper import common as common_helper | ||
from .ahv_vm import AhvVmResourcesType | ||
|
||
from calm.dsl.store import Cache | ||
from calm.dsl.constants import CACHE | ||
from calm.dsl.api.handle import get_api_client | ||
from calm.dsl.log import get_logging_handle | ||
|
||
|
||
LOG = get_logging_handle(__name__) | ||
|
||
|
||
# AhvRecoveryVm | ||
|
||
|
||
class AhvVMRecoveryResourcesType(AhvVmResourcesType): | ||
"""Metaclass for ahv vm recovery resources""" | ||
|
||
__schema_name__ = "AhvVmRecoveryResources" | ||
__openapi_type__ = "recovery_vm_ahv_resources" | ||
|
||
|
||
class AhvVMRecoveryResourcesValidator( | ||
PropertyValidator, openapi_type="recovery_vm_ahv_resources" | ||
): | ||
__default__ = None | ||
__kind__ = AhvVMRecoveryResourcesType | ||
|
||
|
||
def _ahv_vm_recovery_resources(**kwargs): | ||
name = kwargs.get("name", None) | ||
bases = (Entity,) | ||
return AhvVMRecoveryResourcesType(name, bases, kwargs) | ||
|
||
|
||
AhvVmRecoveryResources = _ahv_vm_recovery_resources() | ||
|
||
|
||
# AhvVmRecoverySpec | ||
|
||
|
||
class AhvVMRecoverySpecType(EntityType): | ||
"""Metaclass for ahv vm recovery resources""" | ||
|
||
__schema_name__ = "AhvVmRecoverySpec" | ||
__openapi_type__ = "recovery_vm_ahv_spec" | ||
|
||
|
||
class AhvVMRecoverySpecValidator( | ||
PropertyValidator, openapi_type="recovery_vm_ahv_spec" | ||
): | ||
__default__ = None | ||
__kind__ = AhvVMRecoverySpecType | ||
|
||
|
||
def ahv_vm_recovery_spec(**kwargs): | ||
name = kwargs.get("name", None) | ||
bases = (Entity,) | ||
return AhvVMRecoverySpecType(name, bases, kwargs) | ||
|
||
|
||
AhvVMRecoverySpec = ahv_vm_recovery_spec() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
calm/dsl/builtins/models/schemas/ahv_recovery_vm.yaml.jinja2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{% import "ref.yaml.jinja2" as ref %} | ||
|
||
|
||
{% macro AhvVmRecoveryResources() -%} | ||
|
||
title: Ahv VM Post Recovery Override Resources | ||
type: object | ||
x-calm-dsl-type: recovery_vm_ahv_resources | ||
properties: | ||
nic_list: | ||
x-calm-dsl-display-name: nics | ||
type: array | ||
items: | ||
$ref: '#/components/schemas/AhvNic' | ||
num_vcpus_per_socket: | ||
type: integer | ||
x-calm-dsl-display-name: cores_per_vCPU | ||
default: 1 | ||
num_sockets: | ||
type: integer | ||
x-calm-dsl-display-name: vCPUs | ||
default: 2 | ||
memory_size_mib: | ||
x-calm-dsl-display-name: memory | ||
type: integer | ||
default: 4 | ||
account_uuid: | ||
type: string | ||
gpu_list: | ||
type: array | ||
x-calm-dsl-display-name: gpus | ||
items: | ||
$ref: '#/components/schemas/AhvGpu' | ||
|
||
{%- endmacro %} | ||
|
||
|
||
{% macro AhvVmRecoverySpec() -%} | ||
|
||
title: AhvVmRecoverySpec | ||
type: object | ||
x-calm-dsl-type: recovery_vm_ahv_spec | ||
properties: | ||
vm_name: | ||
type: string | ||
vm_override_resources: | ||
type: object | ||
x-calm-dsl-type: recovery_vm_ahv_resources | ||
recovery_point: | ||
type: object | ||
x-calm-dsl-type: app_calm_ref | ||
|
||
{%- endmacro -%} | ||
|
||
|
||
{% macro AhvRecoveryVmSchema() -%} | ||
|
||
AhvVmRecoverySpec: | ||
{{ AhvVmRecoverySpec() | indent(2) }} | ||
AhvVmRecoveryResources: | ||
{{ AhvVmRecoveryResources() | indent(2) }} | ||
|
||
{%- endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.