api update, arch update
This commit is contained in:
@@ -77,8 +77,8 @@ options:
|
|||||||
- Architecture of the KVM VM. DECORT supports KVM hosts based on Intel x86 and IBM PowerPC hardware.
|
- Architecture of the KVM VM. DECORT supports KVM hosts based on Intel x86 and IBM PowerPC hardware.
|
||||||
- This parameter is used when new KVM VM is created and ignored for all other operations.
|
- This parameter is used when new KVM VM is created and ignored for all other operations.
|
||||||
- Module may fail if your DECORT installation does not have physical nodes of specified architecture.
|
- Module may fail if your DECORT installation does not have physical nodes of specified architecture.
|
||||||
default: KVM_X86
|
default: X86_64
|
||||||
choices: [ KVM_X86, KVM_PPC ]
|
choices: [ X86_64, PPC64_LE ]
|
||||||
required: yes
|
required: yes
|
||||||
authenticator:
|
authenticator:
|
||||||
description:
|
description:
|
||||||
@@ -439,8 +439,8 @@ class decort_kvmvm(DecortController):
|
|||||||
check_state=False)
|
check_state=False)
|
||||||
|
|
||||||
if self.comp_id:
|
if self.comp_id:
|
||||||
if self.comp_info['status'] != 'DESTROYED' and self.comp_info['arch'] not in ["KVM_X86", "KVM_PPC"]:
|
if self.comp_info['status'] != 'DESTROYED' and self.comp_info['arch'] not in ["X86_64", "PPC64_LE"]:
|
||||||
# If we found a Compute in a non-DESTROYED state and it is not of type KVM_*, abort the module
|
# If we found a Compute in a non-DESTROYED state and it is not of type valid arch, abort the module
|
||||||
self.result['failed'] = True
|
self.result['failed'] = True
|
||||||
self.result['msg'] = ("Compute ID {} architecture '{}' is not supported by "
|
self.result['msg'] = ("Compute ID {} architecture '{}' is not supported by "
|
||||||
"decort_kvmvm module.").format(self.comp_id,
|
"decort_kvmvm module.").format(self.comp_id,
|
||||||
@@ -500,7 +500,7 @@ class decort_kvmvm(DecortController):
|
|||||||
self.check_amodule_argument('cpu')
|
self.check_amodule_argument('cpu')
|
||||||
self.check_amodule_argument('ram')
|
self.check_amodule_argument('ram')
|
||||||
|
|
||||||
if self.amodule.params['arch'] not in ["KVM_X86", "KVM_PPC"]:
|
if self.amodule.params['arch'] not in ["X86_64", "PPC64_LE"]:
|
||||||
self.result['failed'] = True
|
self.result['failed'] = True
|
||||||
self.result['msg'] = ("Unsupported architecture '{}' is specified for "
|
self.result['msg'] = ("Unsupported architecture '{}' is specified for "
|
||||||
"KVM VM create.").format(self.amodule.params['arch'])
|
"KVM VM create.").format(self.amodule.params['arch'])
|
||||||
@@ -743,7 +743,7 @@ class decort_kvmvm(DecortController):
|
|||||||
required=False,
|
required=False,
|
||||||
fallback=(env_fallback, ['DECORT_APP_SECRET']),
|
fallback=(env_fallback, ['DECORT_APP_SECRET']),
|
||||||
no_log=True),
|
no_log=True),
|
||||||
arch=dict(type='str', choices=['KVM_X86', 'KVM_PPC'], default='KVM_X86'),
|
arch=dict(type='str', choices=['X86_64', 'PPC64_LE'], default='X86_64'),
|
||||||
authenticator=dict(type='str',
|
authenticator=dict(type='str',
|
||||||
required=True,
|
required=True,
|
||||||
choices=['legacy', 'oauth2', 'jwt']),
|
choices=['legacy', 'oauth2', 'jwt']),
|
||||||
|
|||||||
@@ -769,8 +769,8 @@ class DecortController(object):
|
|||||||
|
|
||||||
@param (int) rg_id: ID of the RG where the VM will be provisioned.
|
@param (int) rg_id: ID of the RG where the VM will be provisioned.
|
||||||
@param (string) comp_name: that specifies the name of the VM.
|
@param (string) comp_name: that specifies the name of the VM.
|
||||||
@param (string) arch: hardware architecture of KVM VM. Supported values are: "KVM_X86" for Intel x86
|
@param (string) arch: hardware architecture of KVM VM. Supported values are: "X86_64" for Intel x86
|
||||||
and "KVM_PPC" for IBM PowerPC.
|
and "PPC64_LE" for IBM PowerPC.
|
||||||
@param (int) cpu: how many virtual CPUs to allocate.
|
@param (int) cpu: how many virtual CPUs to allocate.
|
||||||
@param (int) ram: volume of RAM in MB to allocate (i.e. pass 4096 to allocate 4GB RAM).
|
@param (int) ram: volume of RAM in MB to allocate (i.e. pass 4096 to allocate 4GB RAM).
|
||||||
@param (int) boot_disk: boot disk size in GB.
|
@param (int) boot_disk: boot disk size in GB.
|
||||||
@@ -792,9 +792,9 @@ class DecortController(object):
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
api_url=""
|
api_url=""
|
||||||
if arch == "KVM_X86":
|
if arch == "X86_64":
|
||||||
api_url = "/restmachine/cloudapi/kvmx86/create"
|
api_url = "/restmachine/cloudapi/kvmx86/create"
|
||||||
elif arch == "KVM_PPC":
|
elif arch == "PPC64_LE":
|
||||||
api_url = "/restmachine/cloudapi/kvmppc/create"
|
api_url = "/restmachine/cloudapi/kvmppc/create"
|
||||||
else:
|
else:
|
||||||
self.result['failed'] = True
|
self.result['failed'] = True
|
||||||
@@ -1380,12 +1380,12 @@ class DecortController(object):
|
|||||||
self.amodule.fail_json(**self.result)
|
self.amodule.fail_json(**self.result)
|
||||||
# try to locate RG by name - start with getting all RGs IDs within the specified account
|
# try to locate RG by name - start with getting all RGs IDs within the specified account
|
||||||
api_params['accountId'] = arg_account_id
|
api_params['accountId'] = arg_account_id
|
||||||
api_resp = self.decort_api_call(requests.post, "/restmachine/cloudapi/account/get", api_params)
|
api_resp = self.decort_api_call(requests.post, "/restmachine/cloudapi/account/listRG", api_params)
|
||||||
if api_resp.status_code == 200:
|
if api_resp.status_code == 200:
|
||||||
account_specs = json.loads(api_resp.content.decode('utf8'))
|
account_specs = json.loads(api_resp.content.decode('utf8'))
|
||||||
api_params.pop('accountId')
|
api_params.pop('accountId')
|
||||||
for rg_id in account_specs['rgs']:
|
for rg_item in account_specs:
|
||||||
got_id, got_specs = self._rg_get_by_id(rg_id)
|
got_id, got_specs = self._rg_get_by_id(rg_item['id'])
|
||||||
if got_id and got_specs['name'] == arg_rg_name:
|
if got_id and got_specs['name'] == arg_rg_name:
|
||||||
# name matches
|
# name matches
|
||||||
if not arg_check_state or got_specs['status'] not in RG_INVALID_STATES:
|
if not arg_check_state or got_specs['status'] not in RG_INVALID_STATES:
|
||||||
|
|||||||
Reference in New Issue
Block a user