Print this page
Merge cleanup from previous six commits
OS-200 need a better mechanism for storing persistent zone_did
OS-511 make zonecfg device resource extensible, like the net resource
OS-224 add more zonecfg net properties
OS-216 store all net config info on zone
OS-399 zone phys. mem. cap should be a rctl and have associated kstat
        
*** 40,49 ****
--- 40,50 ----
  #include <sys/mount.h>
  #include <priv.h>
  #include <netinet/in.h>
  #include <sys/socket.h>
  #include <net/if.h>
+ #include <sys/mac.h>
  #include <stdio.h>
  #include <rctl.h>
  #include <zone.h>
  #include <libbrand.h>
  #include <sys/uuid.h>
*** 125,134 ****
--- 126,137 ----
  
  #define MAXUSERNAME             (sizeof (((struct utmpx *)0)->ut_name))
  #define MAXAUTHS                4096
  #define ZONE_MGMT_PROF          "Zone Management"
  
+ #define ZONE_INT32SZ            11              /* string to hold 32bit int. */
+ 
  /* Owner, group, and mode (defined by packaging) for the config directory */
  #define ZONE_CONFIG_UID         0               /* root */
  #define ZONE_CONFIG_GID         3               /* sys */
  #define ZONE_CONFIG_MODE        0755
  
*** 148,160 ****
--- 151,165 ----
  #define ALIAS_MAXSHMIDS         "max-shm-ids"
  #define ALIAS_MAXMSGIDS         "max-msg-ids"
  #define ALIAS_MAXSEMIDS         "max-sem-ids"
  #define ALIAS_MAXLOCKEDMEM      "locked"
  #define ALIAS_MAXSWAP           "swap"
+ #define ALIAS_MAXPHYSMEM        "physical"
  #define ALIAS_SHARES            "cpu-shares"
  #define ALIAS_CPUCAP            "cpu-cap"
  #define ALIAS_MAXPROCS          "max-processes"
+ #define ALIAS_ZFSPRI            "zfs-io-priority"
  
  /* Default name for zone detached manifest */
  #define ZONE_DETACHED   "SUNWdetached.xml"
  
  /*
*** 189,207 ****
--- 194,227 ----
          char            zone_fs_type[FSTYPSZ];          /* e.g. ufs */
          zone_fsopt_t   *zone_fs_options;                /* mount options */
          char            zone_fs_raw[MAXPATHLEN];        /* device to fsck */
  };
  
+ /*
+  * Generic resource attribute list.
+  * Key/value resource that can be attached to net or device.
+  */
+ struct zone_res_attrtab {
+         char    zone_res_attr_name[MAXNAMELEN];
+         char    zone_res_attr_value[MAXNAMELEN];
+         struct zone_res_attrtab *zone_res_attr_next;
+ };
+ 
  struct zone_nwiftab {
          char    zone_nwif_address[INET6_ADDRSTRLEN]; /* shared-ip only */
          char    zone_nwif_allowed_address[INET6_ADDRSTRLEN]; /* excl-ip only */
          char    zone_nwif_physical[LIFNAMSIZ];
+         char    zone_nwif_mac[MAXMACADDRLEN];           /* excl-ip only */
+         char    zone_nwif_vlan_id[ZONE_INT32SZ];        /* excl-ip only */
+         char    zone_nwif_gnic[LIFNAMSIZ];              /* excl-ip only */
          char    zone_nwif_defrouter[INET6_ADDRSTRLEN];
+         struct zone_res_attrtab *zone_nwif_attrp;
  };
  
  struct zone_devtab {
          char    zone_dev_match[MAXPATHLEN];
+         struct zone_res_attrtab *zone_dev_attrp;
  };
  
  struct zone_rctlvaltab {
          char    zone_rctlval_priv[MAXNAMELEN];
          char    zone_rctlval_limit[MAXNAMELEN];
*** 228,241 ****
          char    zone_ncpu_min[MAXNAMELEN];
          char    zone_ncpu_max[MAXNAMELEN];
          char    zone_importance[MAXNAMELEN];
  };
  
- struct zone_mcaptab {
-         char    zone_physmem_cap[MAXNAMELEN];
- };
- 
  struct zone_pkgtab {
          char    zone_pkg_name[MAXNAMELEN];
          char    zone_pkg_version[ZONE_PKG_VERSMAX];
  };
  
