Re: [zones-discuss] zoneadm problem
Terry Smith wrote: > Hi I seem to have found a small problem with zoneadm > > I have configured a zone called "2" in this case. > > I have two running zones with IDs 1 and 2 as below > > When I try and install the zone named "2" it seems to pick up the zone > with the instance ID of 2 instead and gives me an error saying install > operation is invalid for running zones. > > See example below. > > Is this a known issue? > > T > > > # zoneadm list -cv >ID NAME STATUS PATH BRAND >IP > 0 global running/ native >shared > 1 ub running/pools/zones/ublx >shared > 2 c5 running/pools/zones/c5lx >shared > - zclone installed /pools/zones/zclonenative >shared > - centos_zone installed /pools/zones/centos_zone lx >shared > - lxu_zclone installed /pools/zones/lxu_zclonelx >shared > - lxc4_zclone installed /pools/zones/lxc4_zclone lx >shared > - lxc5_zclone installed /pools/zones/lxc5_zclone lx >shared > - 2configured /pools/zones/2 native >shared > # zoneadm -z 2 install > zoneadm: zone '2': install operation is invalid for running zones. I filed the following bug 6700946 zone name of digits confuses zoneadm to track this. Jerry ___ zones-discuss mailing list zones-discuss@opensolaris.org
Re: [zones-discuss] zoneadm problem
On Mon, May 12, 2008 at 4:20 PM, Warren Belfer <[EMAIL PROTECTED]> wrote: > Mike Gerdts wrote: >> On Mon, May 12, 2008 at 3:20 PM, Terry Smith <[EMAIL PROTECTED]> wrote: >>> Hi I seem to have found a small problem with zoneadm >>> >>> I have configured a zone called "2" in this case. >> >> Interesting. Zones shouldn't be able to be named that. >> >> >>>From : >> >> /* >> * Extended Regular expression (see regex(5)) which matches all valid zone >> * names. >> */ >> #define ZONENAME_REGEXP "[a-zA-Z0-9][-_.a-zA-Z0-9]{0,62}" > > Hi, > > Actually, this allows zone names to start with either > [a-z], [A-Z] or [0-9] > > followed by 0 to 62 of any of [-_.a-zA-Z0-9] > > So from this it would seem that "2" is a valid, but perhaps unexpected zone > name. > > HTH, > > Warren Yep - I misread it and the code that does the checking. Either libzonecfg needs to change the notion of what a valid zone name is or it needs to look up by name before looking up by id. Looking up by name before by id is consistent with the behavior required by SUSv2 for commands such as chown(1)[1]. 1. http://www.opengroup.org/onlinepubs/7990989775/xcu/chown.html I would think that all numeric zone names should be discouraged as they will just invite this type of problem. -- Mike Gerdts http://mgerdts.blogspot.com/ ___ zones-discuss mailing list zones-discuss@opensolaris.org
Re: [zones-discuss] zoneadm problem
Mike Gerdts wrote: > On Mon, May 12, 2008 at 3:20 PM, Terry Smith <[EMAIL PROTECTED]> wrote: >> Hi I seem to have found a small problem with zoneadm >> >> I have configured a zone called "2" in this case. > > Interesting. Zones shouldn't be able to be named that. > > >>From : > > /* > * Extended Regular expression (see regex(5)) which matches all valid zone > * names. > */ > #define ZONENAME_REGEXP "[a-zA-Z0-9][-_.a-zA-Z0-9]{0,62}" Hi, Actually, this allows zone names to start with either [a-z], [A-Z] or [0-9] followed by 0 to 62 of any of [-_.a-zA-Z0-9] So from this it would seem that "2" is a valid, but perhaps unexpected zone name. HTH, Warren > That is, a zone name is required to start with a letter. It looks > like code to prevent it has existed in Nevada since Septemer 2005 > (PSARC 2005/485). > > libzonecfg.c: > > 795 int > 796 zonecfg_validate_zonename(const char *zone) > 797 { > 798 int i; > 799 > 800 if (strcmp(zone, GLOBAL_ZONENAME) == 0) > 801 return (Z_BOGUS_ZONE_NAME); > 802 > 803 if (strlen(zone) >= ZONENAME_MAX) > 804 return (Z_BOGUS_ZONE_NAME); > 805 > 806 if (!((zone[0] >= 'a' && zone[0] <= 'z') || > 807 (zone[0] >= 'A' && zone[0] <= 'Z') || > 808 (zone[0] >= '0' && zone[0] <= '9'))) > 809 return (Z_BOGUS_ZONE_NAME); > 810 > 811 for (i = 1; zone[i] != '\0'; i++) { > 812 if (!((zone[i] >= 'a' && zone[i] <= 'z') || > 813 (zone[i] >= 'A' && zone[i] <= 'Z') || > 814 (zone[i] >= '0' && zone[i] <= '9') || > 815 (zone[i] == '-') || (zone[i] == '_') || (zone[i] == > '.'))) > 816 return (Z_BOGUS_ZONE_NAME); > 817 } > 818 > 819 return (Z_OK); > 820 } > > >> When I try and install the zone named "2" it seems to pick up the zone >> with the instance ID of 2 instead and gives me an error saying install >> operation is invalid for running zones. > > The source and man page seem to be out of sync in the argument for the > -z option: > > zoneadm(1M) man page from snv_87: > > SYNOPSIS > zoneadm -z zonename [-u uuid-match] subcommand > [subcommand_options] > > zoneadm [-R root] [-z zonename] [-u uuid-match] list > [list_options] > > zoneadm [-R root] -z zonename [-u uuid-match] mark incomplete > . . . > > -z zonename > > String identifier for a zone. > > > zone_get_id in libzonecfg.c: > >5248 /* first try looking for active zone by id */ >5249 errno = 0; >5250 zoneid = (zoneid_t)strtol(str, &cp, 0); >5251 if (errno == 0 && cp != str && *cp == '\0' && >5252 getzonenamebyid(zoneid, NULL, 0) != -1) { >5253 *zip = zoneid; >5254 return (0); >5255 } >5256 >5257 /* then look for active zone by name */ >5258 if ((zoneid = getzoneidbyname(str)) != -1) { >5259 *zip = zoneid; >5260 return (0); >5261 } > ___ zones-discuss mailing list zones-discuss@opensolaris.org
Re: [zones-discuss] zoneadm problem
On Mon, May 12, 2008 at 3:20 PM, Terry Smith <[EMAIL PROTECTED]> wrote: > Hi I seem to have found a small problem with zoneadm > > I have configured a zone called "2" in this case. Interesting. Zones shouldn't be able to be named that. >From : /* * Extended Regular expression (see regex(5)) which matches all valid zone * names. */ #define ZONENAME_REGEXP "[a-zA-Z0-9][-_.a-zA-Z0-9]{0,62}" That is, a zone name is required to start with a letter. It looks like code to prevent it has existed in Nevada since Septemer 2005 (PSARC 2005/485). libzonecfg.c: 795 int 796 zonecfg_validate_zonename(const char *zone) 797 { 798 int i; 799 800 if (strcmp(zone, GLOBAL_ZONENAME) == 0) 801 return (Z_BOGUS_ZONE_NAME); 802 803 if (strlen(zone) >= ZONENAME_MAX) 804 return (Z_BOGUS_ZONE_NAME); 805 806 if (!((zone[0] >= 'a' && zone[0] <= 'z') || 807 (zone[0] >= 'A' && zone[0] <= 'Z') || 808 (zone[0] >= '0' && zone[0] <= '9'))) 809 return (Z_BOGUS_ZONE_NAME); 810 811 for (i = 1; zone[i] != '\0'; i++) { 812 if (!((zone[i] >= 'a' && zone[i] <= 'z') || 813 (zone[i] >= 'A' && zone[i] <= 'Z') || 814 (zone[i] >= '0' && zone[i] <= '9') || 815 (zone[i] == '-') || (zone[i] == '_') || (zone[i] == '.'))) 816 return (Z_BOGUS_ZONE_NAME); 817 } 818 819 return (Z_OK); 820 } > When I try and install the zone named "2" it seems to pick up the zone > with the instance ID of 2 instead and gives me an error saying install > operation is invalid for running zones. The source and man page seem to be out of sync in the argument for the -z option: zoneadm(1M) man page from snv_87: SYNOPSIS zoneadm -z zonename [-u uuid-match] subcommand [subcommand_options] zoneadm [-R root] [-z zonename] [-u uuid-match] list [list_options] zoneadm [-R root] -z zonename [-u uuid-match] mark incomplete . . . -z zonename String identifier for a zone. zone_get_id in libzonecfg.c: 5248 /* first try looking for active zone by id */ 5249 errno = 0; 5250 zoneid = (zoneid_t)strtol(str, &cp, 0); 5251 if (errno == 0 && cp != str && *cp == '\0' && 5252 getzonenamebyid(zoneid, NULL, 0) != -1) { 5253 *zip = zoneid; 5254 return (0); 5255 } 5256 5257 /* then look for active zone by name */ 5258 if ((zoneid = getzoneidbyname(str)) != -1) { 5259 *zip = zoneid; 5260 return (0); 5261 } -- Mike Gerdts http://mgerdts.blogspot.com/ ___ zones-discuss mailing list zones-discuss@opensolaris.org