live.zvmtasks
Class ZVMTasks

java.lang.Object
  extended bylive.zvmtasks.ZVMTasks

public class ZVMTasks
extends Object

ZVMTasks is a library of functions that perform some user oriented task on a z/VM system. It makes extensive use of the SMAPIWrapper library.

Author:
Jason J. Herne

Nested Class Summary
static interface ZVMTasks.getCommonAddressProgressListener
           
 
Field Summary
static String PROFILE_GENERAL
           
static String PROFILE_SUPER
           
static String SEG_BUILDER
           
private  SMAPI_Interface smapi
           
 
Constructor Summary
ZVMTasks(String hostName, int port, String userName, String password)
          Creates a new instance of ZVMTasks.
 
Method Summary
 LinkedList activeImagesQuery()
          This function returns a LinkedList of all active guests Wraps SMAPI_Interface.activeImagesQuery().
 boolean authenticate()
          Tests whether this user can authenticate to the SMAPI server.
 LinkedList changeGuestsDirectory(LinkedList existGuestDirectory, String cloneGuestName, String clonePassword)
          This function will go through and update and make the clone's directory the same as the existing guest's and will return a list of the minidisks for either creation or copying Wraps SMAPI_Interface.imageReplace(String, LinkedList).
 void changeMemory(String guestName, String newInitMem, String newMaxMem)
          This function changes the initial and maximum allotted memory for a guest Wraps SMAPI_Interface.imageReplace(String, LinkedList)
 LinkedList cloneCopyMDisks(LinkedList existGuestDirectory, String cloneGuestName, String clonePassword, String existGuestName)
          Takes an existing Guest Directory, takes out DEDICATE and SPECIAL statements takes MDISK statements and copies each one of the disks Wraps SMAPI_Interface.imageDiskCopyDM(String, String, String, String, String, String, String, String, String).
 LinkedList cloneCreateMDisks(LinkedList existGuestDirectory, String cloneGuestName, String clonePassword, boolean formatDisks)
          Takes an existing Guest Directory, takes out DEDICATE and SPECIAL statements takes MDISK statements and creates a list of minidisks for the clone of the same size, type etc Wraps SMAPI_Interface.imageDiskCreateDM(String, String, String, String, String, String, String, String, String, String).
 LinkedList cloneGuest(String existGuestName, String cloneGuestName, String clonePassword, boolean cloneDisks, boolean formatDisks)
          This function will clone an existing guest by copying all it's characteristics (except password) to a new guest Wraps SMAPI_Interface.imageCreate(String, String, String).
 String convertSizeToCylinders(MDisk disk)
          Converts the size of a disk from megabytes to numbers of cylinders or blocks
 String convertSizetoMB(MDisk disk)
          Converts the size of a minidisk from blocks or cylinders to MB
 void createGuest(String guestName, String password, String initMem, String maxMem, String prototypeName)
          This function creates a new guest with certain specified characteristics Wraps SMAPI_Interface.imageCreate(String, String, String).
 void createMDisk(String strGuestName, String strVirtualDeviceAddress, String strAllocationType, String strDiskSize, String strDiskMode, String strReadPW, String strWritePW, String strMultiPW)
          This function creates a new minidisk for a particular user Wraps SMAPI_Interface.imageDiskCreate(String, String, String, String, String, String, String, String, String, String).
 void deleteImage(String imageName)
          Deletes a guest Wraps SMAPI_Interface.imageDelete(String).
 void deleteMDisk(String strGuestName, String strVirtualDeviceAddress)
          This function deletes a minidisk for a particular user Wraps SMAPI_Interface.imageDiskDeleteDM(String, String) Wraps SMAPI_Interface.imageDiskDelete(String, String).
