vmISOManagement.pl

Version 1

    This script allows you to mount and unmount ISO's that are visible to your ESX(i) servers to a particular VM.

     

    Requirements:

    ESX(i) 4.0 or vCenter 4.0

    vSphere SDK for Perl or vMA 4.0

    VM(s) that have a valid cdrom device

     

    Operations:

    • queryiso

    • mount

    • umount

     

    Sample Execution:

     

    The queryiso operation allows you to search an ESX(i) host that the VM you're trying to perform the operation to locate valid ISO's and provide the user with the necessary input information to mount operation.

     

    [vi-admin@scofield ~][http://reflex.primp-industries.com|http://reflex.primp-industries.com]$ ./vmISOManagement.pl --server reflex.primp-industries.com --vmname VCAP --operation queryiso
    
    Datatstore Name & ISO Path:
    -----------------------------------------------------------------
    \[dlgCore-NFS-bigboi.VM-Backups\] archlinux-2009.02-core-i686.iso
    \[himalaya-local-SATA.RE4-GP:Storage\] OSISO/ubuntu-9.04-server-i386.iso
    \[himalaya-local-SATA.RE4-GP:Storage\] OSISO/client-10.53_sp41183.iso
    \[himalaya-local-SATA.RE4-GP:Storage\] OSISO/gparted-livecd-0.3.4-11.iso
    \[himalaya-local-SATA.RE4-GP:Storage\] OSISO/Archlinux-i686-2007.08-2.core.iso
    \[himalaya-local-SATA.RE4-GP:Storage\] OSISO/echos-SWAK2004.iso
    \[himalaya-local-SATA.RE4-GP:Storage\] OSISO/win2k3adv.iso
    \[himalaya-local-SATA.RE4-GP:Storage\] OSISO/esx-kickstart.iso
    \[himalaya-local-SATA.RE4-GP:Storage\] OSISO/ServerHyper_MUIx2-080912.iso
    \[himalaya-local-SATA.RE4-GP:Storage\] OSISO/esx-DVD-4.0.0-164009.iso
    \[himalaya-local-SATA.RE4-GP:Storage\] OSISO/ubuntu-9.04-server-amd64.iso
    \[himalaya-local-SATA.RE4-GP:Storage\] OSISO/Memtest86_3.5.iso
    \[himalaya-local-SATA.RE4-GP:Storage\] OSISO/VMware-VMvisor-Installer-4.0.0-171294.x86_64.iso
    \[himalaya-local-SATA.RE4-GP:Storage\] OSISO/VMware-VMvisor-InstallerCD-3.5.0_Update_4-153875.i386.iso
    \[himalaya-local-SATA.RE4-GP:Storage\] OSISO/OpenBSD/cdemu39.iso
    \[himalaya-local-SATA.RE4-GP:Storage\] OSISO/OpenBSD/cd39.iso
    \[himalaya-local-SATA.RE4-GP:Storage\] OSISO/VMware-ISOs/VMware-VMvisor-Installer-4.0.0-171294.x86_64.iso
    \[himalaya-local-SATA.RE4-GP:Storage\] OSISO/VMware-ISOs/VMware-VMvisor-InstallerCD-3.5.0_Update_4-153875.i386.iso
    \[himalaya-local-SATA.RE4-GP:Storage\] OSISO/VMware-ISOs/VMware-VIMSetup-all-4.0.0-162902.iso
    
    

     

    This will provide you with both the --datastore name and the --filename path to the ISO that is required when using mount operation.

     

    Let's say we want to mount \[himalaya-local-SATA.RE4-GP:Storage\] OSISO/VMware-ISOs/VMware-VMvisor-Installer-4.0.0-171294.x86_64.iso to a VM called VCAP

     

    [vi-admin@scofield ~][http://reflex.primp-industries.com|http://reflex.primp-industries.com]$ ./vmISOManagement.pl --server reflex.primp-industries.com --vmname VCAP --operation mount --datastore himalaya-local-SATA.RE4-GP:Storage --filename OSISO/VMware-ISOs/VMware-VMvisor-Installer-4.0.0-171294.x86_64.iso
    
    Mounting ISO: "[himalaya-local-SATA.RE4-GP:Storage] OSISO/VMware-ISOs/VMware-VMvisor-Installer-4.0.0-171294.x86_64.iso" to VM: "VCAP" ...
            Successfully added mounted ISO to VM!
    

     

    Let's now unmount the ISO

     

    [vi-admin@scofield ~][http://reflex.primp-industries.com|http://reflex.primp-industries.com]$ ./vmISOManagement.pl --server reflex.primp-industries.com --vmname VCAP --operation umount
    
    Umounting ISO from VM: "VCAP" ...
            Successfully unmounted ISO from VM!