[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] "Eject ISO Image" Mechanism Proposal



I am setting up my own dev environment, but in the mean-time I would like to propose the following:

 

PROPOSAL

Auto Ejection of All Mounted CDs

 

PURPOSE

To make application of patches/hotfixes easier in large environments where ISO images may be mounted to VMs

 

TARGET COMPONENTS

XE command line, ie:

xe eject-all-isos

 

XenCenter (API call to eject-all-isos)

 

OR in our XSxxxxx.upadate package format as a pre-req script.

 

EXAMPLE CODE

An example is a file I wrote, xe-eject-all-isos (using Bash for simplicity):

 

#!/bin/bash

 

echo "CHECKING"

 

# Get list of VMs from xe vm-list -- specifically UUID

VMLIST=`xe vm-list is-control-domain=false | grep uuid | awk '{print $5}'`

 

# Loop through list and see if a DVD/CDROM is present

for VMUUID in $VMLIST

do

     VMNAME=`xe vm-list uuid=$VMUUID | grep "name-label" | awk '{print $4}'`

    ISOMOUNTED=`xe vm-cd-list uuid=$VMUUID | grep "empty" | awk '{print $4}'`

 

     if [ "$ISOMOUNTED" = "false" ] ; then

           xe vm-cd-eject uuid=$VMUUID

           echo "UNMOUNTED DVD/CD IMAGE FROM $VMNAME"

     fi     

done

 

# END

echo "DONE"

 

 

 

Sincerely,

 

 

Jesse Benedict, CCA

Citrix, Inc. | XenServer, XenClient Support Team

 

_______________________________________________
Xen-api mailing list
Xen-api@xxxxxxxxxxxxx
http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.