private  void ensurePrototypeExists(String prototypeName)
          This function makes sure that the given prototype exists, if it does not, it creates it (this will probably be used at server startup for our generic prototype) Wraps SMAPI_Interface.prototypeCreate(String, LinkedList).
 String findNICaddress(String strGuestName)
          Finds the lowest block of address space available for use as a virtual NIC Wraps SMAPI_Interface.getLowestFreeAddress(String, String) NOT CURRENTLY USED
 LinkedList getAllFreeAddresses(Collection memberNames, ZVMTasks.getCommonAddressProgressListener listener)
          Takes a list of member names and returns a LinkedList of LinkedLists of all their free addresses (gaps being bigger than 3 addresses so we can use the addresses for virtual NIC addresses)
 LinkedList getAllNetworkNames()
          Returns a LinkedList of all networks and their members Wraps SMAPI_Interface.queryNetworkMembers(String)
 String getCommonAddress(Collection memberNames)
          Overloaded call of the original
 String getCommonAddress(Collection memberNames, ZVMTasks.getCommonAddressProgressListener listener)
          Takes a list of guests and finds the lowest available common NIC address amongst them
 LinkedList getGroups()
          This function gets all the namelist names and contents from the server and puts them in a list of Group objects Wraps SMAPI_Interface.nameListQueryAll().
 Network getNetworkInfo(String NetName)
          Queries the information for a given network Wraps SMAPI_Interface.virtualLanQuery().
 Network getNetworkMembers(String strNetName)
          Queries the members of a particular VSwitch Wraps SMAPI_Interface.queryNetworkMembers(String).
 String getNICaddress(String strNetworkName, String strGuestName)
          Queries a network for a specified guest and returns that guest's virtual NIC Wraps SMAPI_Interface.getNICaddress(String, String)
private  String getPageRangeFromGuests(LinkedList guests, String segSizeInMB)
          Given a list of guests, they will all be querried and a page range will be returned that is above all of the guests address spaces and that is not currently being used for any shared segment.
 LinkedList getStorageGaps(String imageName)
          Returns all the virtual address gaps for a user Wraps SMAPI_Interface.returnQueryVirtual(String).
 void guestLANCreate(String lanName)
          Creates a new Guest LAN with no one attached to it SMAPI_Interface.virtualLANCreate(String)
 void guestLANCreateConnect(String lanName, String guestName, String vaddr)
          Creates a new Guest LAN and attaches a guest to it with a virtual NIC of the specified address Wraps SMAPI_Interface.virtualLANCreateAndConnectDM(String, String, String) & SMAPI_Interface.virtualLANCreateAndConnect(String, String).
 void guestLANDeleteDisconnect(String lanName, String guestName, String vaddr)
          Disconnects a guest (with a specified NIC address) from a LAN and deletes the LAN if it is the last guest on the LAN Wraps SMAPI_Interface.virtualLANDisconnectAndDeleteDM(String, String, String) & SMAPI_Interface.virtualLANDisconnectAndDelete(String, String, String)
 void imageActivate(String imageName)
          This function activates a guest Wraps SMAPI_Interface.imageActivate(String).
 void imageDeactivate(String imageName)
          This function deactivates a guest Wraps SMAPI_Interface.imageDeactivate(String).
