def unmount_storage(mountPoint): print "Attempting to unmount the NAS at %s..." %(mountPoint) if not xcatutils.isMounted(mountPoint): raise xcatutils.xCatError("The mount point %s is NOT mounted." %(mountPoint)) else: cmd = "umount %s" %(mountPoint) out,err = xcatutils.run_command(cmd) if err: print "Encountered error while unmounting..." print err
def unmount_storage(mountPoint): print "Attempting to unmount the NAS at %s..." % (mountPoint) if not xcatutils.isMounted(mountPoint): raise xcatutils.xCatError("The mount point %s is NOT mounted." % (mountPoint)) else: cmd = "umount %s" % (mountPoint) out, err = xcatutils.run_command(cmd) if err: print "Encountered error while unmounting..." print err
def mount_nas_storage(hostname, user, passwd, mountPoint): print "Attempting to mount the NAS File Storage at %s" %(mountPoint) if xcatutils.isMounted(mountPoint): raise xcatutils.xCatError("The mount point %s is already in use." %(mountPoint)) cmd = "mount -t cifs //%s/%s -o username=%s,password=%s,rw,nounix,iocharset=utf8,file_mode=0644,dir_mode=0755 %s" %(hostname, user, user, passwd, mountPoint) out,err = xcatutils.run_command(cmd) if err: raise xcatutils.xCatError("Error when mounting. (%s)" %(err)) else: print "Success\n" # To help out with automount, print this msg print "\nNote: To configure automount on reboot, add the following into /etc/fstab:" cmd = "//%s/%s %s cifs defaults,username=%s,password=%s 0 0" %(hostname,user,mountPoint,user,passwd) print "%s\n" %(cmd)
def mount_consistent_storage(hostname, user, mountPoint): # TODO: would be good to be able to specify the nfs version as a argument print "Attempting to mount the Consistent Performance File Storage at %s" %(mountPoint) if xcatutils.isMounted(mountPoint): raise xcatutils.xCatError("The mount point %s is already in use." %(mountPoint)) cmd = "mount -t nfs4 %s:/%s %s" %(hostname, user, mountPoint) out,err = xcatutils.run_command(cmd) if err: raise xcatutils.xCatError("Error when mounting. (%s)" %(err)) else: print "Success\n" # To help out with automount, print this msg print "\nNote: To configure automount on reboot, add the following into /etc/fstab:" cmd = "%s:/%s %s nfs4 defaults,hard,intr 0 0" %(hostname,user,mountPoint) print "%s\n" %(cmd)
def mount_nas_storage(hostname, user, passwd, mountPoint): print "Attempting to mount the NAS File Storage at %s" % (mountPoint) if xcatutils.isMounted(mountPoint): raise xcatutils.xCatError("The mount point %s is already in use." % (mountPoint)) cmd = "mount -t cifs //%s/%s -o username=%s,password=%s,rw,nounix,iocharset=utf8,file_mode=0644,dir_mode=0755 %s" % ( hostname, user, user, passwd, mountPoint) out, err = xcatutils.run_command(cmd) if err: raise xcatutils.xCatError("Error when mounting. (%s)" % (err)) else: print "Success\n" # To help out with automount, print this msg print "\nNote: To configure automount on reboot, add the following into /etc/fstab:" cmd = "//%s/%s %s cifs defaults,username=%s,password=%s 0 0" % ( hostname, user, mountPoint, user, passwd) print "%s\n" % (cmd)
def mount_consistent_storage(hostname, user, mountPoint): # TODO: would be good to be able to specify the nfs version as a argument print "Attempting to mount the Consistent Performance File Storage at %s" % ( mountPoint) if xcatutils.isMounted(mountPoint): raise xcatutils.xCatError("The mount point %s is already in use." % (mountPoint)) cmd = "mount -t nfs4 %s:/%s %s" % (hostname, user, mountPoint) out, err = xcatutils.run_command(cmd) if err: raise xcatutils.xCatError("Error when mounting. (%s)" % (err)) else: print "Success\n" # To help out with automount, print this msg print "\nNote: To configure automount on reboot, add the following into /etc/fstab:" cmd = "%s:/%s %s nfs4 defaults,hard,intr 0 0" % (hostname, user, mountPoint) print "%s\n" % (cmd)