| 1 |
# (c) 2025, Joey Zhang <[email protected]> |
| 2 |
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) |
| 3 |
|
| 4 |
from __future__ import (absolute_import, division, print_function) |
| 5 |
__metaclass__ = type |
| 6 |
|
| 7 |
import os |
| 8 |
import tempfile |
| 9 |
import math |
| 10 |
|
| 11 |
from ansible_collections.community.libvirt.plugins.module_utils.libvirt import ( |
| 12 |
LibvirtConnection, VIRT_SUCCESS |
| 13 |
) |
| 14 |
|
| 15 |
|
| 16 |
OPTION_BOOL_ONOFF = 1 |
| 17 |
|
| 18 |
|
| 19 |
class LibvirtWrapper(object): |
| 20 |
|
| 21 |
def __init__(self, module): |
| 22 |
self.module = module |
| 23 |
self.uri = module.params.get('uri') |
| 24 |
|
| 25 |
def __get_conn(self): |
| 26 |
self.conn = LibvirtConnection(self.uri, self.module) |
| 27 |
return self.conn |
| 28 |
|
| 29 |
def find_vm(self, vmid): |
| 30 |
self.__get_conn() |
| 31 |
return self.conn.find_vm(vmid) |
| 32 |
|
| 33 |
def create(self, vmid): |
| 34 |
if not self.module.check_mode: |
| 35 |
self.__get_conn() |
| 36 |
return self.conn.create(vmid) |
| 37 |
|
| 38 |
def shutdown(self, vmid): |
| 39 |
if not self.module.check_mode: |
| 40 |
self.__get_conn() |
| 41 |
return self.conn.shutdown(vmid) |
| 42 |
|
| 43 |
def destroy(self, vmid): |
| 44 |
if not self.module.check_mode: |
| 45 |
self.__get_conn() |
| 46 |
return self.conn.destroy(vmid) |
| 47 |
|
| 48 |
def undefine(self, vmid): |
| 49 |
if not self.module.check_mode: |
| 50 |
self.__get_conn() |
| 51 |
self.conn.delete_domain_volumes(vmid) |
| 52 |
return self.conn.undefine(vmid, 0) |
| 53 |
|
| 54 |
|
| 55 |
def _get_option_mapping(key, mapping): |
| 56 |
if mapping is None: |
| 57 |
return (key, None) |
| 58 |
|
| 59 |
if key in mapping: |
| 60 |
name, valmap = mapping[key] |
| 61 |
if name is None: |
| 62 |
name = key |
| 63 |
return (name, valmap) |
| 64 |
else: |
| 65 |
return (key, None) |
| 66 |
|
| 67 |
|
| 68 |
def _dict2options(obj, mapping, prefix=""): |
| 69 |
|
| 70 |
if obj is None: |
| 71 |
return "" |
| 72 |
|
| 73 |
if not isinstance(obj, dict): |
| 74 |
return str(obj) |
| 75 |
|
| 76 |
# Extract primary value if present |
| 77 |
# Priority: _value takes precedence over value |
| 78 |
primary_value = None |
| 79 |
primary_key = None |
| 80 |
|
| 81 |
if '_value' in obj: |
| 82 |
primary_value = obj['_value'] |
| 83 |
primary_key = '_value' |
| 84 |
elif 'value' in obj: |
| 85 |
primary_value = obj['value'] |
| 86 |
primary_key = 'value' |
| 87 |
|
| 88 |
# Create a copy of the dict without the primary key for processing |
| 89 |
obj_copy = obj.copy() |
| 90 |
if primary_key: |
| 91 |
del obj_copy[primary_key] |
| 92 |
|
| 93 |
parts = [] |
| 94 |
for k, v in obj_copy.items(): |
| 95 |
if v is None: |
| 96 |
continue |
| 97 |
|
| 98 |
name, valmap = _get_option_mapping(k, mapping) |
| 99 |
|
| 100 |
if isinstance(v, dict): |
| 101 |
sub_prefix = "{}{}.".format(prefix, name) |
| 102 |
parts.append(_dict2options(v, valmap, prefix=sub_prefix)) |
| 103 |
elif isinstance(v, list): |
| 104 |
for i, item in enumerate(v): |
| 105 |
item_name = "{}{}{}".format(prefix, name, i) |
| 106 |
if isinstance(item, dict): |
| 107 |
sub_prefix = "{}.".format(item_name) |
| 108 |
parts.append( |
| 109 |
_dict2options( |
| 110 |
item, |
| 111 |
valmap, |
| 112 |
prefix=sub_prefix)) |
| 113 |
elif isinstance(item, bool): |
| 114 |
if valmap == OPTION_BOOL_ONOFF: |
| 115 |
parts.append( |
| 116 |
"{}={}".format( |
| 117 |
item_name, |
| 118 |
'on' if item else 'off')) |
| 119 |
else: |
| 120 |
parts.append( |
| 121 |
"{}={}".format( |
| 122 |
item_name, |
| 123 |
'yes' if item else 'no')) |
| 124 |
else: |
| 125 |
parts.append("{}={}".format(item_name, str(item))) |
| 126 |
elif isinstance(v, bool): |
| 127 |
if valmap == OPTION_BOOL_ONOFF: |
| 128 |
parts.append( |
| 129 |
"{}{}={}".format( |
| 130 |
prefix, |
| 131 |
name, |
| 132 |
'on' if v else 'off')) |
| 133 |
else: |
| 134 |
parts.append( |
| 135 |
"{}{}={}".format( |
| 136 |
prefix, |
| 137 |
name, |
| 138 |
'yes' if v else 'no')) |
| 139 |
else: |
| 140 |
parts.append("{}{}={}".format(prefix, name, str(v))) |
| 141 |
|
| 142 |
# Combine primary value with other parts |
| 143 |
if primary_value is not None: |
| 144 |
primary_str = str(primary_value) |
| 145 |
|
| 146 |
# If we have a prefix, the primary value should be associated with it |
| 147 |
# Remove trailing dot from prefix for the primary value assignment |
| 148 |
if prefix: |
| 149 |
prefix_without_dot = prefix.rstrip('.') |
| 150 |
primary_part = "{}={}".format(prefix_without_dot, primary_str) |
| 151 |
else: |
| 152 |
# At root level, primary value stands alone |
| 153 |
primary_part = primary_str |
| 154 |
|
| 155 |
if parts: |
| 156 |
return "{},{}".format(primary_part, ",".join(parts)) |
| 157 |
else: |
| 158 |
return primary_part |
| 159 |
elif parts: |
| 160 |
return ",".join(parts) |
| 161 |
else: |
| 162 |
return "" |
| 163 |
|
| 164 |
|
| 165 |
class VirtInstallTool(object): |
| 166 |
|
| 167 |
def __init__(self, module, |
| 168 |
virtinst_path=None): |
| 169 |
self.module = module |
| 170 |
self.params = module.params.copy() |
| 171 |
self.warnings = [] |
| 172 |
self._base_command = virtinst_path if virtinst_path is not None else 'virt-install' |
| 173 |
self.command_argv = [self._base_command] |
| 174 |
self._display_argv = [self._base_command] |
| 175 |
self._executed_commands = [] |
| 176 |
|
| 177 |
self._vm_name = self.params.get('name') |
| 178 |
|
| 179 |
def get_commands(self): |
| 180 |
"""Return list of commands that have been executed.""" |
| 181 |
return self._executed_commands |
| 182 |
|
| 183 |
def _reset_command(self): |
| 184 |
"""Reset command_argv to base command for new operation""" |
| 185 |
self.command_argv = [self._base_command] |
| 186 |
self._display_argv = [self._base_command] |
| 187 |
|
| 188 |
def _save_string_to_tempfile(self, content, suffix='.tmp'): |
| 189 |
fd, path = tempfile.mkstemp(dir=self.module.tmpdir, |
| 190 |
suffix=suffix, |
| 191 |
text=True) |
| 192 |
with os.fdopen(fd, 'w') as f: |
| 193 |
f.write(content) |
| 194 |
|
| 195 |
return path |
| 196 |
|
| 197 |
def _add_parameter( |
| 198 |
self, |
| 199 |
flag, |
| 200 |
primary_value=None, |
| 201 |
dict_value=None, |
| 202 |
dict_mapping=None, |
| 203 |
no_log=False, |
| 204 |
sanitized_dict_value=None): |
| 205 |
"""Add a command line option to virt-install command. |
| 206 |
|
| 207 |
no_log=True redacts the entire argument value in the display command. |
| 208 |
sanitized_dict_value replaces dict_value only in the display command, |
| 209 |
allowing per-key redaction of no_log sub-fields. |
| 210 |
""" |
| 211 |
display_dict_value = sanitized_dict_value if sanitized_dict_value is not None else dict_value |
| 212 |
|
| 213 |
if primary_value: |
| 214 |
if dict_value: |
| 215 |
real_value = "{},{}".format(str(primary_value), _dict2options(dict_value, dict_mapping)) |
| 216 |
self.command_argv.append("{}".format(flag)) |
| 217 |
self.command_argv.append(real_value) |
| 218 |
self._display_argv.append("{}".format(flag)) |
| 219 |
if no_log: |
| 220 |
self._display_argv.append("***") |
| 221 |
else: |
| 222 |
self._display_argv.append( |
| 223 |
"{},{}".format(str(primary_value), _dict2options(display_dict_value, dict_mapping))) |
| 224 |
return |
| 225 |
else: |
| 226 |
self.command_argv.append("{}".format(flag)) |
| 227 |
self.command_argv.append("{}".format(str(primary_value))) |
| 228 |
self._display_argv.append("{}".format(flag)) |
| 229 |
self._display_argv.append("***" if no_log else "{}".format(str(primary_value))) |
| 230 |
return |
| 231 |
else: |
| 232 |
if dict_value: |
| 233 |
self.command_argv.append("{}".format(flag)) |
| 234 |
self.command_argv.append("{}".format(_dict2options(dict_value, dict_mapping))) |
| 235 |
self._display_argv.append("{}".format(flag)) |
| 236 |
if no_log: |
| 237 |
self._display_argv.append("***") |
| 238 |
else: |
| 239 |
self._display_argv.append("{}".format(_dict2options(display_dict_value, dict_mapping))) |
| 240 |
return |
| 241 |
else: |
| 242 |
self.command_argv.append("{}".format(flag)) |
| 243 |
self._display_argv.append("{}".format(flag)) |
| 244 |
return |
| 245 |
|
| 246 |
def _add_flag_parameter(self, flag, value): |
| 247 |
"""Add a flag command line option to virt-install command""" |
| 248 |
if value: |
| 249 |
self.command_argv.append("{}".format(flag)) |
| 250 |
self._display_argv.append("{}".format(flag)) |
| 251 |
return |
| 252 |
|
| 253 |
def _get_param_combined_items(self, singular_key, plural_key): |
| 254 |
combined_items = [] |
| 255 |
if self.params.get(singular_key) is not None: |
| 256 |
combined_items.append(self.params[singular_key]) |
| 257 |
if self.params.get(plural_key) is not None: |
| 258 |
combined_items.extend(self.params[plural_key]) |
| 259 |
|
| 260 |
return combined_items |
| 261 |
|
| 262 |
def _convert_raw_to_string(self, value): |
| 263 |
"""Convert raw type parameter (str or dict) to string content. |
| 264 |
""" |
| 265 |
if isinstance(value, str): |
| 266 |
return value |
| 267 |
elif isinstance(value, dict): |
| 268 |
try: |
| 269 |
import yaml |
| 270 |
return yaml.safe_dump(value, default_flow_style=False, allow_unicode=True) |
| 271 |
except ImportError: |
| 272 |
self.module.fail_json( |
| 273 |
msg="PyYAML is required to process dictionary cloud-init parameters") |
| 274 |
else: |
| 275 |
# This should not happen due to validation, but provide a fallback |
| 276 |
return str(value) |
| 277 |
|
| 278 |
def _build_basic_options(self): |
| 279 |
"""Build basic VM configuration options""" |
| 280 |
# Required options |
| 281 |
if self.params.get('uri') is not None: |
| 282 |
self._add_parameter('--connect', self.params['uri']) |
| 283 |
|
| 284 |
if self.params.get('name') is not None: |
| 285 |
self._add_parameter('--name', self.params['name']) |
| 286 |
|
| 287 |
if self.params.get('memory') is not None: |
| 288 |
memory_mapping = { |
| 289 |
'current_memory': ('currentMemory', None), |
| 290 |
'max_memory': ('maxMemory', None), |
| 291 |
'max_memory_opts': ('maxMemory', None), |
| 292 |
} |
| 293 |
self._add_parameter('--memory', self.params['memory'], |
| 294 |
dict_value=self.params.get('memory_opts'), |
| 295 |
dict_mapping=memory_mapping) |
| 296 |
|
| 297 |
if self.params.get('memorybacking') is not None: |
| 298 |
memorybacking_mapping = { |
| 299 |
'hugepage_specs': ('hugepages.page', { |
| 300 |
'page_size': ('size', None), |
| 301 |
}), |
| 302 |
'source': ('source', None), |
| 303 |
} |
| 304 |
self._add_parameter('--memorybacking', |
| 305 |
dict_value=self.params['memorybacking'], |
| 306 |
dict_mapping=memorybacking_mapping) |
| 307 |
|
| 308 |
if self.params.get('arch') is not None: |
| 309 |
self._add_parameter('--arch', self.params['arch']) |
| 310 |
|
| 311 |
if self.params.get('machine') is not None: |
| 312 |
self._add_parameter('--machine', self.params['machine']) |
| 313 |
|
| 314 |
if self.params.get('metadata') is not None: |
| 315 |
self._add_parameter('--metadata', |
| 316 |
dict_value=self.params['metadata']) |
| 317 |
|
| 318 |
if self.params.get('events') is not None: |
| 319 |
self._add_parameter('--events', |
| 320 |
dict_value=self.params['events']) |
| 321 |
|
| 322 |
if self.params.get('resource') is not None: |
| 323 |
self._add_parameter('--resource', |
| 324 |
dict_value=self.params['resource']) |
| 325 |
|
| 326 |
if self.params.get('sysinfo') is not None: |
| 327 |
self._add_parameter('--sysinfo', |
| 328 |
dict_value=self.params['sysinfo']) |
| 329 |
|
| 330 |
if self.params.get('qemu_commandline') is not None: |
| 331 |
self._add_parameter( |
| 332 |
'--qemu-commandline', |
| 333 |
self.params['qemu_commandline']) |
| 334 |
|
| 335 |
if self.params.get('vcpus') is not None: |
| 336 |
vcpus_mapping = { |
| 337 |
'current': ('vcpu.current', None), |
| 338 |
'placement': ('vcpu.placement', None), |
| 339 |
'vcpu_specs': ('vcpus.vcpu', None), |
| 340 |
} |
| 341 |
self._add_parameter('--vcpus', self.params['vcpus'], |
| 342 |
dict_value=self.params.get('vcpus_opts'), |
| 343 |
dict_mapping=vcpus_mapping) |
| 344 |
|
| 345 |
if self.params.get('numatune') is not None: |
| 346 |
numatune_mapping = { |
| 347 |
'memnode_specs': ('memnode', None) |
| 348 |
} |
| 349 |
self._add_parameter('--numatune', |
| 350 |
dict_value=self.params['numatune'], |
| 351 |
dict_mapping=numatune_mapping) |
| 352 |
|
| 353 |
if self.params.get('memtune') is not None: |
| 354 |
self._add_parameter('--memtune', |
| 355 |
dict_value=self.params['memtune']) |
| 356 |
|
| 357 |
if self.params.get('blkiotune') is not None: |
| 358 |
blkiotune_mapping = { |
| 359 |
'devices': ('device', None) |
| 360 |
} |
| 361 |
self._add_parameter('--blkiotune', |
| 362 |
dict_value=self.params['blkiotune'], |
| 363 |
dict_mapping=blkiotune_mapping) |
| 364 |
|
| 365 |
if self.params.get('cpu') is not None: |
| 366 |
cpu_mapping = { |
| 367 |
'model_opts': ('model', None), |
| 368 |
'numa': (None, { |
| 369 |
'cell_specs': ('cell', { |
| 370 |
'mem_access': ('memAccess', None), |
| 371 |
'distances': (None, { |
| 372 |
'sibling_specs': ('sibling', None) |
| 373 |
}), |
| 374 |
'cache_specs': ('cache', None) |
| 375 |
}), |
| 376 |
'interconnects': (None, { |
| 377 |
'bandwidth_specs': ('bandwidth', None), |
| 378 |
'latency_specs': ('latency', None) |
| 379 |
}) |
| 380 |
}) |
| 381 |
} |
| 382 |
cpu_dict_value = self.params['cpu'] |
| 383 |
cpu_primary_argv = [] |
| 384 |
if 'model' in cpu_dict_value: |
| 385 |
cpu_model = cpu_dict_value.pop('model') |
| 386 |
if cpu_model: |
| 387 |
cpu_primary_argv.append(cpu_model) |
| 388 |
if 'features' in cpu_dict_value: |
| 389 |
cpu_feature_param = cpu_dict_value.pop('features') |
| 390 |
if cpu_feature_param: |
| 391 |
for k, v in cpu_feature_param.items(): |
| 392 |
if v in [ |
| 393 |
'force', |
| 394 |
'require', |
| 395 |
'optional', |
| 396 |
'disable', |
| 397 |
'forbid']: |
| 398 |
cpu_primary_argv.append("{}={}".format(v, k)) |
| 399 |
if cpu_primary_argv: |
| 400 |
cpu_primary_value = ','.join(cpu_primary_argv) |
| 401 |
self._add_parameter('--cpu', cpu_primary_value, |
| 402 |
dict_value=cpu_dict_value, |
| 403 |
dict_mapping=cpu_mapping) |
| 404 |
else: |
| 405 |
self._add_parameter('--cpu', |
| 406 |
dict_value=cpu_dict_value, |
| 407 |
dict_mapping=cpu_mapping) |
| 408 |
|
| 409 |
if self.params.get('cputune') is not None: |
| 410 |
cputune_mapping = { |
| 411 |
'vcpupin_specs': ('vcpupin', None), |
| 412 |
'iothreadpin_specs': ('iothreadpin', None), |
| 413 |
'vcpusched_specs': ('vcpusched', None), |
| 414 |
'iothreadsched_specs': ('iothreadsched', None), |
| 415 |
} |
| 416 |
self._add_parameter('--cputune', |
| 417 |
dict_value=self.params['cputune'], |
| 418 |
dict_mapping=cputune_mapping) |
| 419 |
|
| 420 |
if self.params.get('security') is not None: |
| 421 |
self._add_parameter( |
| 422 |
'--seclabel', |
| 423 |
dict_value=self.params['security']) |
| 424 |
|
| 425 |
if self.params.get('keywrap') is not None: |
| 426 |
keywrap_mapping = { |
| 427 |
'ciphers': ('cipher', None) |
| 428 |
} |
| 429 |
self._add_parameter('--keywrap', |
| 430 |
dict_value=self.params['keywrap'], |
| 431 |
dict_mapping=keywrap_mapping, |
| 432 |
no_log=True) |
| 433 |
|
| 434 |
if self.params.get('iothreads') is not None: |
| 435 |
iothreads_mapping = { |
| 436 |
'iothread_specs': ('iothreadids.iothread', None), |
| 437 |
} |
| 438 |
self._add_parameter('--iothreads', self.params['iothreads'], |
| 439 |
dict_value=self.params.get('iothreads_opts'), |
| 440 |
dict_mapping=iothreads_mapping) |
| 441 |
|
| 442 |
if self.params.get('features') is not None: |
| 443 |
self._add_parameter( |
| 444 |
'--features', |
| 445 |
dict_value=self.params['features']) |
| 446 |
|
| 447 |
if self.params.get('clock') is not None: |
| 448 |
clock_mapping = { |
| 449 |
'timers': ('timer', None) |
| 450 |
} |
| 451 |
self._add_parameter('--clock', |
| 452 |
dict_value=self.params['clock'], |
| 453 |
dict_mapping=clock_mapping) |
| 454 |
|
| 455 |
if self.params.get('pm') is not None: |
| 456 |
self._add_parameter('--pm', |
| 457 |
dict_value=self.params['pm']) |
| 458 |
|
| 459 |
if self.params.get('launch_security') is not None: |
| 460 |
launch_security_mapping = { |
| 461 |
'dh_cert': ('dhCert', None), |
| 462 |
'reduced_phys_bits': ('reducedPhysBits', None) |
| 463 |
} |
| 464 |
self._add_parameter('--launchSecurity', |
| 465 |
dict_value=self.params['launch_security'], |
| 466 |
dict_mapping=launch_security_mapping) |
| 467 |
|
| 468 |
def _build_installation_options(self): # Installation media options |
| 469 |
if self.params.get('cdrom') is not None: |
| 470 |
self._add_parameter('--cdrom', self.params['cdrom']) |
| 471 |
|
| 472 |
if self.params.get('location') is not None: |
| 473 |
self._add_parameter('--location', self.params['location'], |
| 474 |
dict_value=self.params.get('location_opts')) |
| 475 |
|
| 476 |
if self.params.get('pxe') is not None: |
| 477 |
self._add_flag_parameter('--pxe', self.params['pxe']) |
| 478 |
|
| 479 |
if self.params.get('import'): |
| 480 |
self._add_flag_parameter('--import', self.params['import']) |
| 481 |
|
| 482 |
if self.params.get('extra_args') is not None: |
| 483 |
self._add_parameter('--extra-args', self.params['extra_args']) |
| 484 |
|
| 485 |
if self.params.get('initrd_inject') is not None: |
| 486 |
self._add_parameter( |
| 487 |
'--initrd-inject', |
| 488 |
self.params['initrd_inject']) |
| 489 |
|
| 490 |
if self.params.get('install') is not None: |
| 491 |
self._add_parameter('--install', |
| 492 |
dict_value=self.params['install']) |
| 493 |
|
| 494 |
if self.params.get('unattended') is not None: |
| 495 |
unattended_mapping = { |
| 496 |
'admin_password_file': ('admin-password-file', None), |
| 497 |
'user_login': ('user-login', None), |
| 498 |
'user_password_file': ('user-password-file', None), |
| 499 |
'product_key': ('product-key', None), |
| 500 |
} |
| 501 |
unattended_sanitized = self.params['unattended'].copy() |
| 502 |
if unattended_sanitized.get('product_key') is not None: |
| 503 |
unattended_sanitized['product_key'] = '***' |
| 504 |
self._add_parameter('--unattended', |
| 505 |
dict_value=self.params['unattended'], |
| 506 |
dict_mapping=unattended_mapping, |
| 507 |
sanitized_dict_value=unattended_sanitized) |
| 508 |
|
| 509 |
if self.params.get('cloud_init') is not None: |
| 510 |
cloud_init_params = self.params['cloud_init'].copy() |
| 511 |
|
| 512 |
if cloud_init_params.get('network_config'): |
| 513 |
network_config_content = self._convert_raw_to_string(cloud_init_params['network_config']) |
| 514 |
cloud_init_params['network-config'] = self._save_string_to_tempfile(network_config_content) |
| 515 |
del cloud_init_params['network_config'] |
| 516 |
if cloud_init_params.get('meta_data'): |
| 517 |
meta_data_content = self._convert_raw_to_string(cloud_init_params['meta_data']) |
| 518 |
cloud_init_params['meta-data'] = self._save_string_to_tempfile(meta_data_content) |
| 519 |
del cloud_init_params['meta_data'] |
| 520 |
if cloud_init_params.get('user_data'): |
| 521 |
user_data_content = self._convert_raw_to_string(cloud_init_params['user_data']) |
| 522 |
cloud_init_params['user-data'] = self._save_string_to_tempfile(user_data_content) |
| 523 |
del cloud_init_params['user_data'] |
| 524 |
|
| 525 |
cloud_init_mapping = { |
| 526 |
'root_password_generate': ( |
| 527 |
'root-password-generate', |
| 528 |
OPTION_BOOL_ONOFF), |
| 529 |
'disable': ( |
| 530 |
'disable', |
| 531 |
OPTION_BOOL_ONOFF), |
| 532 |
'root_password_file': ( |
| 533 |
'root-password-file', |
| 534 |
None), |
| 535 |
'root_ssh_key': ( |
| 536 |
'root-ssh-key', |
| 537 |
None), |
| 538 |
'clouduser_ssh_key': ( |
| 539 |
'clouduser-ssh-key', |
| 540 |
None), |
| 541 |
} |
| 542 |
cloud_init_sanitized = cloud_init_params.copy() |
| 543 |
for _sensitive_key in ('root_ssh_key', 'clouduser_ssh_key'): |
| 544 |
if cloud_init_sanitized.get(_sensitive_key) is not None: |
| 545 |
cloud_init_sanitized[_sensitive_key] = '***' |
| 546 |
self._add_parameter('--cloud-init', |
| 547 |
dict_value=cloud_init_params, |
| 548 |
dict_mapping=cloud_init_mapping, |
| 549 |
sanitized_dict_value=cloud_init_sanitized) |
| 550 |
|
| 551 |
if self.params.get('boot') is not None: |
| 552 |
self._add_parameter('--boot', self.params['boot'], |
| 553 |
dict_value=self.params.get('boot_opts')) |
| 554 |
|
| 555 |
if self.params.get('idmap') is not None: |
| 556 |
self._add_parameter('--idmap', |
| 557 |
dict_value=self.params['idmap']) |
| 558 |
|
| 559 |
def _build_guest_os_options(self): |
| 560 |
if self.params.get('osinfo') is not None: |
| 561 |
osinfo_mapping = { |
| 562 |
'detect': ('detect', OPTION_BOOL_ONOFF), |
| 563 |
'require': ('require', OPTION_BOOL_ONOFF), |
| 564 |
} |
| 565 |
self._add_parameter('--osinfo', |
| 566 |
dict_value=self.params['osinfo'], |
| 567 |
dict_mapping=osinfo_mapping) |
| 568 |
|
| 569 |
def _build_storage_options(self): |
| 570 |
if self.params.get('disks') is not None: |
| 571 |
disk_mapping = { |
| 572 |
'backing_store': ('backing_store', None), |
| 573 |
'backing_format': ('backing_format', None), |
| 574 |
'transient_opts': ('transient', { |
| 575 |
'share_backing': ('shareBacking', None) |
| 576 |
}) |
| 577 |
} |
| 578 |
for disk in self.params['disks']: |
| 579 |
self._add_parameter('--disk', |
| 580 |
dict_value=disk, |
| 581 |
dict_mapping=disk_mapping) |
| 582 |
|
| 583 |
if self.params.get('filesystems') is not None: |
| 584 |
for filesystem in self.params['filesystems']: |
| 585 |
self._add_parameter('--filesystem', |
| 586 |
dict_value=filesystem) |
| 587 |
|
| 588 |
def _build_network_options(self): |
| 589 |
if self.params.get('networks') is not None: |
| 590 |
network_param = self.params['networks'] |
| 591 |
if len(network_param) == 0: |
| 592 |
self._add_parameter('--network', 'none') |
| 593 |
return |
| 594 |
|
| 595 |
network_mapping = { |
| 596 |
'trust_guest_rx_filters': ('trustGuestRxFilters', None), |
| 597 |
'state': ('link.state', None), |
| 598 |
} |
| 599 |
for network in network_param: |
| 600 |
self._add_parameter('--network', |
| 601 |
dict_value=network, |
| 602 |
dict_mapping=network_mapping) |
| 603 |
|
| 604 |
def _build_graphics_options(self): |
| 605 |
graphics_params = self._get_param_combined_items( |
| 606 |
'graphics', 'graphics_devices') |
| 607 |
|
| 608 |
if len(graphics_params) == 0: |
| 609 |
self._add_parameter('--graphics', 'none') |
| 610 |
return |
| 611 |
|
| 612 |
for item in graphics_params: |
| 613 |
graphics_primary_value = None |
| 614 |
if 'type' in item: |
| 615 |
graphics_primary_value = item.pop('type') |
| 616 |
self._add_parameter('--graphics', graphics_primary_value, |
| 617 |
dict_value=item) |
| 618 |
else: |
| 619 |
self._add_parameter('--graphics', |
| 620 |
dict_value=item) |
| 621 |
|
| 622 |
def _build_virt_options(self): |
| 623 |
if self.params.get('virt_type') is not None: |
| 624 |
self._add_parameter('--virt-type', self.params['virt_type']) |
| 625 |
|
| 626 |
if self.params.get('hvm') is not None: |
| 627 |
self._add_flag_parameter('--hvm', self.params['hvm']) |
| 628 |
|
| 629 |
if self.params.get('paravirt') is not None: |
| 630 |
self._add_flag_parameter('--paravirt', self.params['paravirt']) |
| 631 |
|
| 632 |
if self.params.get('container') is not None: |
| 633 |
self._add_flag_parameter('--container', self.params['container']) |
| 634 |
|
| 635 |
def _build_device_options(self): |
| 636 |
# Controller devices |
| 637 |
controller_params = self._get_param_combined_items( |
| 638 |
'controller', 'controller_devices') |
| 639 |
for item in controller_params: |
| 640 |
self._add_parameter('--controller', |
| 641 |
dict_value=item) |
| 642 |
|
| 643 |
# Input devices |
| 644 |
input_params = self._get_param_combined_items('input', 'input_devices') |
| 645 |
for item in input_params: |
| 646 |
self._add_parameter('--input', |
| 647 |
dict_value=item) |
| 648 |
|
| 649 |
# Host devices |
| 650 |
hostdev_params = self._get_param_combined_items( |
| 651 |
'hostdev', 'host_devices') |
| 652 |
for item in hostdev_params: |
| 653 |
self._add_parameter('--hostdev', |
| 654 |
dict_value=item) |
| 655 |
|
| 656 |
# Sound devices |
| 657 |
sound_params = self._get_param_combined_items('sound', 'sound_devices') |
| 658 |
for item in sound_params: |
| 659 |
self._add_parameter('--sound', |
| 660 |
dict_value=item) |
| 661 |
|
| 662 |
# Audio devices |
| 663 |
audio_params = self._get_param_combined_items('audio', 'audio_devices') |
| 664 |
for item in audio_params: |
| 665 |
self._add_parameter('--audio', |
| 666 |
dict_value=item) |
| 667 |
|
| 668 |
# Watchdog devices |
| 669 |
watchdog_params = self._get_param_combined_items( |
| 670 |
'watchdog', 'watchdog_devices') |
| 671 |
for item in watchdog_params: |
| 672 |
self._add_parameter('--watchdog', |
| 673 |
dict_value=item) |
| 674 |
|
| 675 |
# Serial devices |
| 676 |
serial_params = self._get_param_combined_items( |
| 677 |
'serial', 'serial_devices') |
| 678 |
for item in serial_params: |
| 679 |
self._add_parameter('--serial', |
| 680 |
dict_value=item) |
| 681 |
|
| 682 |
# Parallel devices |
| 683 |
parallel_params = self._get_param_combined_items( |
| 684 |
'parallel', 'parallel_devices') |
| 685 |
for item in parallel_params: |
| 686 |
self._add_parameter('--parallel', |
| 687 |
dict_value=item) |
| 688 |
|
| 689 |
# Channel devices |
| 690 |
channel_params = self._get_param_combined_items( |
| 691 |
'channel', 'channel_devices') |
| 692 |
for item in channel_params: |
| 693 |
self._add_parameter('--channel', |
| 694 |
dict_value=item) |
| 695 |
|
| 696 |
# Console devices |
| 697 |
console_params = self._get_param_combined_items( |
| 698 |
'console', 'console_devices') |
| 699 |
for item in console_params: |
| 700 |
self._add_parameter('--console', |
| 701 |
dict_value=item) |
| 702 |
|
| 703 |
# Video devices |
| 704 |
video_params = self._get_param_combined_items('video', 'video_devices') |
| 705 |
for item in video_params: |
| 706 |
self._add_parameter('--video', |
| 707 |
dict_value=item) |
| 708 |
|
| 709 |
# Smartcard devices |
| 710 |
smartcard_params = self._get_param_combined_items( |
| 711 |
'smartcard', 'smartcard_devices') |
| 712 |
for item in smartcard_params: |
| 713 |
self._add_parameter('--smartcard', |
| 714 |
dict_value=item) |
| 715 |
|
| 716 |
# Redirection devices |
| 717 |
redirdev_params = self._get_param_combined_items( |
| 718 |
'redirdev', 'redirected_devices') |
| 719 |
for item in redirdev_params: |
| 720 |
self._add_parameter('--redirdev', |
| 721 |
dict_value=item) |
| 722 |
|
| 723 |
# Memory balloon devices |
| 724 |
memballoon_params = self._get_param_combined_items( |
| 725 |
'memballoon', 'memballoon_devices') |
| 726 |
memballoon_mapping = { |
| 727 |
'freePageReporting': ('freePageReporting', OPTION_BOOL_ONOFF), |
| 728 |
'autodeflate': ('autodeflate', OPTION_BOOL_ONOFF), |
| 729 |
} |
| 730 |
for item in memballoon_params: |
| 731 |
self._add_parameter('--memballoon', |
| 732 |
dict_value=item, |
| 733 |
dict_mapping=memballoon_mapping) |
| 734 |
|
| 735 |
# TPM devices |
| 736 |
tpm_params = self._get_param_combined_items('tpm', 'tpm_devices') |
| 737 |
tpm_mapping = { |
| 738 |
'active_pcr_banks': ('active_pcr_banks', { |
| 739 |
'sha1': ('sha1', OPTION_BOOL_ONOFF), |
| 740 |
'sha256': ('sha256', OPTION_BOOL_ONOFF), |
| 741 |
'sha384': ('sha384', OPTION_BOOL_ONOFF), |
| 742 |
'sha512': ('sha512', OPTION_BOOL_ONOFF), |
| 743 |
}), |
| 744 |
'backend': ('backend', { |
| 745 |
'persistent_state': ('persistent_state', OPTION_BOOL_ONOFF), |
| 746 |
}), |
| 747 |
} |
| 748 |
for item in tpm_params: |
| 749 |
self._add_parameter('--tpm', |
| 750 |
dict_value=item, |
| 751 |
dict_mapping=tpm_mapping) |
| 752 |
|
| 753 |
# RNG devices |
| 754 |
rng_params = self._get_param_combined_items('rng', 'rng_devices') |
| 755 |
for item in rng_params: |
| 756 |
self._add_parameter('--rng', |
| 757 |
dict_value=item) |
| 758 |
|
| 759 |
# Panic devices |
| 760 |
panic_params = self._get_param_combined_items('panic', 'panic_devices') |
| 761 |
for item in panic_params: |
| 762 |
self._add_parameter('--panic', |
| 763 |
dict_value=item) |
| 764 |
|
| 765 |
# Shared memory devices |
| 766 |
shmem_params = self._get_param_combined_items('shmem', 'shmem_devices') |
| 767 |
shmem_mapping = { |
| 768 |
'msi': ('msi', { |
| 769 |
'ioeventfd': ('ioeventfd', OPTION_BOOL_ONOFF), |
| 770 |
}), |
| 771 |
} |
| 772 |
for item in shmem_params: |
| 773 |
self._add_parameter('--shmem', |
| 774 |
dict_value=item, |
| 775 |
dict_mapping=shmem_mapping) |
| 776 |
|
| 777 |
# Vsock devices |
| 778 |
vsock_params = self._get_param_combined_items('vsock', 'vsock_devices') |
| 779 |
vsock_mapping = { |
| 780 |
'cid': ('cid', { |
| 781 |
'auto': ('auto', OPTION_BOOL_ONOFF), |
| 782 |
}), |
| 783 |
} |
| 784 |
for item in vsock_params: |
| 785 |
self._add_parameter('--vsock', |
| 786 |
dict_value=item, |
| 787 |
dict_mapping=vsock_mapping) |
| 788 |
|
| 789 |
# IOMMU devices |
| 790 |
iommu_params = self._get_param_combined_items('iommu', 'iommu_devices') |
| 791 |
iommu_mapping = { |
| 792 |
'driver': ('driver', { |
| 793 |
'caching_mode': ('caching_mode', OPTION_BOOL_ONOFF), |
| 794 |
'eim': ('eim', OPTION_BOOL_ONOFF), |
| 795 |
'intremap': ('intremap', OPTION_BOOL_ONOFF), |
| 796 |
'iotlb': ('iotlb', OPTION_BOOL_ONOFF), |
| 797 |
}), |
| 798 |
} |
| 799 |
for item in iommu_params: |
| 800 |
self._add_parameter('--iommu', |
| 801 |
dict_value=item, |
| 802 |
dict_mapping=iommu_mapping) |
| 803 |
|
| 804 |
def _build_misc_options(self): |
| 805 |
if self.params.get('autostart') is not None: |
| 806 |
self._add_flag_parameter('--autostart', self.params['autostart']) |
| 807 |
|
| 808 |
if self.params.get('transient') is not None: |
| 809 |
self._add_flag_parameter('--transient', self.params['transient']) |
| 810 |
|
| 811 |
if self.params.get('destroy_on_exit') is not None: |
| 812 |
self._add_flag_parameter( |
| 813 |
'--destroy-on-exit', |
| 814 |
self.params['destroy_on_exit']) |
| 815 |
|
| 816 |
if self.params.get('noreboot') is not None: |
| 817 |
self._add_flag_parameter('--noreboot', self.params['noreboot']) |
| 818 |
|
| 819 |
def _validate_params(self): |
| 820 |
"""Validate parameter combinations and dependencies according to virt-install requirements""" |
| 821 |
|
| 822 |
extra_key_pairs = [ |
| 823 |
('memory', 'memory_opts'), |
| 824 |
('vcpus', 'vcpus_opts'), |
| 825 |
('location', 'location_opts'), |
| 826 |
('boot', 'boot_opts'), |
| 827 |
('iothreads', 'iothreads_opts'), |
| 828 |
] |
| 829 |
|
| 830 |
for param_key, extra_key in extra_key_pairs: |
| 831 |
if (extra_key in self.params) and (param_key not in self.params): |
| 832 |
self.module.fail_json( |
| 833 |
msg="{} requires {} to be specified".format( |
| 834 |
extra_key, param_key)) |
| 835 |
|
| 836 |
# Validate cloud-init raw type parameters |
| 837 |
if self.params.get('cloud_init') is not None: |
| 838 |
cloud_init_params = self.params['cloud_init'] |
| 839 |
raw_type_params = ['network_config', 'meta_data', 'user_data'] |
| 840 |
|
| 841 |
for param_name in raw_type_params: |
| 842 |
if cloud_init_params.get(param_name) is not None: |
| 843 |
param_value = cloud_init_params[param_name] |
| 844 |
if not isinstance(param_value, (str, dict)): |
| 845 |
self.module.fail_json( |
| 846 |
msg="cloud_init.{} must be a string or dictionary, got {}".format( |
| 847 |
param_name, type(param_value).__name__)) |
| 848 |
|
| 849 |
def _build_command(self): |
| 850 |
"""Build the complete virt-install command""" |
| 851 |
self._validate_params() |
| 852 |
|
| 853 |
# Build command sections |
| 854 |
self._build_basic_options() |
| 855 |
self._build_installation_options() |
| 856 |
self._build_guest_os_options() |
| 857 |
self._build_storage_options() |
| 858 |
self._build_network_options() |
| 859 |
self._build_graphics_options() |
| 860 |
self._build_virt_options() |
| 861 |
self._build_device_options() |
| 862 |
self._build_misc_options() |
| 863 |
|
| 864 |
# Always add --noautoconsole for non-interactive execution |
| 865 |
self.command_argv.append('--noautoconsole') |
| 866 |
self._display_argv.append('--noautoconsole') |
| 867 |
|
| 868 |
def execute(self, dryrun=False, wait_timeout=None): |
| 869 |
changed = False |
| 870 |
result = dict() |
| 871 |
|
| 872 |
self._reset_command() |
| 873 |
self._build_command() |
| 874 |
|
| 875 |
if dryrun: |
| 876 |
self.command_argv.append('--dry-run') |
| 877 |
self._display_argv.append('--dry-run') |
| 878 |
|
| 879 |
if wait_timeout: |
| 880 |
wait_minutes = math.ceil(wait_timeout / 60.0) |
| 881 |
self.command_argv.append('--wait') |
| 882 |
self.command_argv.append(str(wait_minutes)) |
| 883 |
self._display_argv.append('--wait') |
| 884 |
self._display_argv.append(str(wait_minutes)) |
| 885 |
|
| 886 |
# Store the sanitized command for later retrieval |
| 887 |
self._executed_commands.append(' '.join(self._display_argv)) |
| 888 |
|
| 889 |
# Execute the command |
| 890 |
rc, stdout, stderr = self.module.run_command( |
| 891 |
self.command_argv, check_rc=False) |
| 892 |
|
| 893 |
if rc == 0: |
| 894 |
changed = True |
| 895 |
result["msg"] = "virtual machine '{}' created successfully".format( |
| 896 |
self._vm_name |
| 897 |
) |
| 898 |
return changed, VIRT_SUCCESS, result |
| 899 |
|
| 900 |
error_msg = "failed to create virtual machine '{}': {}".format( |
| 901 |
self._vm_name, stderr.strip() if stderr else stdout.strip() |
| 902 |
) |
| 903 |
result["msg"] = error_msg |
| 904 |
return changed, rc, result |
| 905 |
|
| 906 |
|
| 907 |
def get_memory_args(): |
| 908 |
return dict( |
| 909 |
memory=dict(type='int'), |
| 910 |
memory_opts=dict( |
| 911 |
type='dict', |
| 912 |
options=dict( |
| 913 |
current_memory=dict(type='int'), |
| 914 |
max_memory=dict(type='int'), |
| 915 |
max_memory_opts=dict( |
| 916 |
type='dict', options=dict( |
| 917 |
slots=dict( |
| 918 |
type='int'))), |
| 919 |
), |
| 920 |
), |
| 921 |
) |
| 922 |
|
| 923 |
|
| 924 |
def get_memorybacking_args(): |
| 925 |
return dict( |
| 926 |
memorybacking=dict( |
| 927 |
type='dict', |
| 928 |
options=dict( |
| 929 |
hugepages=dict(type='bool'), |
| 930 |
hugepage_specs=dict( |
| 931 |
type='list', |
| 932 |
elements="dict", |
| 933 |
options=dict( |
| 934 |
page_size=dict( |
| 935 |
type='int'), nodeset=dict( |
| 936 |
type='str')), |
| 937 |
), |
| 938 |
nosharepages=dict(type='bool'), |
| 939 |
locked=dict(type='bool'), |
| 940 |
source=dict( |
| 941 |
type='dict', |
| 942 |
options=dict( |
| 943 |
type=dict( |
| 944 |
type='str', |
| 945 |
choices=['anonymous', 'file', 'memfd']), |
| 946 |
), |
| 947 |
), |
| 948 |
access=dict( |
| 949 |
type='dict', |
| 950 |
options=dict( |
| 951 |
mode=dict( |
| 952 |
type='str', |
| 953 |
choices=[ |
| 954 |
'shared', |
| 955 |
'private'])), |
| 956 |
), |
| 957 |
allocation=dict( |
| 958 |
type='dict', |
| 959 |
options=dict( |
| 960 |
mode=dict( |
| 961 |
type='str', choices=[ |
| 962 |
'immediate', 'ondemand']), |
| 963 |
threads=dict(type='int'), |
| 964 |
), |
| 965 |
), |
| 966 |
discard=dict(type='bool'), |
| 967 |
), |
| 968 |
), |
| 969 |
) |
| 970 |
|
| 971 |
|
| 972 |
def get_arch_args(): |
| 973 |
return dict( |
| 974 |
arch=dict(type='str'), |
| 975 |
) |
| 976 |
|
| 977 |
|
| 978 |
def get_machine_args(): |
| 979 |
return dict( |
| 980 |
machine=dict(type='str'), |
| 981 |
) |
| 982 |
|
| 983 |
|
| 984 |
def get_metadata_args(): |
| 985 |
return dict( |
| 986 |
metadata=dict(type='dict'), |
| 987 |
) |
| 988 |
|
| 989 |
|
| 990 |
def get_events_args(): |
| 991 |
return dict( |
| 992 |
events=dict( |
| 993 |
type='dict', |
| 994 |
options=dict( |
| 995 |
on_poweroff=dict( |
| 996 |
type='str', |
| 997 |
choices=[ |
| 998 |
'destroy', |
| 999 |
'restart', |
| 1000 |
'preserve', |
| 1001 |
'rename-restart'], |
| 1002 |
), |
| 1003 |
on_reboot=dict( |
| 1004 |
type='str', |
| 1005 |
choices=[ |
| 1006 |
'destroy', |
| 1007 |
'restart', |
| 1008 |
'preserve', |
| 1009 |
'rename-restart'], |
| 1010 |
), |
| 1011 |
on_crash=dict( |
| 1012 |
type='str', |
| 1013 |
choices=[ |
| 1014 |
'destroy', |
| 1015 |
'restart', |
| 1016 |
'preserve', |
| 1017 |
'rename-restart', |
| 1018 |
'coredump-destroy', |
| 1019 |
'coredump-restart', |
| 1020 |
], |
| 1021 |
), |
| 1022 |
on_lockfailure=dict( |
| 1023 |
type='str', choices=['poweroff', 'restart', 'pause', 'ignore'] |
| 1024 |
), |
| 1025 |
), |
| 1026 |
), |
| 1027 |
) |
| 1028 |
|
| 1029 |
|
| 1030 |
def get_resource_args(): |
| 1031 |
return dict( |
| 1032 |
resource=dict(type='dict'), |
| 1033 |
) |
| 1034 |
|
| 1035 |
|
| 1036 |
def get_sysinfo_args(): |
| 1037 |
return dict( |
| 1038 |
sysinfo=dict(type='dict'), |
| 1039 |
) |
| 1040 |
|
| 1041 |
|
| 1042 |
def get_qmeu_commandline_args(): |
| 1043 |
return dict( |
| 1044 |
qemu_commandline=dict(type='str'), |
| 1045 |
) |
| 1046 |
|
| 1047 |
|
| 1048 |
def get_vcpu_args(): |
| 1049 |
return dict( |
| 1050 |
vcpus=dict(type='int'), |
| 1051 |
vcpus_opts=dict( |
| 1052 |
type='dict', |
| 1053 |
options=dict( |
| 1054 |
maxvcpus=dict(type='int'), |
| 1055 |
sockets=dict(type='int'), |
| 1056 |
dies=dict(type='int'), |
| 1057 |
clusters=dict(type='int'), |
| 1058 |
cores=dict(type='int'), |
| 1059 |
threads=dict(type='int'), |
| 1060 |
current=dict(type='int'), |
| 1061 |
cpuset=dict(type='str'), |
| 1062 |
placement=dict(type='str', choices=['static', 'auto']), |
| 1063 |
vcpu_specs=dict(type='list', elements="dict"), |
| 1064 |
), |
| 1065 |
), |
| 1066 |
) |
| 1067 |
|
| 1068 |
|
| 1069 |
def get_numatune_args(): |
| 1070 |
return dict( |
| 1071 |
numatune=dict( |
| 1072 |
type='dict', |
| 1073 |
options=dict( |
| 1074 |
memory=dict( |
| 1075 |
type='dict', |
| 1076 |
options=dict( |
| 1077 |
mode=dict( |
| 1078 |
type='str', choices=['interleave', 'preferred', 'strict'] |
| 1079 |
), |
| 1080 |
nodeset=dict(type='str'), |
| 1081 |
placement=dict(type='str', choices=['static', 'auto']), |
| 1082 |
), |
| 1083 |
), |
| 1084 |
memnode_specs=dict( |
| 1085 |
type='list', |
| 1086 |
elements="dict", |
| 1087 |
options=dict( |
| 1088 |
cellid=dict(type='int'), |
| 1089 |
mode=dict( |
| 1090 |
type='str', choices=['interleave', 'preferred', 'strict'] |
| 1091 |
), |
| 1092 |
nodeset=dict(type='str'), |
| 1093 |
), |
| 1094 |
), |
| 1095 |
), |
| 1096 |
), |
| 1097 |
) |
| 1098 |
|
| 1099 |
|
| 1100 |
def get_memtune_args(): |
| 1101 |
return dict( |
| 1102 |
memtune=dict(type='dict'), |
| 1103 |
) |
| 1104 |
|
| 1105 |
|
| 1106 |
def get_blkiotune_args(): |
| 1107 |
return dict( |
| 1108 |
blkiotune=dict( |
| 1109 |
type='dict', |
| 1110 |
options=dict( |
| 1111 |
weight=dict(type='int'), devices=dict(type='list', elements="dict") |
| 1112 |
), |
| 1113 |
), |
| 1114 |
) |
| 1115 |
|
| 1116 |
|
| 1117 |
def get_cpu_args(): |
| 1118 |
return dict( |
| 1119 |
cpu=dict( |
| 1120 |
type='dict', |
| 1121 |
options=dict( |
| 1122 |
model=dict(type='str'), |
| 1123 |
model_opts=dict( |
| 1124 |
type='dict', |
| 1125 |
options=dict( |
| 1126 |
fallback=dict(type='str', choices=['forbid', 'allow']), |
| 1127 |
vendor_id=dict(type='str'), |
| 1128 |
), |
| 1129 |
), |
| 1130 |
match=dict(type='str', choices=['exact', 'minimum', 'strict']), |
| 1131 |
migratable=dict(type='bool'), |
| 1132 |
vendor=dict(type='str'), |
| 1133 |
features=dict(type='dict'), |
| 1134 |
cache=dict( |
| 1135 |
type='dict', |
| 1136 |
options=dict( |
| 1137 |
mode=dict( |
| 1138 |
type='str', choices=['emulate', 'passthrough', 'disable'] |
| 1139 |
), |
| 1140 |
level=dict(type='int'), |
| 1141 |
), |
| 1142 |
), |
| 1143 |
numa=dict( |
| 1144 |
type='dict', |
| 1145 |
options=dict( |
| 1146 |
cell_specs=dict( |
| 1147 |
type='list', |
| 1148 |
elements="dict", |
| 1149 |
options=dict( |
| 1150 |
id=dict(type='int'), |
| 1151 |
cpus=dict(type='str'), |
| 1152 |
memory=dict(type='int'), |
| 1153 |
mem_access=dict( |
| 1154 |
type='str', choices=[ |
| 1155 |
'shared', 'private']), |
| 1156 |
discard=dict(type='bool'), |
| 1157 |
distances=dict( |
| 1158 |
type='dict', |
| 1159 |
options=dict( |
| 1160 |
sibling_specs=dict( |
| 1161 |
type='list', elements="dict"), |
| 1162 |
), |
| 1163 |
), |
| 1164 |
cache_specs=dict(type='list', elements="dict"), |
| 1165 |
), |
| 1166 |
), |
| 1167 |
interconnects=dict( |
| 1168 |
type='list', |
| 1169 |
elements="dict", |
| 1170 |
options=dict( |
| 1171 |
bandwidth_specs=dict( |
| 1172 |
type='list', elements="dict"), |
| 1173 |
latency_specs=dict( |
| 1174 |
type='list', elements="dict"), |
| 1175 |
), |
| 1176 |
), |
| 1177 |
), |
| 1178 |
), |
| 1179 |
), |
| 1180 |
), |
| 1181 |
) |
| 1182 |
|
| 1183 |
|
| 1184 |
def get_cputune_args(): |
| 1185 |
return dict( |
| 1186 |
cputune=dict( |
| 1187 |
type='dict', |
| 1188 |
options=dict( |
| 1189 |
vcpupin_specs=dict( |
| 1190 |
type='list', |
| 1191 |
elements="dict", |
| 1192 |
options=dict( |
| 1193 |
vcpu=dict(type='int'), |
| 1194 |
cpuset=dict(type='str'), |
| 1195 |
), |
| 1196 |
), |
| 1197 |
emulatorpin=dict( |
| 1198 |
type='dict', |
| 1199 |
options=dict( |
| 1200 |
cpuset=dict(type='str'), |
| 1201 |
) |
| 1202 |
), |
| 1203 |
iothreadpin_specs=dict( |
| 1204 |
type='list', |
| 1205 |
elements="dict", |
| 1206 |
options=dict( |
| 1207 |
iothread=dict(type='int'), |
| 1208 |
cpuset=dict(type='str'), |
| 1209 |
), |
| 1210 |
), |
| 1211 |
vcpusched_specs=dict( |
| 1212 |
type='list', |
| 1213 |
elements="dict", |
| 1214 |
options=dict( |
| 1215 |
vcpus=dict(type='str'), |
| 1216 |
scheduler=dict( |
| 1217 |
type='str', choices=[ |
| 1218 |
'batch', 'idle', 'fifo', 'rr']), |
| 1219 |
priority=dict(type='int'), |
| 1220 |
), |
| 1221 |
), |
| 1222 |
iothreadsched_specs=dict( |
| 1223 |
type='list', |
| 1224 |
elements="dict", |
| 1225 |
options=dict( |
| 1226 |
iothreads=dict(type='str'), |
| 1227 |
scheduler=dict( |
| 1228 |
type='str', choices=[ |
| 1229 |
'batch', 'idle', 'fifo', 'rr']), |
| 1230 |
priority=dict(type='int'), |
| 1231 |
), |
| 1232 |
), |
| 1233 |
emulatorsched=dict( |
| 1234 |
type='dict', |
| 1235 |
options=dict( |
| 1236 |
scheduler=dict( |
| 1237 |
type='str', choices=[ |
| 1238 |
'batch', 'idle', 'fifo', 'rr']), |
| 1239 |
priority=dict(type='int'), |
| 1240 |
), |
| 1241 |
), |
| 1242 |
shares=dict(type='int'), |
| 1243 |
period=dict(type='int'), |
| 1244 |
quota=dict(type='int'), |
| 1245 |
global_period=dict(type='int'), |
| 1246 |
global_quota=dict(type='int'), |
| 1247 |
emulator_period=dict(type='int'), |
| 1248 |
emulator_quota=dict(type='int'), |
| 1249 |
iothread_period=dict(type='int'), |
| 1250 |
iothread_quota=dict(type='int'), |
| 1251 |
), |
| 1252 |
), |
| 1253 |
) |
| 1254 |
|
| 1255 |
|
| 1256 |
def get_security_args(): |
| 1257 |
return dict( |
| 1258 |
security=dict(type='dict'), |
| 1259 |
) |
| 1260 |
|
| 1261 |
|
| 1262 |
def get_keywrap_args(): |
| 1263 |
return dict( |
| 1264 |
keywrap=dict( |
| 1265 |
type='dict', options=dict(ciphers=dict(type='list', elements="dict")), no_log=True |
| 1266 |
), |
| 1267 |
) |
| 1268 |
|
| 1269 |
|
| 1270 |
def get_iothreads_args(): |
| 1271 |
return dict( |
| 1272 |
iothreads=dict(type='int'), |
| 1273 |
iothreads_opts=dict( |
| 1274 |
type='dict', |
| 1275 |
options=dict( |
| 1276 |
iothread_specs=dict( |
| 1277 |
type='list', |
| 1278 |
elements="dict", |
| 1279 |
options=dict( |
| 1280 |
id=dict(type='int'), |
| 1281 |
thread_pool_min=dict(type='int'), |
| 1282 |
thread_pool_max=dict(type='int'), |
| 1283 |
), |
| 1284 |
), |
| 1285 |
defaultiothread=dict( |
| 1286 |
type='dict', |
| 1287 |
options=dict( |
| 1288 |
thread_pool_min=dict(type='int'), |
| 1289 |
thread_pool_max=dict(type='int'), |
| 1290 |
), |
| 1291 |
), |
| 1292 |
), |
| 1293 |
), |
| 1294 |
) |
| 1295 |
|
| 1296 |
|
| 1297 |
def get_features_args(): |
| 1298 |
return dict( |
| 1299 |
features=dict(type='dict'), |
| 1300 |
) |
| 1301 |
|
| 1302 |
|
| 1303 |
def get_clock_args(): |
| 1304 |
return dict( |
| 1305 |
clock=dict( |
| 1306 |
type='dict', |
| 1307 |
options=dict( |
| 1308 |
offset=dict(type='str'), timers=dict(type='list', elements="dict") |
| 1309 |
), |
| 1310 |
), |
| 1311 |
) |
| 1312 |
|
| 1313 |
|
| 1314 |
def get_pm_args(): |
| 1315 |
return dict( |
| 1316 |
pm=dict( |
| 1317 |
type='dict', |
| 1318 |
options=dict( |
| 1319 |
suspend_to_mem=dict( |
| 1320 |
type='dict', options=dict(enabled=dict(type='bool')) |
| 1321 |
), |
| 1322 |
suspend_to_disk=dict( |
| 1323 |
type='dict', options=dict(enabled=dict(type='bool')) |
| 1324 |
), |
| 1325 |
), |
| 1326 |
), |
| 1327 |
) |
| 1328 |
|
| 1329 |
|
| 1330 |
def get_launch_security_args(): |
| 1331 |
return dict( |
| 1332 |
launch_security=dict( |
| 1333 |
type='dict', |
| 1334 |
options=dict( |
| 1335 |
type=dict(type='str', required=True), |
| 1336 |
policy=dict(type='str'), |
| 1337 |
cbitpos=dict(type='int'), |
| 1338 |
reduced_phys_bits=dict(type='int'), |
| 1339 |
dh_cert=dict(type='str'), |
| 1340 |
session=dict(type='str'), |
| 1341 |
), |
| 1342 |
), |
| 1343 |
) |
| 1344 |
|
| 1345 |
|
| 1346 |
def get_cdrom_args(): |
| 1347 |
return dict( |
| 1348 |
cdrom=dict(type='str'), |
| 1349 |
) |
| 1350 |
|
| 1351 |
|
| 1352 |
def get_location_opts(): |
| 1353 |
return dict( |
| 1354 |
location=dict(type='str'), |
| 1355 |
location_opts=dict( |
| 1356 |
type='dict', options=dict(kernel=dict(type='str'), initrd=dict(type='str')) |
| 1357 |
), |
| 1358 |
) |
| 1359 |
|
| 1360 |
|
| 1361 |
def get_pxe_args(): |
| 1362 |
return dict( |
| 1363 |
pxe=dict(type='bool'), |
| 1364 |
) |
| 1365 |
|
| 1366 |
|
| 1367 |
def get_import_args(): |
| 1368 |
args = dict() |
| 1369 |
args['import'] = dict(type='bool') |
| 1370 |
return args |
| 1371 |
|
| 1372 |
|
| 1373 |
def get_extra_args_args(): |
| 1374 |
return dict( |
| 1375 |
extra_args=dict(type='str'), |
| 1376 |
) |
| 1377 |
|
| 1378 |
|
| 1379 |
def get_initrd_inject_args(): |
| 1380 |
return dict( |
| 1381 |
initrd_inject=dict(type='str'), |
| 1382 |
) |
| 1383 |
|
| 1384 |
|
| 1385 |
def get_install_args(): |
| 1386 |
return dict( |
| 1387 |
install=dict( |
| 1388 |
type='dict', |
| 1389 |
options=dict( |
| 1390 |
os=dict(type='str', required=True), |
| 1391 |
kernel=dict(type='str'), |
| 1392 |
initrd=dict(type='str'), |
| 1393 |
kernel_args=dict(type='str'), |
| 1394 |
kernel_args_overwrite=dict(type='bool'), |
| 1395 |
bootdev=dict(type='str'), |
| 1396 |
no_install=dict(type='bool'), |
| 1397 |
), |
| 1398 |
), |
| 1399 |
) |
| 1400 |
|
| 1401 |
|
| 1402 |
def get_unattended_args(): |
| 1403 |
return dict( |
| 1404 |
unattended=dict( |
| 1405 |
type='dict', |
| 1406 |
options=dict( |
| 1407 |
profile=dict(type='str'), |
| 1408 |
admin_password_file=dict(type='str'), |
| 1409 |
user_login=dict(type='str'), |
| 1410 |
user_password_file=dict(type='str'), |
| 1411 |
product_key=dict(type='str', no_log=True), |
| 1412 |
), |
| 1413 |
), |
| 1414 |
) |
| 1415 |
|
| 1416 |
|
| 1417 |
def get_cloud_init_args(): |
| 1418 |
return dict( |
| 1419 |
cloud_init=dict( |
| 1420 |
type='dict', |
| 1421 |
options=dict( |
| 1422 |
root_password_generate=dict(type='bool'), |
| 1423 |
disable=dict(type='bool'), |
| 1424 |
root_password_file=dict(type='str'), |
| 1425 |
root_ssh_key=dict(type='str', no_log=True), |
| 1426 |
clouduser_ssh_key=dict(type='str', no_log=True), |
| 1427 |
network_config=dict(type='raw'), |
| 1428 |
meta_data=dict(type='raw'), |
| 1429 |
user_data=dict(type='raw'), |
| 1430 |
), |
| 1431 |
), |
| 1432 |
) |
| 1433 |
|
| 1434 |
|
| 1435 |
def get_boot_args(): |
| 1436 |
return dict( |
| 1437 |
boot=dict(type='str'), |
| 1438 |
boot_opts=dict(type='dict'), |
| 1439 |
) |
| 1440 |
|
| 1441 |
|
| 1442 |
def get_idmap_args(): |
| 1443 |
return dict( |
| 1444 |
idmap=dict( |
| 1445 |
type='dict', |
| 1446 |
options=dict( |
| 1447 |
uid=dict( |
| 1448 |
type='dict', |
| 1449 |
options=dict( |
| 1450 |
start=dict(type='int'), |
| 1451 |
target=dict(type='int'), |
| 1452 |
count=dict(type='int'), |
| 1453 |
), |
| 1454 |
), |
| 1455 |
gid=dict( |
| 1456 |
type='dict', |
| 1457 |
options=dict( |
| 1458 |
start=dict(type='int'), |
| 1459 |
target=dict(type='int'), |
| 1460 |
count=dict(type='int'), |
| 1461 |
), |
| 1462 |
), |
| 1463 |
), |
| 1464 |
), |
| 1465 |
) |
| 1466 |
|
| 1467 |
|
| 1468 |
def get_osinfo_args(): |
| 1469 |
return dict( |
| 1470 |
osinfo=dict( |
| 1471 |
type='dict', |
| 1472 |
options=dict( |
| 1473 |
name=dict(type='str', aliases=['short_id']), |
| 1474 |
id=dict(type='str'), |
| 1475 |
detect=dict(type='bool'), |
| 1476 |
require=dict(type='bool'), |
| 1477 |
), |
| 1478 |
), |
| 1479 |
) |
| 1480 |
|
| 1481 |
|
| 1482 |
def get_disks_args(): |
| 1483 |
return dict( |
| 1484 |
disks=dict( |
| 1485 |
type='list', |
| 1486 |
elements="dict", |
| 1487 |
options=dict( |
| 1488 |
path=dict(type='str'), |
| 1489 |
pool=dict(type='str'), |
| 1490 |
vol=dict(type='str'), |
| 1491 |
size=dict(type='int'), |
| 1492 |
sparse=dict(type='bool'), |
| 1493 |
format=dict(type='str'), |
| 1494 |
backing_store=dict(type='str'), |
| 1495 |
backing_format=dict(type='str'), |
| 1496 |
bus=dict(type='str'), |
| 1497 |
readonly=dict(type='bool'), |
| 1498 |
shareable=dict(type='bool'), |
| 1499 |
cache=dict( |
| 1500 |
type='str', |
| 1501 |
choices=[ |
| 1502 |
"none", |
| 1503 |
"writethrough", |
| 1504 |
"directsync", |
| 1505 |
"unsafe", |
| 1506 |
"writeback", |
| 1507 |
], |
| 1508 |
), |
| 1509 |
serial=dict(type='str'), |
| 1510 |
snapshot=dict( |
| 1511 |
type='str', choices=[ |
| 1512 |
'internal', 'external', 'no']), |
| 1513 |
rawio=dict(type='bool'), |
| 1514 |
sgio=dict(type='str', choices=['filtered', 'unfiltered']), |
| 1515 |
transient=dict(type='bool'), |
| 1516 |
transient_opts=dict( |
| 1517 |
type='dict', options=dict(share_backing=dict(type='bool')) |
| 1518 |
), |
| 1519 |
driver=dict(type='dict'), |
| 1520 |
source=dict(type='dict'), |
| 1521 |
target=dict(type='dict'), |
| 1522 |
address=dict(type='dict'), |
| 1523 |
boot=dict(type='dict'), |
| 1524 |
iotune=dict(type='dict'), |
| 1525 |
blockio=dict(type='dict'), |
| 1526 |
geometry=dict(type='dict'), |
| 1527 |
), |
| 1528 |
), |
| 1529 |
) |
| 1530 |
|
| 1531 |
|
| 1532 |
def get_filesystems_args(): |
| 1533 |
return dict( |
| 1534 |
filesystems=dict( |
| 1535 |
type='list', |
| 1536 |
elements="dict", |
| 1537 |
options=dict( |
| 1538 |
type=dict( |
| 1539 |
type='str', |
| 1540 |
choices=[ |
| 1541 |
'mount', |
| 1542 |
'template', |
| 1543 |
'file', |
| 1544 |
'block', |
| 1545 |
'ram', |
| 1546 |
'bind'], |
| 1547 |
), |
| 1548 |
accessmode=dict( |
| 1549 |
type='str', choices=['passthrough', 'mapped', 'squash'] |
| 1550 |
), |
| 1551 |
source=dict(type='dict'), |
| 1552 |
target=dict(type='dict'), |
| 1553 |
fmode=dict(type='str'), |
| 1554 |
dmode=dict(type='str'), |
| 1555 |
multidevs=dict( |
| 1556 |
type='str', choices=['default', 'remap', 'forbid', 'warn'] |
| 1557 |
), |
| 1558 |
readonly=dict(type='bool'), |
| 1559 |
space_hard_limit=dict(type='int'), |
| 1560 |
space_soft_limit=dict(type='int'), |
| 1561 |
driver=dict(type='dict'), |
| 1562 |
address=dict(type='dict'), |
| 1563 |
binary=dict(type='dict'), |
| 1564 |
), |
| 1565 |
), |
| 1566 |
) |
| 1567 |
|
| 1568 |
|
| 1569 |
def get_networks_args(): |
| 1570 |
return dict( |
| 1571 |
# Network options |
| 1572 |
networks=dict( |
| 1573 |
type='list', |
| 1574 |
elements="dict", |
| 1575 |
options=dict( |
| 1576 |
type=dict(type='str', choices=['direct']), |
| 1577 |
network=dict(type='str'), |
| 1578 |
bridge=dict(type='str'), |
| 1579 |
hostdev=dict(type='str'), |
| 1580 |
source=dict(type='dict'), |
| 1581 |
mac=dict(type='dict', options=dict(address=dict(type='str'))), |
| 1582 |
mtu=dict(type='dict'), |
| 1583 |
state=dict(type='dict'), |
| 1584 |
model=dict(type='dict', options=dict(type=dict(type='str'))), |
| 1585 |
driver=dict(type='dict'), |
| 1586 |
boot=dict(type='dict'), |
| 1587 |
filterref=dict(type='dict'), |
| 1588 |
rom=dict(type='dict'), |
| 1589 |
target=dict(type='dict'), |
| 1590 |
address=dict(type='dict'), |
| 1591 |
virtualport=dict(type='dict'), |
| 1592 |
trust_guest_rx_filters=dict(type='bool'), |
| 1593 |
), |
| 1594 |
), |
| 1595 |
) |
| 1596 |
|
| 1597 |
|
| 1598 |
def get_graphics_args(): |
| 1599 |
return dict( |
| 1600 |
graphics=dict(type='dict'), |
| 1601 |
graphics_devices=dict(type='list', elements="dict"), |
| 1602 |
) |
| 1603 |
|
| 1604 |
|
| 1605 |
def get_virt_type_args(): |
| 1606 |
return dict( |
| 1607 |
# Virtualization options |
| 1608 |
virt_type=dict(type='str'), |
| 1609 |
) |
| 1610 |
|
| 1611 |
|
| 1612 |
def get_hvm_args(): |
| 1613 |
return dict( |
| 1614 |
hvm=dict(type='bool'), |
| 1615 |
) |
| 1616 |
|
| 1617 |
|
| 1618 |
def get_paravirt_args(): |
| 1619 |
return dict( |
| 1620 |
paravirt=dict(type='bool'), |
| 1621 |
) |
| 1622 |
|
| 1623 |
|
| 1624 |
def get_container_args(): |
| 1625 |
return dict( |
| 1626 |
container=dict(type='bool'), |
| 1627 |
) |
| 1628 |
|
| 1629 |
|
| 1630 |
def get_controller_args(): |
| 1631 |
return dict( |
| 1632 |
controller=dict(type='dict'), |
| 1633 |
controller_devices=dict(type='list', elements="dict"), |
| 1634 |
) |
| 1635 |
|
| 1636 |
|
| 1637 |
def get_input_args(): |
| 1638 |
return dict( |
| 1639 |
input=dict(type='dict'), |
| 1640 |
input_devices=dict(type='list', elements="dict"), |
| 1641 |
) |
| 1642 |
|
| 1643 |
|
| 1644 |
def get_hostdev_args(): |
| 1645 |
return dict( |
| 1646 |
hostdev=dict(type='dict'), |
| 1647 |
host_devices=dict(type='list', elements="dict"), |
| 1648 |
) |
| 1649 |
|
| 1650 |
|
| 1651 |
def get_sound_args(): |
| 1652 |
return dict( |
| 1653 |
sound=dict(type='dict'), |
| 1654 |
sound_devices=dict(type='list', elements="dict"), |
| 1655 |
) |
| 1656 |
|
| 1657 |
|
| 1658 |
def get_audio_args(): |
| 1659 |
return dict( |
| 1660 |
audio=dict(type='dict'), |
| 1661 |
audio_devices=dict(type='list', elements="dict"), |
| 1662 |
) |
| 1663 |
|
| 1664 |
|
| 1665 |
def get_watchdog_args(): |
| 1666 |
return dict( |
| 1667 |
watchdog=dict(type='dict'), |
| 1668 |
watchdog_devices=dict(type='list', elements="dict"), |
| 1669 |
) |
| 1670 |
|
| 1671 |
|
| 1672 |
def get_serial_args(): |
| 1673 |
return dict( |
| 1674 |
serial=dict(type='dict'), |
| 1675 |
serial_devices=dict(type='list', elements="dict"), |
| 1676 |
) |
| 1677 |
|
| 1678 |
|
| 1679 |
def get_parallel_args(): |
| 1680 |
return dict( |
| 1681 |
parallel=dict(type='dict'), |
| 1682 |
parallel_devices=dict(type='list', elements="dict"), |
| 1683 |
) |
| 1684 |
|
| 1685 |
|
| 1686 |
def get_channel_args(): |
| 1687 |
return dict( |
| 1688 |
channel=dict(type='dict'), |
| 1689 |
channel_devices=dict(type='list', elements="dict"), |
| 1690 |
) |
| 1691 |
|
| 1692 |
|
| 1693 |
def get_console_args(): |
| 1694 |
return dict( |
| 1695 |
console=dict(type='dict'), |
| 1696 |
console_devices=dict(type='list', elements="dict"), |
| 1697 |
) |
| 1698 |
|
| 1699 |
|
| 1700 |
def get_video_args(): |
| 1701 |
return dict( |
| 1702 |
video=dict(type='dict'), |
| 1703 |
video_devices=dict(type='list', elements="dict"), |
| 1704 |
) |
| 1705 |
|
| 1706 |
|
| 1707 |
def get_smartcard_args(): |
| 1708 |
return dict( |
| 1709 |
smartcard=dict(type='dict'), |
| 1710 |
smartcard_devices=dict(type='list', elements="dict"), |
| 1711 |
) |
| 1712 |
|
| 1713 |
|
| 1714 |
def get_redirdev_args(): |
| 1715 |
return dict( |
| 1716 |
redirdev=dict(type='dict'), |
| 1717 |
redirected_devices=dict(type='list', elements="dict"), |
| 1718 |
) |
| 1719 |
|
| 1720 |
|
| 1721 |
def get_memballoon_args(): |
| 1722 |
return dict( |
| 1723 |
memballoon=dict(type='dict'), |
| 1724 |
memballoon_devices=dict(type='list', elements="dict"), |
| 1725 |
) |
| 1726 |
|
| 1727 |
|
| 1728 |
def get_tpm_args(): |
| 1729 |
return dict( |
| 1730 |
tpm=dict(type='dict'), |
| 1731 |
tpm_devices=dict(type='list', elements="dict"), |
| 1732 |
) |
| 1733 |
|
| 1734 |
|
| 1735 |
def get_rng_args(): |
| 1736 |
return dict( |
| 1737 |
rng=dict(type='dict'), |
| 1738 |
rng_devices=dict(type='list', elements="dict"), |
| 1739 |
) |
| 1740 |
|
| 1741 |
|
| 1742 |
def get_panic_args(): |
| 1743 |
return dict( |
| 1744 |
panic=dict(type='dict'), |
| 1745 |
panic_devices=dict(type='list', elements="dict"), |
| 1746 |
) |
| 1747 |
|
| 1748 |
|
| 1749 |
def get_shmem_args(): |
| 1750 |
return dict( |
| 1751 |
shmem=dict(type='dict'), |
| 1752 |
shmem_devices=dict(type='list', elements="dict"), |
| 1753 |
) |
| 1754 |
|
| 1755 |
|
| 1756 |
def get_vsock_args(): |
| 1757 |
return dict( |
| 1758 |
vsock=dict(type='dict'), |
| 1759 |
vsock_devices=dict(type='list', elements="dict"), |
| 1760 |
) |
| 1761 |
|
| 1762 |
|
| 1763 |
def get_iommu_args(): |
| 1764 |
return dict( |
| 1765 |
iommu=dict(type='dict'), |
| 1766 |
iommu_devices=dict(type='list', elements="dict"), |
| 1767 |
) |
| 1768 |
|
| 1769 |
|
| 1770 |
def get_autostart_args(): |
| 1771 |
return dict( |
| 1772 |
# Miscellaneous options |
| 1773 |
autostart=dict(type='bool'), |
| 1774 |
) |
| 1775 |
|
| 1776 |
|
| 1777 |
def get_transient_args(): |
| 1778 |
return dict( |
| 1779 |
transient=dict(type='bool'), |
| 1780 |
) |
| 1781 |
|
| 1782 |
|
| 1783 |
def get_destroy_on_exit_args(): |
| 1784 |
return dict( |
| 1785 |
destroy_on_exit=dict(type='bool'), |
| 1786 |
) |
| 1787 |
|
| 1788 |
|
| 1789 |
def get_noreboot_args(): |
| 1790 |
return dict( |
| 1791 |
noreboot=dict(type='bool'), |
| 1792 |
) |