private  Vector parseQueryVirtual(LinkedList queryRes, int addrtype)
          Sorts through the results of query virtual, and returns a vector of sorted addresses with no duplicates
 LinkedList queryAllGuestNames()
          Queries all the guests on the system.
 LinkedList queryAllNetworks()
          Returns a linkedlist of Networks.
 Guest queryGuest(String guestName)
          This function queries the characteristics of a guest Wraps SMAPI_Interface.imageQuery(String).
 LinkedList queryMDisks(String strGuestName)
          This function queries minidisks for a particular user Wraps SMAPI_Interface.imageQuery(String).
 void setGuestPassword(String strGuestName, String strPassword)
          This function sets a guest's password Wraps SMAPI_Interface.imageSetPassword(String, String).
 void setGuestsGroup(String imageName, String oldGroupName, String newGroupName)
          Removes/adds a guest to/from a group.
 void shareDisk(String sourceGuest, String sourceVaddr, String destGuest, String destVaddr, String accessMode)
          Creates a minidisk link for a user that allows that user to gain access to another guests minidisk Wraps SMAPI_Interface.imageDiskShare(String, String, String, String, String, String).
 void sharedStorageAccessAdd(String guestName, String segmentName)
           
 boolean sharedStorageAccessQuery(String guestName, String segmentName)
           
 LinkedList sharedStorageAccessQueryNameList(String segmentName)
          Gets the name list with the access information for a saved segment Wraps SMAPI_Interface.nameListQuery(String).
 void sharedStorageAccessRemove(String guestName, String segmentName)
          Revokes a guest's access to a saved segment Wraps SMAPI_Interface.sharedStorageRemoveAccess(String, String).
 void sharedStorageCreate(String segName, String segSizeInMB, LinkedList guestsToAdd)
          Creates a new shared segment given the name of the segment, its size and a list of guests you wish to eventually add to the segment.
 void sharedStorageDelete(String segName)
          Deletes a shared storage segment, given the name.
 LinkedList sharedStorageQuery()
          Returns a linkedlist of SavedSegment objects that correspond to the shared segments that exist on the system Wraps SMAPI_Interface.sharedStorageQuery().
 void unshareDisk(String sourceGuest, String sourceVaddr, String destGuest, String destVaddr)
          Removes a minidisk link from a guest Wraps SMAPI_Interface.imageDiskUnshare(String, String, String, String).
 void virtualSwitchCreate(String lanName, String portname, String raddr)
          Creates a new VSwitch with no one attached to it Wraps SMAPI_Interface.virtualSwitchCreate(String, String, String)
 void virtualSwitchCreateConnect(String lanName, String guestName, String vaddr, String portname, String raddr)
          Creates a new VSwitch and attaches a guest to it with a virtual NIC of the specified address Wraps SMAPI_Interface.virtualSwitchCreateAndConnectDM(String, String, String, String, String) & SMAPI_Interface.virtualSwitchCreateAndConnect(String, String, String, String, String).
 void virtualSwitchDelete(String switchName)
          Deletes a VSwitch, even if there are people connected to it Wraps SMAPI_Interface.virtualSwitchDelete(String)
 void virtualSwitchDetatch(String switchName, String guestName)
          Detaches a guest from a VSwitch WrapsSMAPI_Interface.virtualSwitchDisconnectAndDeleteDM(String, String, String) & SMAPI_Interface.virtualSwitchDetatch(String, String)
 void virtualSwitchGrant(String switchName, String userName)
          Grants a user (already connected) access to a VSwitch Wraps SMAPI_Interface.virtualSwitchSet(String, String, String)
 void virtualSwitchRevoke(String switchName, String userName)
          Restricts a user from being on a VSwitch's authorized list Wraps SMAPI_Interface.virtualSwitchSet(String, String, String)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

smapi

private SMAPI_Interface smapi

PROFILE_GENERAL

public static final String PROFILE_GENERAL
See Also:
Constant Field Values

PROFILE_SUPER

public static final String PROFILE_SUPER
See Also:
Constant Field Values

SEG_BUILDER

public static final String SEG_BUILDER
See Also:
Constant Field Values
Constructor Detail

ZVMTasks

public ZVMTasks(String hostName,
                int port,
                String userName,
                String password)
Creates a new instance of ZVMTasks.

Parameters:
hostName - Name or number of the host
port - Port number
userName - Authenticated user name
password - User's password
Method Detail

authenticate

public boolean authenticate()
                     throws ZVMTasksException
