On Fri, Nov 14, 2008 at 12:17:18PM -0800, [EMAIL PROTECTED] wrote: > >The ipagent code didn't work so well, so we have to temporarily replace > >a couple of the files from it: > > Are we certain this set of changes will work in the Live CD > environment?
Yes, I tested domU live+post-install and Jack tested real hardware as well. > >http://cr.opensolaris.org/~johnlev/osol-xvm-ipagent/ > > src/util/distro-import/101a/i386/SUNWxvmipa > src/util/distro-import/101a/svc-ipagent > src/util/distro-import/Makefile Nits fixed, webrev re-generated, patch for commit below thanks john # HG changeset patch # User John Levon <[EMAIL PROTECTED]> # Date 1226848209 28800 # Node ID 7edce92aee1b4451214dc8d77c88418c2eb590c9 # Parent 1b1a90aa201f78b28b37ebd4dc8fcfef4f129c66 3885 Enable the xvm/ipagent service on the live CD diff --git a/src/util/distro-import/101a/SUNWfixes.prototype b/src/util/distro-import/101a/SUNWfixes.prototype --- a/src/util/distro-import/101a/SUNWfixes.prototype +++ b/src/util/distro-import/101a/SUNWfixes.prototype @@ -28,6 +28,7 @@ e none kernel/drv/sd.conf 0644 root sys f none lib/svc/method/sshd 0555 root bin f none lib/svc/method/svc-coreadm 0555 root bin +f none lib/svc/method/svc-ipagent 0555 root bin f none lib/svc/method/xvm-vnc-config 0555 root bin d none root 0700 root root e none root/.bashrc 0644 root root @@ -45,11 +46,13 @@ f none usr/jdk/instances/jdk1.6.0/jre/lib/fontconfig.properties 0644 root bin f none usr/lib/vp-services 0555 root bin f none usr/lib/vp-shares 0555 root bin +f none usr/lib/xen/bin/ipagent 0755 root bin f none usr/share/applications/services.desktop 0644 root bin f none usr/share/applications/shares.desktop 0644 root bin f none usr/share/man/man.cf 0644 root bin f none var/svc/manifest/application/graphical-login/gdm.xml 444 root sys f none var/svc/manifest/system/coreadm.xml 444 root sys +f none var/svc/manifest/system/ipagent.xml 444 root sys f none var/svc/manifest/system/xvm/vnc-config.xml 444 root sys f none var/svc/profile/generic_limited_net.xml 0444 root sys f none var/svc/profile/generic_open.xml 0444 root sys diff --git a/src/util/distro-import/101a/generic_limited_net.xml b/src/util/distro-import/101a/generic_limited_net.xml --- a/src/util/distro-import/101a/generic_limited_net.xml +++ b/src/util/distro-import/101a/generic_limited_net.xml @@ -343,4 +343,8 @@ <instance name='default' enabled='true'/> </service> + <service name='system/xvm/ipagent' version='1' type='service'> + <instance name='default' enabled='true'/> + </service> + </service_bundle> diff --git a/src/util/distro-import/101a/generic_open.xml b/src/util/distro-import/101a/generic_open.xml --- a/src/util/distro-import/101a/generic_open.xml +++ b/src/util/distro-import/101a/generic_open.xml @@ -192,4 +192,8 @@ <instance name='default' enabled='true'/> </service> + <service name='system/xvm/ipagent' version='1' type='service'> + <instance name='default' enabled='true'/> + </service> + </service_bundle> diff --git a/src/util/distro-import/101a/i386/SUNWxvmipa b/src/util/distro-import/101a/i386/SUNWxvmipa new file mode 100644 --- /dev/null +++ b/src/util/distro-import/101a/i386/SUNWxvmipa @@ -0,0 +1,17 @@ +package SUNWxvmipa +classification "System/Virtualization" +import SUNWxvmipar +# Incorrectly depends on a SUNWxvm file +drop lib/svc/method/svc-ipagent +# missing dependencies +drop var/svc/manifest/system/ipagent.xml +import SUNWxvmipau +# broken for IPv6 +drop usr/lib/xen/bin/ipagent +from SUNWfixes import +lib/svc/method/svc-ipagent +usr/lib/xen/bin/ipagent +var/svc/manifest/system/ipagent.xml +end import +depend SUNWxvmdom +end package diff --git a/src/util/distro-import/101a/ipagent b/src/util/distro-import/101a/ipagent new file mode 100644 --- /dev/null +++ b/src/util/distro-import/101a/ipagent @@ -0,0 +1,116 @@ +#!/bin/ksh +# +# CDDL HEADER START +# +# 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] +# +# CDDL HEADER END +# + +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. + +# +# xVM PV domU IP address reporting agent. Reports IP address back to dom0. +# + +interval=$1 + +xs_ipaddr_path="ipaddr/0" +xs_link_path="device-misc/vif/default-link" +link="" + +# +# Look for a valid-seeming address for the given link. Return 0 on success. +# +link_to_addr() +{ + tmp=`netstat -I $1 -in -f inet | awk '{print $4}' | grep -v Address`; + if [ -z "$tmp" ] || [ "$tmp" = "0.0.0.0" ]; + then + addr="(none)"; + return 1; + fi + + addr=$tmp; + return 0; +} + +default_link() +{ + # + # Look in the store for a cached link name. + # + link=`/usr/lib/xen/bin/xenstore-read $xs_link_path 2>/dev/null` + if [ -z "$link" ] || [ "$link" = "(none)" ] + then + # + # If it's not there, try to determine what it is + # and add it to the store. + determine_default_link + fi +} + +# +# Determine the default link name and update xenstore with the details. +# +determine_default_link() +{ + link="(none)"; + # + # Choose the first up, non-loopback interface with a valid-looking + # IP address. + # + dladm show-link -p -o link,state | while IFS=: read LINKNAME STATE; + do + if [ "$STATE" = "up" ]; + then + link_to_addr "$LINKNAME" + if [ $? -eq 0 ]; then link=$LINKNAME; break; fi + fi + + done + + /usr/lib/xen/bin/xenstore-write $xs_link_path $link +} + +while true; do + + # + # Determine the default link in use by this domU. + # + default_link; + + # + # If the link still has a valid-looking IP address, notify dom0 of its + # address. + # + link_to_addr $link + if [ $? -ne 0 ] + then + # + # An address could not be determined for the currently cached + # default link so determine it again in case it has changed. + # We'll still sleep this iteration to rate-limit dladm calls. + # + determine_default_link; + fi + + /usr/lib/xen/bin/xenstore-write $xs_ipaddr_path $addr + + sleep $interval +done + diff --git a/src/util/distro-import/101a/ipagent.xml b/src/util/distro-import/101a/ipagent.xml new file mode 100644 --- /dev/null +++ b/src/util/distro-import/101a/ipagent.xml @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> +<!-- + Copyright 2008 Sun Microsystems, Inc. All rights reserved. + Use is subject to license terms. + + CDDL HEADER START + + 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] + + CDDL HEADER END + + NOTE: This service manifest is not editable; its contents will + be overwritten by package or patch operations, including + operating system upgrade. Make customizations in a different + file. +--> + +<service_bundle type='manifest' name='SUNWxvmdom:ipagent'> + +<service + name='system/xvm/ipagent' type='service' version='1'> + <create_default_instance enabled='false'/> + <single_instance /> + + <dependency + name='local' + type='service' + grouping='require_all' + restart_on='none'> + <service_fmri value='svc:/system/filesystem/local' /> + </dependency> + + <exec_method + type='method' + name='start' + exec='/lib/svc/method/svc-ipagent %m %{config/report_interval}' + timeout_seconds='60'> + <method_context> + <method_credential user='root' /> + </method_context> + </exec_method> + + <exec_method + type='method' + name='stop' + exec=':kill' + timeout_seconds='60' /> + + <property_group name='config' type='application'> + <stability value='Unstable' /> + <propval name='report_interval' type='integer' value='60' /> + </property_group> + + <stability value='Unstable' /> + + <template> + <common_name> + <loctext xml:lang='C'> + xVM PV domU IP address reporting agent + </loctext> + </common_name> + <documentation> + <manpage title='xVM' section='5' + manpath='/usr/share/man' /> + </documentation> + </template> +</service> + +</service_bundle> diff --git a/src/util/distro-import/101a/svc-ipagent b/src/util/distro-import/101a/svc-ipagent new file mode 100755 --- /dev/null +++ b/src/util/distro-import/101a/svc-ipagent @@ -0,0 +1,61 @@ +#!/bin/ksh +# +# CDDL HEADER START +# +# 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] +# +# CDDL HEADER END +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. + +interval=$2 + +. /lib/svc/share/smf_include.sh + +check_is_domu() +{ + if [ `uname -p` != "i386" -o `uname -i` != "i86xpv" ]; then + echo "This service will only run in a PV xVM domU." + svcadm disable -t svc:/system/xvm/ipagent:default + exit $SMF_EXIT_OK + fi + + /usr/sbin/devfsadm -i domcaps + domcaps=`cat /dev/xen/domcaps 2>/dev/null` + echo "$domcaps" | grep "control_d" > /dev/null + if [ $? = 0 ]; then + echo "This service will only run in a PV xVM domU." + svcadm disable -t svc:/system/xvm/ipagent:default + exit $SMF_EXIT_OK + fi +} + +case $1 in +'start') + check_is_domu + + /usr/lib/xen/bin/ipagent $interval & + + ;; + +*) + echo "Usage: $0 start [report_interval]" + exit 1 + ;; +esac + +exit $? diff --git a/src/util/distro-import/Makefile b/src/util/distro-import/Makefile --- a/src/util/distro-import/Makefile +++ b/src/util/distro-import/Makefile @@ -106,6 +106,7 @@ lib/svc/method/sshd \ lib/svc/method/svc-coreadm \ lib/svc/method/svc-dlmgmtd \ + lib/svc/method/svc-ipagent \ lib/svc/method/xvm-vnc-config \ root/.bashrc \ root/.profile \ @@ -113,8 +114,10 @@ usr/jdk/instances/jdk1.6.0/jre/lib/fontconfig.properties \ usr/lib/vp-services \ usr/lib/vp-shares \ + usr/lib/xen/bin/ipagent \ var/svc/manifest/application/graphical-login/gdm.xml \ var/svc/manifest/system/coreadm.xml \ + var/svc/manifest/system/ipagent.xml \ var/svc/manifest/system/xvm/vnc-config.xml \ var/svc/profile/generic_limited_net.xml \ var/svc/profile/generic_open.xml @@ -339,7 +342,7 @@ mkdir -p proto/usr/bin mkdir -p proto/usr/has/bin mkdir -p proto/usr/jdk/instances/jdk1.6.0/jre/lib - mkdir -p proto/usr/lib + mkdir -p proto/usr/lib/xen/bin mkdir -p proto/usr/sbin mkdir -p proto/usr/share/applications mkdir -p proto/usr/share/man _______________________________________________ xen-discuss mailing list [email protected]
