changeset 25434:1cdaa18973ab

[illumos-gate merge] commit c3e16711de8a1209bb0e4ad2a003d0b443426f17 13191 Improve net-tests zone vnic add/delete commit 6310a43a82652c7bf86384a7ab264bd3bfe2b23c 13189 Update rename(2) man page
author Jerry Jelinek <jerry.jelinek@joyent.com>
date Thu, 01 Oct 2020 11:31:50 +0000
parents 871cc4355352 (current diff) aaaebce14ba9 (diff)
children 19710a8ace43
files usr/src/test/net-tests/tests/net_common.ksh
diffstat 2 files changed, 10 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/man/man2/rename.2	Wed Sep 30 12:31:40 2020 -0500
+++ b/usr/src/man/man2/rename.2	Thu Oct 01 11:31:50 2020 +0000
@@ -4,11 +4,10 @@
 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH RENAME 2 "Oct 4, 2007"
+.TH RENAME 2 "Sep 29, 2020"
 .SH NAME
 rename, renameat \- change the name of a file
 .SH SYNOPSIS
-.LP
 .nf
 #include <stdio.h>
 
@@ -24,7 +23,6 @@
 .fi
 
 .SS "XPG3"
-.LP
 .nf
 #include <unistd.h>
 
@@ -32,8 +30,6 @@
 .fi
 
 .SH DESCRIPTION
-.sp
-.LP
 The  \fBrename()\fR function changes the name of a file. The \fIold\fR argument
 points to the pathname of the file to be renamed. The \fInew\fR argument points
 to the new path name of the file.
@@ -155,14 +151,10 @@
 will mark for update the \fBst_ctime\fR and \fBst_mtime\fR fields of the parent
 directory of each file.
 .SH RETURN VALUES
-.sp
-.LP
 Upon successful completion, \fB0\fR is returned. Otherwise, \fB\(mi1\fR is
 returned and \fBerrno\fR is set to indicate an error.
 .SH ERRORS
-.sp
-.LP
-The \fBrename()\fR function will fail if:
+The \fBrename()\fR and \fBrenameat()\fR functions will fail if:
 .sp
 .ne 2
 .na
@@ -335,7 +327,7 @@
 
 .sp
 .LP
-The \fBrenameat()\fR functions will fail if:
+The \fBrenameat()\fR function will fail if:
 .sp
 .ne 2
 .na
@@ -347,8 +339,6 @@
 .RE
 
 .SH ATTRIBUTES
-.sp
-.LP
 See \fBattributes\fR(5) for descriptions of the following attributes:
 .sp
 
@@ -367,13 +357,9 @@
 .TE
 
 .SH SEE ALSO
-.sp
-.LP
 \fBchmod\fR(2), \fBlink\fR(2), \fBunlink\fR(2), \fBattributes\fR(5),
 \fBfsattr\fR(5), \fBstandards\fR(5)
 .SH NOTES
-.sp
-.LP
 The system can deadlock if there is a loop in the file system graph. Such a
 loop can occur if there is an entry in directory \fBa\fR, \fBa/name1\fR, that
 is a hard link to directory \fBb\fR, and an entry in directory \fBb\fR,
--- a/usr/src/test/net-tests/tests/net_common.ksh	Wed Sep 30 12:31:40 2020 -0500
+++ b/usr/src/test/net-tests/tests/net_common.ksh	Thu Oct 01 11:31:50 2020 +0000
@@ -11,6 +11,7 @@
 
 #
 # Copyright 2019 Joyent, Inc.
+# Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
 #
 
 #
@@ -214,31 +215,14 @@
 	fi
 
 	dbg "creating VNIC: $vnic_info"
-	if ! dladm create-vnic -t -l $over $vid_opt $name > /dev/null 2>&1
+	if dladm create-vnic -l $over $vid_opt $name > /dev/null 2>&1 && \
+	    dladm set-linkprop -t -p zone=$zone $name > /dev/null 2>&1
 	then
-		maybe_fail "$err"
-		return 1
-	fi
-
-	dbg "created VNIC: $vnic_info"
-	if ! zonecfg -z $zone "add net; set physical=$name; end"; then
-		maybe_fail "failed to assign $name to $zone"
-		return 1
-	fi
-
-	dbg "assigned VNIC $name to $zone"
-	if zoneadm -z $zone reboot; then
-		dbg "rebooted $zone"
-		#
-		# Make sure the vnic is visible before returning. Without this
-		# a create_addr command following immediately afterwards could
-		# fail because the zone is up but the vnic isn't visible yet.
-		#
-		sleep 1
+		dbg "created VNIC: $vnic_info"
 		return 0
 	fi
 
-	maybe_fail "failed to reboot $zone"
+	maybe_fail "$err"
 }
 
 function delete_vnic
@@ -255,13 +239,8 @@
 	fi
 
 	dbg "assigning VNIC $name from $zone to GZ"
-
-	if ! zonecfg -z $zone "remove net physical=$name"; then
-		maybe_fail "failed to remove $name from $zone"
-		return 1
-	fi
-	if ! zoneadm -z $zone reboot; then
-		maybe_fail "failed to reboot $zone"
+	if ! dladm set-linkprop -t -p zone=global $name; then
+		maybe_fail "$err1"
 		return 1
 	fi