--- 248,257 ----
*** 315,324 ****
--- 331,342 ----
  extern  int     zonecfg_get_bootargs(zone_dochandle_t, char *, size_t);
  extern  int     zonecfg_set_bootargs(zone_dochandle_t, char *);
  extern  int     zonecfg_get_sched_class(zone_dochandle_t, char *, size_t);
  extern  int     zonecfg_set_sched(zone_dochandle_t, char *);
  extern  int     zonecfg_get_dflt_sched_class(zone_dochandle_t, char *, int);
+ extern  zoneid_t zonecfg_get_did(zone_dochandle_t);
+ extern  void    zonecfg_set_did(zone_dochandle_t);
  
  /*
   * Set/retrieve the brand for the zone
   */
  extern  int     zonecfg_get_brand(zone_dochandle_t, char *, size_t);
*** 339,348 ****
--- 357,375 ----
  extern  void    zonecfg_free_fs_option_list(zone_fsopt_t *);
  extern  int     zonecfg_find_mounts(char *, int(*)(const struct mnttab *,
      void *), void *);
  
  /*
+  * Resource key/value attributes (properties).
+  */
+ extern  int     zonecfg_add_res_attr(struct zone_res_attrtab **,
+     struct zone_res_attrtab *);
+ extern  void    zonecfg_free_res_attr_list(struct zone_res_attrtab *);
+ extern  int     zonecfg_remove_res_attr(struct zone_res_attrtab **,
+     struct zone_res_attrtab *);
+ 
+ /*
   * Network interface configuration.
   */
  extern  int     zonecfg_add_nwif(zone_dochandle_t, struct zone_nwiftab *);
  extern  int     zonecfg_delete_nwif(zone_dochandle_t, struct zone_nwiftab *);
  extern  int     zonecfg_modify_nwif(zone_dochandle_t, struct zone_nwiftab *,
*** 420,436 ****
  extern  int     zonecfg_delete_pset(zone_dochandle_t);
  extern  int     zonecfg_modify_pset(zone_dochandle_t, struct zone_psettab *);
  extern  int     zonecfg_lookup_pset(zone_dochandle_t, struct zone_psettab *);
  
  /*
-  * mem-cap configuration.
-  */
- extern  int     zonecfg_delete_mcap(zone_dochandle_t);
- extern  int     zonecfg_modify_mcap(zone_dochandle_t, struct zone_mcaptab *);
- extern  int     zonecfg_lookup_mcap(zone_dochandle_t, struct zone_mcaptab *);
- 
- /*
   * Temporary pool support functions.
   */
  extern  int     zonecfg_destroy_tmp_pool(char *, char *, int);
  extern  int     zonecfg_bind_tmp_pool(zone_dochandle_t, zoneid_t, char *, int);
  extern  int     zonecfg_bind_pool(zone_dochandle_t, zoneid_t, char *, int);
--- 447,456 ----
*** 483,493 ****
  extern  int     zonecfg_endrctlent(zone_dochandle_t);
  extern  int     zonecfg_setdsent(zone_dochandle_t);
  extern  int     zonecfg_getdsent(zone_dochandle_t, struct zone_dstab *);
  extern  int     zonecfg_enddsent(zone_dochandle_t);
  extern  int     zonecfg_getpsetent(zone_dochandle_t, struct zone_psettab *);
- extern  int     zonecfg_getmcapent(zone_dochandle_t, struct zone_mcaptab *);
  extern  int     zonecfg_getpkgdata(zone_dochandle_t, uu_avl_pool_t *,
      uu_avl_t *);
  extern  int     zonecfg_setdevperment(zone_dochandle_t);
  extern  int     zonecfg_getdevperment(zone_dochandle_t,
      struct zone_devpermtab *);
--- 503,512 ----
*** 507,525 ****
--- 526,546 ----
  
  /*
   * Higher-level routines.
   */
  extern  int     zone_get_brand(char *, char *, size_t);
+ extern  zoneid_t zone_get_did(char *);
  extern  int     zone_get_rootpath(char *, char *, size_t);
  extern  int     zone_get_devroot(char *, char *, size_t);
  extern  int     zone_get_zonepath(char *, char *, size_t);
  extern  int     zone_get_state(char *, zone_state_t *);
  extern  int     zone_set_state(char *, zone_state_t);
  extern  char    *zone_state_str(zone_state_t);
  extern  int     zonecfg_get_name_by_uuid(const uuid_t, char *, size_t);
  extern  int     zonecfg_get_uuid(const char *, uuid_t);
  extern  int     zonecfg_default_brand(char *, size_t);
+ extern  int     zonecfg_fix_obsolete(zone_dochandle_t);
  
  /*
   * Iterator for configured zones.
   */
  extern FILE             *setzoneent(void);