def resolveName(self): """ Will automatically try to detect the specified device. Implicitly the same functionality as in HostDisk.resolve() is used. """ from comoonics.storage.ComDevice import Device device=Device(self.getAttribute("name"), self.getDocument()) cmds=device.resolveDeviceName() self.log.debug("resolveName: setting name from %s => %s." %(str(self.getAttribute("name")), str(device.getDeviceName()))) self.setAttribute("name", device.getDeviceName()) return cmds
def resolveName(self): """ Will automatically try to detect the specified device. Implicitly the same functionality as in HostDisk.resolve() is used. """ from comoonics.storage.ComDevice import Device device = Device(self.getAttribute("name"), self.getDocument()) cmds = device.resolveDeviceName() self.log.debug( "resolveName: setting name from %s => %s." % (str(self.getAttribute("name")), str(device.getDeviceName()))) self.setAttribute("name", device.getDeviceName()) return cmds
def setUp(self): from comoonics import XmlTools import StringIO from comoonics.storage.ComDevice import Device from comoonics.storage.ComMountpoint import MountPoint from comoonics.storage.ComFileSystem import getFileSystem xmlfp = StringIO.StringIO(self.xml) doc = XmlTools.parseXMLFP(xmlfp) __device = doc.documentElement self.device = Device(__device, doc) __fs = __device.getElementsByTagName("filesystem")[0] self.filesystem = getFileSystem(__fs, doc) __mp = __device.getElementsByTagName("mountpoint")[0] self.mountpoint = MountPoint(__mp, doc)
def testScanMountpoint2(self): devicexml=parseXMLString("""<disk name="/dev/mapper/mobilix--20-lv_tmp2"/>""") device=Device(devicexml.documentElement, devicexml, mountsfile=self.mountsfilename) self.assertEquals(device.scanMountPoint(), [None, None])
def testMountpoint2(self): devicexml=parseXMLString("""<disk name="/dev/mapper/mobilix--20-lv_tmp"/>""") mountpointxml=parseXMLString("""<mountpoint name="/tmp2"/>""") mountpoint=MountPoint(mountpointxml.documentElement, mountpointxml) device=Device(devicexml.documentElement, devicexml, mountsfile=self.mountsfilename) self.assertFalse(device.isMounted(mountpoint))
def testDevice2(self): devicexml=parseXMLString("""<disk name="/dev/mapper/mobilix--20-lv_tmp2"/>""") device=Device(devicexml.documentElement, devicexml, mountsfile=self.mountsfilename) self.assertFalse(device.isMounted())