| Current File : //usr/include/libzoneadm.h |
/*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Private interface for zoneadmd clients. Note that none of these interfaces
* are thread-safe.
*/
#ifndef _LIBZONEADM_H
#define _LIBZONEADM_H
#ifdef __cplusplus
extern "C" {
#endif
#include <libzonecfg.h>
#include <libdladm.h>
#include <zone.h>
#include <pool.h>
#include <hbaapi-sun.h>
/*
* libzoneadm error codes
*/
typedef enum zoneadm_err {
ZONEADM_OK = 0,
ZONEADM_ERR,
ZONEADM_BADARG,
ZONEADM_EBUSY,
ZONEADM_EEXIST,
ZONEADM_ENOENT,
ZONEADM_ENOTSUP,
ZONEADM_ERRNO,
ZONEADM_MODIFIED_LCFG,
ZONEADM_NAMETOOLONG,
ZONEADM_NPIV_H_LOADLIBRARY,
ZONEADM_NPIV_H_OPENADAPTER,
ZONEADM_NPIV_H_OPENADAPTERBYWWN,
ZONEADM_NPIV_H_GETADAPTERNAME,
ZONEADM_NPIV_H_NPIVGETADAPTERATTRIBUTES,
ZONEADM_NPIV_H_GETADAPTERPORTATTRIBUTES,
ZONEADM_NPIV_H_GETPORTNPIVATTRIBUTES,
ZONEADM_NPIV_H_GETNPIVPORTINFO,
ZONEADM_NPIV_H_GETVPORTCAPABILITY,
ZONEADM_NPIV_H_ADAPTERCREATEWWN,
ZONEADM_NPIV_H_CREATENPIVPORT,
ZONEADM_NPIV_H_DELETENPIVPORT,
ZONEADM_NPIV_LIBZONECFG_ERR,
ZONEADM_NPIV_NOT_SUPPORTED,
ZONEADM_NPIV_OVERHBA_INVALID,
ZONEADM_NPIV_OVERHBA_EXCCEEDS_CAP,
ZONEADM_NPIV_OVERHBA_ALL_IN_USE,
ZONEADM_NPIV_PWWN_PHYS_INI_IN_USE,
ZONEADM_NPIV_PWWN_PHYS_TGT_IN_USE,
ZONEADM_NPIV_PWWN_OTHER_NPIV_IN_USE,
ZONEADM_NPIV_PWWN_DISCOVERED_PORT_IN_USE,
ZONEADM_NPIV_PWWN_COLLISION,
ZONEADM_NPIV_PWWN_INVALID,
ZONEADM_SERVICE_DISABLED,
ZONEADM_ZONE_STATE,
ZONEADM_MISSING_ARG
} zoneadm_err_t;
/*
* Extended zoneadm/zonecfg -x suboptions internally known to zoneadm/zonecfg.
*/
typedef enum x_args {
XARGS_OFF = 0,
XARGS_ZP_FORCE_CREATE_ALL,
XARGS_ZP_FORCE_DESTROY_ALL,
XARGS_ZP_FORCE_CREATE,
XARGS_ZP_FORCE_DESTROY,
XARGS_ZP_FORCE_IMPORT,
XARGS_FORCE_TAKEOVER,
XARGS_INIT_HOSTDATA,
XARGS_INIT_HOSTDATA_INC,
XARGS_MIGRATING,
XARGS_STOR_CREATE_MISSING,
XARGS_FORCE_STOR_DES_ALL,
XARGS_MAX
} x_args_t;
/*
* -x suboption strings for install/clone/attach/uninstall handled by zoneadm
* internally and by zonecfg -r.
*/
#define OPT_FORCE_ZPOOL_CREATE_ALL "force-zpool-create-all"
#define OPT_FORCE_ZPOOL_DESTROY_ALL "force-zpool-destroy-all"
#define OPT_FORCE_ZPOOL_CREATE "force-zpool-create"
#define OPT_FORCE_ZPOOL_DESTROY "force-zpool-destroy"
#define OPT_FORCE_ZPOOL_IMPORT "force-zpool-import"
#define OPT_FORCE_TAKEOVER "force-takeover"
#define OPT_INIT_HOSTDATA "initialize-hostdata"
#define OPT_INIT_HOSTDATA_INC "initialize-hostdata-incomplete"
#define OPT_MIGRATING "migrating"
#define OPT_STORAGE_CREATE_MISSING "storage-create-missing"
#define OPT_FORCE_STORAGE_DESTROY_ALL "force-storage-destroy-all"
/*
* Public opaque zoneadm handle to work the libzoneadm library
*/
struct zoneadm_handle;
typedef struct zoneadm_handle *zoneadm_handle_t;
/* Initialize/Destroy the handler */
extern zoneadm_handle_t zoneadm_init(const char *);
extern void zoneadm_fini(zoneadm_handle_t);
extern const char *zoneadm_zonename(zoneadm_handle_t);
/* Error handling */
extern zoneadm_err_t zoneadm_errcode(zoneadm_handle_t);
extern int zoneadm_errno(zoneadm_handle_t);
extern const char *zoneadm_strerror(zoneadm_handle_t);
/* zoneadmd(1M) log */
extern char *zoneadm_log(zoneadm_handle_t);
extern int zoneadm_log_print(FILE *, zoneadm_handle_t);
/* Configuration lock operations */
extern zoneadm_err_t zoneadm_grab_lock_file(zoneadm_handle_t, const char *,
boolean_t);
extern void zoneadm_release_lock_file(zoneadm_handle_t);
/* Communication with zoneadmd(1M) */
extern void zoneadm_init_zone_cmd(zone_cmd_arg_t *, zone_cmd_t, admdflags_t,
const char *);
extern zoneadm_err_t zoneadm_start_zoneadmd(zoneadm_handle_t);
extern zoneadm_err_t zoneadm_ping_zoneadmd(zoneadm_handle_t);
extern zoneadm_err_t zoneadm_call_zoneadmd(zoneadm_handle_t, zone_cmd_arg_t *);
extern zoneadm_err_t zoneadm_call_zoneadmd_fd(zoneadm_handle_t,
zone_cmd_arg_t *, int *, int);
/* Live Zone Reconfiguration */
extern zoneadm_err_t zoneadm_handle_apply(zoneadm_handle_t, zone_dochandle_t,
boolean_t, boolean_t, admdflags_t);
extern zoneadm_err_t zoneadm_get_live_handle(zoneadm_handle_t,
zone_dochandle_t);
extern zoneadm_err_t zoneadm_config_is_stale(zoneadm_handle_t,
zone_dochandle_t);
/* Zone auxiliary state */
extern zoneadm_err_t zoneadm_has_aux_state(zoneadm_handle_t, const char *);
extern zoneadm_err_t zoneadm_get_aux_state(zoneadm_handle_t, char *, size_t,
boolean_t);
extern int zoneadm_has_busy_aux_state(zoneadm_handle_t);
extern int zoneadm_has_dead_aux_state(zoneadm_handle_t);
extern zoneadm_err_t zoneadm_enable_rcapd(zoneadm_handle_t, boolean_t);
/* Runtime verification of the zone configuration */
extern zoneadm_err_t zoneadm_verify_fs(zoneadm_handle_t, zone_fstab_t *);
extern zoneadm_err_t zoneadm_verify_pool(zoneadm_handle_t, const char *);
extern zoneadm_err_t zoneadm_verify_rctl(zoneadm_handle_t, zone_rctltab_t *);
/* Network */
extern zoneadm_err_t zoneadm_verify_anet(zoneadm_handle_t, dladm_handle_t,
zone_anettab_t *);
extern zoneadm_err_t zoneadm_verify_shared_net(zoneadm_handle_t,
zone_nettab_t *);
extern zoneadm_err_t zoneadm_verify_excl_net(zoneadm_handle_t, dladm_handle_t,
zone_nettab_t *);
extern boolean_t zoneadm_ifname_exists(zoneadm_handle_t, sa_family_t,
const char *);
extern int zoneadm_abort_tcp_connections(zoneid_t);
extern void zoneadm_create_pwwn(char *, size_t);
extern char *zoneadm_wwn2str(const HBA_WWN *, char *, size_t);
extern zoneadm_err_t zoneadm_create_vports(zoneadm_handle_t);
extern zoneadm_err_t zoneadm_delete_vports(zoneadm_handle_t);
extern zoneadm_err_t zoneadm_verify_vports(zoneadm_handle_t);
/* Creation of ephemeral zonepath */
extern zoneadm_err_t zoneadm_create_ezp(zoneadm_handle_t, const char *);
extern zoneadm_err_t zoneadm_get_pool(zoneadm_handle_t, pool_conf_t **,
pool_t **);
extern zoneadm_err_t zoneadm_get_pool_pset(zoneadm_handle_t, pool_conf_t *,
pool_t *, pool_resource_t **);
extern zoneadm_err_t zoneadm_get_cpus(zoneadm_handle_t, uint64_t *);
/* Handle -x args for zoneadm and zonecfg */
extern zoneadm_err_t zoneadm_parse_xargs(const char *, x_args_t *);
/* Sanity check of fd prior to passing across zone_enter() */
extern boolean_t zoneadm_fd_allowed_in_zone(int);
extern boolean_t zoneadm_has_dio_device(zoneadm_handle_t);
/* ZOSS zoneadm helper routine to set default suri props */
extern zoneadm_err_t zoneadm_set_default_suri_props(zoneadm_handle_t,
suri_handle_t, nvlist_t **);
/* Convert kzone pattern to path/filename */
extern int zoneadm_kzpattern_to_path(const char *, char *, int, const char *,
const char *);
/* Read cert file for verified-boot */
extern void zoneadm_get_vboot_cert_subject_hash(X509 *, unsigned char *);
extern zoneadm_err_t zoneadm_get_vboot_cert(const char *, X509 **, char **);
#ifdef __cplusplus
}
#endif
#endif /* _LIBZONEADM_H */