Beispiel #1
0
    def _get_source_xml(self):
        if not self.host:
            raise RuntimeError(_("Hostname is required"))
        if not self.source_path:
            raise RuntimeError(_("Host path is required"))

        iqn_xml = ""
        if self.iqn:
            iqn_xml += """    <initiator>\n"""
            iqn_xml += """      <iqn name="%s"/>\n""" % escape(self.iqn)
            iqn_xml += """    </initiator>\n"""

        xml  = """    <host name="%s"/>\n""" % self.host
        xml += """    <device path="%s"/>\n""" % escape(self.source_path)
        xml += iqn_xml

        return xml
Beispiel #2
0
 def _get_source_xml(self):
     if not self.host:
         raise RuntimeError(_("Hostname is required"))
     if not self.source_path:
         raise RuntimeError(_("Host path is required"))
     xml = """    <format type="%s"/>\n""" % self.format + \
           """    <host name="%s"/>\n""" % self.host + \
           """    <dir path="%s"/>\n""" % escape(self.source_path)
     return xml
Beispiel #3
0
    def _get_source_xml(self):
        if not self.source_path:
            raise RuntimeError(_("Host path is required"))

        xml = ""
        # There is no explicit "auto" type for disk pools, but leaving out
        # the format type seems to do the job for existing formatted disks
        if self.format != "auto":
            xml = """    <format type="%s"/>\n""" % self.format
        xml += """    <device path="%s"/>\n""" % escape(self.source_path)
        return xml
Beispiel #4
0
 def _get_target_xml(self):
     xml = "    <path>%s</path>\n" % escape(self.target_path)
     return xml
Beispiel #5
0
 def _get_source_xml(self):
     if not self.source_path:
         raise RuntimeError(_("Adapter name is required"))
     xml = """    <adapter name="%s"/>\n""" % escape(self.source_path)
     return xml
Beispiel #6
0
 def _get_target_xml(self):
     xml = "    <path>%s</path>\n" % escape(self.target_path) + \
           "%s" % self._get_perms_xml()
     return xml
Beispiel #7
0
 def _get_source_xml(self):
     if not self.source_path:
         raise RuntimeError(_("Device path is required"))
     xml = "    <format type='%s'/>\n" % self.format + \
           "    <device path='%s'/>\n" % escape(self.source_path)
     return xml