Banner
homenieuwsartikelenfoto´sdownloads & linksforumvmug event 2009vmworld
the Dutch VMware User Group: Forums

www.vmug.nl :: View topic - vimsh: commando met potentie?
 Forum FAQForum FAQ   SearchSearch   UsergroupsUsergroups   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

vimsh: commando met potentie?

 
Post new topic   Reply to topic    www.vmug.nl Forum Index -> Scripting op ESX 3.x / VC 2.x
View previous topic :: View next topic  
Author Message
Viktorious
Site Admin
Site Admin


Joined: Nov 10, 2005
Posts: 1317
Location: Zoetermeer

PostPosted: Thu Mar 15, 2007 9:27 am    Post subject: vimsh: commando met potentie? Reply with quote

Op de site van Arne is te lezen hoe je IIS kunt gebruiken voor het uitrollen van ESX updates. Vincent heeft daar weer een perl scriptje gegeven, wat het patchen nog makkelijker maakt.

Het is de bedoeling dat je zelf de host in maintenance mode zet, om daarna het script van Vincent te draaien. Daardoor kwam de vraag: is het niet mogelijk om via het SC je host in maintenace mode te zetten. Het antwoord is: ja! Probeer maar eens dit commando:
Code:

vimsh -n -e /hostsvc/maintenance_mode_enter

Of deze code om de host weer uit maintenance mode te halen:
Code:

vimsh -n -e /hostsvc/maintenance_mode_exit

Best wel cool denk ik! Sla sowieso dit cmd eens in binnen het sc (dus alleen "vimsh") voor nog heel veel meer mogelijkheden. Ik heb er op het internet nog niet zoveel over kunnen vinden, maar het ziet er goed uit allemaal!

* Met dank aan ChrisR Very Happy *
_________________
Viktor van den Berg | www.vmug.nl | VCP/VCI/vExpert
Back to top
View user's profile Send e-mail Visit poster's website
esloof
vMUG Guru
vMUG Guru


Joined: Jul 06, 2005
Posts: 418
Location: Papendrecht

PostPosted: Thu Mar 15, 2007 15:32 pm    Post subject: Reply with quote

Ik heb nog wel een aardige optie gevonden, een commando waarmee je via het service console kunt achterhalen wat voor type kaart in welk PCI slot zit.
Code:
vimsh
[/]$ ?
hostsvc/      ?             
csls                pinfo         puse
internalsvc/  argtype       csuimport     pload         quit
solo/         cls           echo          ploadpath     sleep
vimsvc/       csimport      exit          pls           source
vmsvc/        csinfo        help          puload
[/]$ hostsvc/host
hostconfig    hosthardware  hostsummary
[/]$ hostsvc/hosthardware


Er wordt dan een lijst gegenereerd met bijvoorbeeld het onderstaande blok voor een netwerkkaart.

Code:

      (vim.host.PciDevice) {
         dynamicType = <unset>,
         dynamicProperty = (vmodl.DynamicProperty) [],
         id = "03:01.0",
         classId = 512,
         bus = 3,
         slot = 1,
         function = 0,
         vendorId = 5348,
         subVendorId = 3601,
         vendorName = "Broadcom Corporation",
         deviceId = 5704,
         subDeviceId = 208,
         deviceName = "NC7782 Gigabit Server Adapter (PCI-X, 10,100,1000-T)"


Wie zij er dat het service console niet bij de hardware kon komen ?
Back to top
View user's profile Send e-mail Visit poster's website
ChrisR
vMUG Guru
vMUG Guru


Joined: Apr 28, 2005
Posts: 1023

PostPosted: Fri Mar 16, 2007 0:16 am    Post subject: Reply with quote

zo zijn er ook commando's om vms te maken, disks on the fly te verwijderen en nog veel meer.

met deze tool kan je werkelijk alles scripten wat de vi client zonder vc ook kan.
Back to top
View user's profile Visit poster's website
esloof
vMUG Guru
vMUG Guru


Joined: Jul 06, 2005
Posts: 418
Location: Papendrecht

PostPosted: Fri Mar 16, 2007 8:34 am    Post subject: Reply with quote

De vimsh wrapper maakt uiteindelijk gebruik van de vsh binary, deze kun je ook vanaf het SC interactief starten.

Code:

#!/bin/sh
#
# Wrapper for the real binary. Ensure that the binary will find all
# the shared libraries it needs. If a shared library is not available from any
# of the standard system-wide locations, we provide it from the build
# directory. --hpreg
#

# Use readlink only when necessary: some boxes don't have it, some boxes have
# one that does not support the -f option. --hpreg
if [ -h "$0" ]; then
   this="`readlink -f "$0"`"
else
   this="$0"
fi

libdir=/usr/lib/vmware/hostd
binary=/usr/bin/vsh

abslibdir="`cd \"$libdir\" 2>/dev/null && pwd || echo \"$libdir\"`"
cd $libdir

# Check for request to connect remotely.
extracommands="-e \"vmsvc/connect\" -e \"vmsvc/login\" "
if [ -n "$1" ]; then
   if [ "$1" == "-r" ]; then
       shift
       extracommands=''
   fi
fi

LD_ASSUME_KERNEL=$LD_ASSUME_KERNEL LD_LIBRARY_PATH="$abslibdir" \
   $DEBUG_CMD $binary \
   -e 'csuimport vmdb /' \
   -e 'puse '"$libdir"'/libhostsvc.so' \
   -e 'puse '"$libdir"'/libsolo.so' \
   -e 'puse '"$libdir"'/libvmsvc.so' \
   -e 'puse '"$libdir"'/libvimsvc.so' \
   -e 'puse '"$libdir"'/libinternalsvc.so' \
   $extracommands \
  "$@"


Dan zie je het volgende lijstje:

Code:

[root@foxtrot root]# vsh
[/]$ help
?           connect     equals      pinfo       rget        uwatch
abort       csimport    exit        pload       rls         wait
argtype     csinfo      get         ploadpath   set         watch
begin       csls        help        pls         sleep
bget        csuimport   listen      puload      source
cat         disconnect  localunset  puse        ulisten
cd          echo        ls          pwd         umount
cls         end         mount       quit        unset
[/]$

Back to top
View user's profile Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.vmug.nl Forum Index -> Scripting op ESX 3.x / VC 2.x All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2005 phpBB Group
Forums ©