Tests whether this user can authenticate to the SMAPI server. Wraps (@link live.smapi.SMAPI_Interface#nullRequest()}

Returns:
True if authentication succeeded.
Throws:
ZVMTasksException

queryAllNetworks

public LinkedList queryAllNetworks()
                            throws ZVMTasksException
Returns a linkedlist of Networks. Each Network is populated with its name and network type (Guest LAN or VSwitch) Wraps SMAPI_Interface.virtualLanQuery()

Returns:
Linkedlist of Networks on the z/VM system.
Throws:
ZVMTasksException

queryAllGuestNames

public LinkedList queryAllGuestNames()
                              throws ZVMTasksException
Queries all the guests on the system. Returns a LinkedList of Strings. Each String is the name of a guest on the system. Wraps SMAPI_Interface.imageNameQuery()

Returns:
LinkedList of guest names on the z/VM system.
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

guestLANCreateConnect

public void guestLANCreateConnect(String lanName,
                                  String guestName,
                                  String vaddr)
                           throws ZVMTasksException
Creates a new Guest LAN and attaches a guest to it with a virtual NIC of the specified address Wraps SMAPI_Interface.virtualLANCreateAndConnectDM(String, String, String) & SMAPI_Interface.virtualLANCreateAndConnect(String, String).

Parameters:
lanName - Name of LAN to create
guestName - Name of guest to connect
vaddr - Virtual address to create NIC at
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

guestLANCreate

public void guestLANCreate(String lanName)
                    throws ZVMTasksException
Creates a new Guest LAN with no one attached to it SMAPI_Interface.virtualLANCreate(String)

Parameters:
lanName - Name of LAN to create
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

guestLANDeleteDisconnect

public void guestLANDeleteDisconnect(String lanName,
                                     String guestName,
                                     String vaddr)
                              throws ZVMTasksException
Disconnects a guest (with a specified NIC address) from a LAN and deletes the LAN if it is the last guest on the LAN Wraps SMAPI_Interface.virtualLANDisconnectAndDeleteDM(String, String, String) & SMAPI_Interface.virtualLANDisconnectAndDelete(String, String, String)

Parameters:
lanName - Name of LAN to disconnect
guestName - Name of guest to disconnect
vaddr - Virtual address of guest's NIC
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

virtualSwitchCreate

public void virtualSwitchCreate(String lanName,
                                String portname,
                                String raddr)
                         throws ZVMTasksException
Creates a new VSwitch with no one attached to it Wraps SMAPI_Interface.virtualSwitchCreate(String, String, String)

Parameters:
lanName - Name of VSwitch to create
portname - Name of real port for VSwitch (specified if you want to connect the VSwitch externally)
raddr - Real address of port (specified if you want to connect the VSwitch externally)
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

virtualSwitchCreateConnect

public void virtualSwitchCreateConnect(String lanName,
                                       String guestName,
                                       String vaddr,
                                       String portname,
                                       String raddr)
                                throws ZVMTasksException
Creates a new VSwitch and attaches a guest to it with a virtual NIC of the specified address Wraps SMAPI_Interface.virtualSwitchCreateAndConnectDM(String, String, String, String, String) & SMAPI_Interface.virtualSwitchCreateAndConnect(String, String, String, String, String).

Parameters:
lanName - Name of VSwitch to create
guestName - Name of guest to connect
vaddr - Virtual address to create NIC at
portname - Name of real port for VSwitch
raddr - Real address of port (specified if you want to connect the VSwitch externally)
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

virtualSwitchDetatch

public void virtualSwitchDetatch(String switchName,
                                 String guestName)
                          throws ZVMTasksException
Detaches a guest from a VSwitch WrapsSMAPI_Interface.virtualSwitchDisconnectAndDeleteDM(String, String, String) & SMAPI_Interface.virtualSwitchDetatch(String, String)

Parameters:
switchName - Name of VSwitch
guestName - Name of guest to detach
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

virtualSwitchDelete

public void virtualSwitchDelete(String switchName)
                         throws ZVMTasksException
Deletes a VSwitch, even if there are people connected to it Wraps SMAPI_Interface.virtualSwitchDelete(String)

Parameters:
switchName - Name of VSwitch to delete
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

virtualSwitchRevoke

public void virtualSwitchRevoke(String switchName,
                                String userName)
                         throws ZVMTasksException
Restricts a user from being on a VSwitch's authorized list Wraps SMAPI_Interface.virtualSwitchSet(String, String, String)

Parameters:
switchName - Name of VSwitch
userName - Name of guest to restrict
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

virtualSwitchGrant

public void virtualSwitchGrant(String switchName,
                               String userName)
                        throws ZVMTasksException
Grants a user (already connected) access to a VSwitch Wraps SMAPI_Interface.virtualSwitchSet(String, String, String)

Parameters:
switchName - Name of VSwitch
userName - Name of guest to grant access
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

findNICaddress

public String findNICaddress(String strGuestName)
                      throws ZVMTasksException
Finds the lowest block of address space available for use as a virtual NIC Wraps SMAPI_Interface.getLowestFreeAddress(String, String) NOT CURRENTLY USED

Parameters:
strGuestName - name of guest to query
Returns:
4 digit hexadecimal address of start of free address block
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

getNICaddress

public String getNICaddress(String strNetworkName,
                            String strGuestName)
                     throws ZVMTasksException
Queries a network for a specified guest and returns that guest's virtual NIC Wraps SMAPI_Interface.getNICaddress(String, String)

Parameters:
strNetworkName - Network to query
strGuestName - Name of guest to query for
Returns:
4 digit hexadecimal address of that guest's virtual NIC on that network
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

getAllNetworkNames

public LinkedList getAllNetworkNames()
                              throws ZVMTasksException
Returns a LinkedList of all networks and their members Wraps SMAPI_Interface.queryNetworkMembers(String)

Returns:
LinkedList of Networks each containing network name and a list of members
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

getNetworkMembers

public Network getNetworkMembers(String strNetName)
                          throws ZVMTasksException
Queries the members of a particular VSwitch Wraps SMAPI_Interface.queryNetworkMembers(String).

Parameters:
strNetName - Name of VSwitch to query
Returns:
A Network containing network name and list of members
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

getNetworkInfo

public Network getNetworkInfo(String NetName)
                       throws ZVMTasksException
Queries the information for a given network Wraps SMAPI_Interface.virtualLanQuery().

Parameters:
NetName - Name of network to query
Returns:
A Network with information on the queried network
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

getCommonAddress

public String getCommonAddress(Collection memberNames)
                        throws ZVMTasksException
Overloaded call of the original

Parameters:
memberNames - List of guests to find the common address among
Returns:
lowest 4-digit hexadecimal virtual address available
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

getCommonAddress

public String getCommonAddress(Collection memberNames,
                               ZVMTasks.getCommonAddressProgressListener listener)
                        throws ZVMTasksException
Takes a list of guests and finds the lowest available common NIC address amongst them

Parameters:
memberNames - LinkedList of guests to find lowest address among
Returns:
4 digit hexadecimal string of lowest common free address
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception
NoCommonAddressException - Could not find a common address among the given guests

getAllFreeAddresses

public LinkedList getAllFreeAddresses(Collection memberNames,
                                      ZVMTasks.getCommonAddressProgressListener listener)
                               throws ZVMTasksException
Takes a list of member names and returns a LinkedList of LinkedLists of all their free addresses (gaps being bigger than 3 addresses so we can use the addresses for virtual NIC addresses)

Parameters:
memberNames - LinkedList of strings (guest names)
Returns:
LinkedList of LinkedLists of free addresses (provided there are 3+ contiguous free addresses in a row
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

getStorageGaps

public LinkedList getStorageGaps(String imageName)
                          throws ZVMTasksException
Returns all the virtual address gaps for a user Wraps SMAPI_Interface.returnQueryVirtual(String).

Parameters:
imageName - Name of guest to query
Returns:
LinkedList of Intervals with the address space gaps
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

parseQueryVirtual

private Vector parseQueryVirtual(LinkedList queryRes,
                                 int addrtype)
                          throws ZVMTasksException
Sorts through the results of query virtual, and returns a vector of sorted addresses with no duplicates

Parameters:
queryRes - Results of query virtual
addrtype - 1 for all addresses, 2 for NIC addresses, 3 for DASD
Returns:
Vector of addresses in 4 digit hexadecimal notation (i.e. 0x0009)
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

setGuestsGroup

public void setGuestsGroup(String imageName,
                           String oldGroupName,
                           String newGroupName)
                    throws ZVMTasksException
Removes/adds a guest to/from a group. This will create a new group if necessary and will delete a group if the last member is removed. All group names have the format LIVE_grpname Wraps SMAPI_Interface.nameListRemove(String, String) & Wraps SMAPI_Interface.nameListAdd(String, String).

Parameters:
imageName - Name of guest to add/remove
oldGroupName - Name of group to remove guest from (optional)
newGroupName - Name of group to add guest to (optional)
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

deleteImage

public void deleteImage(String imageName)
                 throws ZVMTasksException
Deletes a guest Wraps SMAPI_Interface.imageDelete(String).

Parameters:
imageName - Name of guest to delete
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

getGroups

public LinkedList getGroups()
                     throws ZVMTasksException
This function gets all the namelist names and contents from the server and puts them in a list of Group objects Wraps SMAPI_Interface.nameListQueryAll().

Returns:
A LinkedList of Groups.
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

queryGuest

public Guest queryGuest(String guestName)
                 throws ZVMTasksException
This function queries the characteristics of a guest Wraps SMAPI_Interface.imageQuery(String).

Parameters:
guestName - Name of guest to query
Returns:
A Guest
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

activeImagesQuery

public LinkedList activeImagesQuery()
                             throws ZVMTasksException
This function returns a LinkedList of all active guests Wraps SMAPI_Interface.activeImagesQuery().

Returns:
LinkedList of guest names.
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

imageActivate

public void imageActivate(String imageName)
                   throws ZVMTasksException
This function activates a guest Wraps SMAPI_Interface.imageActivate(String).

Parameters:
imageName - Name of guest to activate
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

imageDeactivate

public void imageDeactivate(String imageName)
                     throws ZVMTasksException
This function deactivates a guest Wraps SMAPI_Interface.imageDeactivate(String).

Parameters:
imageName - Name of guest to deactivate
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

setGuestPassword

public void setGuestPassword(String strGuestName,
                             String strPassword)
                      throws ZVMTasksException
This function sets a guest's password Wraps SMAPI_Interface.imageSetPassword(String, String).

Parameters:
strGuestName - Name of guest to change password of
strPassword - New Password
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

createMDisk

public void createMDisk(String strGuestName,
                        String strVirtualDeviceAddress,
                        String strAllocationType,
                        String strDiskSize,
                        String strDiskMode,
                        String strReadPW,
                        String strWritePW,
                        String strMultiPW)
                 throws ZVMTasksException
This function creates a new minidisk for a particular user Wraps SMAPI_Interface.imageDiskCreate(String, String, String, String, String, String, String, String, String, String). Wraps SMAPI_Interface.imageDiskCreateDM(String, String, String, String, String, String, String, String, String, String).

Parameters:
strGuestName - Name of guest to create minidisk for
strVirtualDeviceAddress - Virtual device address of minidisk
strAllocationType - How to allocate the minidisk (group region volume or temporary)
strDiskSize - Size of minidisk to create
strDiskMode - Access mode for minidisk (read, write, etc)
strReadPW - Read access password
strWritePW - Write access password
strMultiPW - Multi access password
Throws:
ZVMTasksException - An error occurred, just passes up SMAPIException

convertSizeToCylinders

public String convertSizeToCylinders(MDisk disk)
Converts the size of a disk from megabytes to numbers of cylinders or blocks

Parameters:
disk - information for the Minidisk that you are working with
Returns:
Size in blocks or cylinders

deleteMDisk

public void deleteMDisk(String strGuestName,
                        String strVirtualDeviceAddress)
                 throws ZVMTasksException
This function deletes a minidisk for a particular user Wraps SMAPI_Interface.imageDiskDeleteDM(String, String) Wraps SMAPI_Interface.imageDiskDelete(String, String).

Parameters:
strGuestName - Name of guest to create minidisk for
strVirtualDeviceAddress - Virtual device address of minidisk
Throws:
ZVMTasksException - An error occurred, just passes up SMAPIException

queryMDisks

public LinkedList queryMDisks(String strGuestName)
                       throws ZVMTasksException
This function queries minidisks for a particular user Wraps SMAPI_Interface.imageQuery(String).

Parameters:
strGuestName - Name of guest to create minidisk for
Returns:
LinkedList of MDisks
Throws:
ZVMTasksException - An error occurred, just passes up SMAPIException

convertSizetoMB

public String convertSizetoMB(MDisk disk)
Converts the size of a minidisk from blocks or cylinders to MB

Parameters:
disk - MDisk to convert size of
Returns:
String size of minidisk in MB

shareDisk

public void shareDisk(String sourceGuest,
                      String sourceVaddr,
                      String destGuest,
                      String destVaddr,
                      String accessMode)
               throws ZVMTasksException
Creates a minidisk link for a user that allows that user to gain access to another guests minidisk Wraps SMAPI_Interface.imageDiskShare(String, String, String, String, String, String).

Parameters:
sourceGuest - The guest owning the disk to share.
sourceVaddr - The virtual address of the disk relative to source guest.
destGuest - The guest obtaining the link.
destVaddr - The virtual address of the disk relative to destination guest.
accessMode - PErmissions the linker will gave to read/write the disk. Can be any valid CP access mode (i.e: RR, WR, MR,etc).
Throws:
ZVMTasksException - An error occurred, just passes up SMAPIException

unshareDisk

public void unshareDisk(String sourceGuest,
                        String sourceVaddr,
                        String destGuest,
                        String destVaddr)
                 throws ZVMTasksException
Removes a minidisk link from a guest Wraps SMAPI_Interface.imageDiskUnshare(String, String, String, String).

Parameters:
sourceGuest - The guest owning the disk being share.
sourceVaddr - The virtual address of the disk relative to source guest.
destGuest - The guest that has the link.
destVaddr - The virtual address of the disk relative to destination guest.
Throws:
ZVMTasksException - An error occurred, just passes up SMAPIException

cloneGuest

public LinkedList cloneGuest(String existGuestName,
                             String cloneGuestName,
                             String clonePassword,
                             boolean cloneDisks,
                             boolean formatDisks)
                      throws ZVMTasksException
This function will clone an existing guest by copying all it's characteristics (except password) to a new guest Wraps SMAPI_Interface.imageCreate(String, String, String).

Parameters:
existGuestName - Name of guest to clone
cloneGuestName - Name of clone
clonePassword - Password of clone
Returns:
LinkedList of minidisk addresses and the result of the disk operations
Throws:
ZVMTasksException - An error occurred

changeGuestsDirectory

public LinkedList changeGuestsDirectory(LinkedList existGuestDirectory,
                                        String cloneGuestName,
                                        String clonePassword)
                                 throws ZVMTasksException
This function will go through and update and make the clone's directory the same as the existing guest's and will return a list of the minidisks for either creation or copying Wraps SMAPI_Interface.imageReplace(String, LinkedList).

Parameters:
existGuestDirectory - Linked List of the existing Guest's directory statements
cloneGuestName - name of the clone
clonePassword - password for the clone
Returns:
LinkedList of MDisks
Throws:
ZVMTasksException - An error occurred, just passes up the SMAPIException

cloneCreateMDisks

public LinkedList cloneCreateMDisks(LinkedList existGuestDirectory,
                                    String cloneGuestName,
                                    String clonePassword,
                                    boolean formatDisks)
                             throws ZVMTasksException,
                                    exceptions.SMAPIException
Takes an existing Guest Directory, takes out DEDICATE and SPECIAL statements takes MDISK statements and creates a list of minidisks for the clone of the same size, type etc Wraps SMAPI_Interface.imageDiskCreateDM(String, String, String, String, String, String, String, String, String, String).

Parameters:
existGuestDirectory - directory of the guest you're cloning
cloneGuestName - name of the clone
clonePassword - password for the clone
formatDisks - whether to format the disks
Returns:
LinkedList of MDisks
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception
SMAPIException - A disk creation error occurred
exceptions.SMAPIException

cloneCopyMDisks

public LinkedList cloneCopyMDisks(LinkedList existGuestDirectory,
                                  String cloneGuestName,
                                  String clonePassword,
                                  String existGuestName)
                           throws ZVMTasksException,
                                  exceptions.SMAPIException
Takes an existing Guest Directory, takes out DEDICATE and SPECIAL statements takes MDISK statements and copies each one of the disks Wraps SMAPI_Interface.imageDiskCopyDM(String, String, String, String, String, String, String, String, String).

Parameters:
existGuestDirectory - directory of the guest you're cloning
cloneGuestName - name of the clone
clonePassword - clone's password
existGuestName - name of the guest you are cloning
Returns:
LinkedList of returncodes and addresses
Throws:
ZVMTasksException - An error occurred, just passes up the SMAPIException
SMAPIException - An error occurred
exceptions.SMAPIException

createGuest

public void createGuest(String guestName,
                        String password,
                        String initMem,
                        String maxMem,
                        String prototypeName)
                 throws ZVMTasksException
This function creates a new guest with certain specified characteristics Wraps SMAPI_Interface.imageCreate(String, String, String).

Parameters:
guestName - Name of new guest
password - Password
initMem - Initial amount of memory the guest has
maxMem - Maximum amount of memory the guest can have
prototypeName - Prototype to use for this guest (usually we'll use our default, except for cloned guests)
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

changeMemory

public void changeMemory(String guestName,
                         String newInitMem,
                         String newMaxMem)
                  throws ZVMTasksException
This function changes the initial and maximum allotted memory for a guest Wraps SMAPI_Interface.imageReplace(String, LinkedList)

Parameters:
guestName - Name of guest to change memory of
newInitMem - Initial amount of memory you want the guest to have
newMaxMem - Maximum amount of memory you want the guest to be able to have
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception

ensurePrototypeExists

private void ensurePrototypeExists(String prototypeName)
                            throws exceptions.SMAPIException
This function makes sure that the given prototype exists, if it does not, it creates it (this will probably be used at server startup for our generic prototype) Wraps SMAPI_Interface.prototypeCreate(String, LinkedList).

Parameters:
prototypeName - Name of profile to look for
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception.
exceptions.SMAPIException

sharedStorageCreate

public void sharedStorageCreate(String segName,
                                String segSizeInMB,
                                LinkedList guestsToAdd)
                         throws ZVMTasksException
Creates a new shared segment given the name of the segment, its size and a list of guests you wish to eventually add to the segment. This function does not actually give those guests access to the segment, instead they are used as a model so a correct and non-conflicting page range can be chosen when creating the segment. Wraps SMAPI_Interface.sharedStorageCreate(String, String, String, String) & getPageRangeFromGuests(LinkedList, String).

Parameters:
segName - Name of the segment to create.
segSizeInMB - The size of the segment you wish to create in Megabytes.
guestsToAdd - List of guests to use as model for determining page range.
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception.

getPageRangeFromGuests

private String getPageRangeFromGuests(LinkedList guests,
                                      String segSizeInMB)
                               throws ZVMTasksException
Given a list of guests, they will all be querried and a page range will be returned that is above all of the guests address spaces and that is not currently being used for any shared segment. This range is appropriate for use in creating a new shared segment that will be accessed by all guests in the list. Wraps SMAPI_Interface.sharedStorageFindPageRange(String, String)

Parameters:
guests - Guests to consider when choosing the page range.
segSizeInMB - Size of the page range to return.
Returns:
a string in the format nnnn-mmmm where nnnn and mmmm are both hexadecimal page numbers.
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception.

sharedStorageDelete

public void sharedStorageDelete(String segName)
                         throws ZVMTasksException
Deletes a shared storage segment, given the name. Wraps SMAPI_Interface.sharedStorageDelete(String, String).

Parameters:
segName - Name of segment to delete.
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception.

sharedStorageQuery

public LinkedList sharedStorageQuery()
                              throws ZVMTasksException
Returns a linkedlist of SavedSegment objects that correspond to the shared segments that exist on the system Wraps SMAPI_Interface.sharedStorageQuery().

Returns:
LinkedList of SavedSegments.
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception.

sharedStorageAccessAdd

public void sharedStorageAccessAdd(String guestName,
                                   String segmentName)
                            throws ZVMTasksException
Throws:
ZVMTasksException

sharedStorageAccessRemove

public void sharedStorageAccessRemove(String guestName,
                                      String segmentName)
                               throws ZVMTasksException
Revokes a guest's access to a saved segment Wraps SMAPI_Interface.sharedStorageRemoveAccess(String, String).

Parameters:
guestName - Guest to revoke access for
segmentName - Saved segment to revoke access from
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception.

sharedStorageAccessQuery

public boolean sharedStorageAccessQuery(String guestName,
                                        String segmentName)
                                 throws ZVMTasksException
Throws:
ZVMTasksException

sharedStorageAccessQueryNameList

public LinkedList sharedStorageAccessQueryNameList(String segmentName)
                                            throws ZVMTasksException
Gets the name list with the access information for a saved segment Wraps SMAPI_Interface.nameListQuery(String).

Parameters:
segmentName - Name of the saved segment to query
Throws:
ZVMTasksException - An error occurred. Just passes up the SMAPI exception.


Copyright © 2005