def _iscsiadm_is_installed_locally(self):
     LOG.info("Checking if iscsiadm tool is installed")
     try:
         local.run('iscsiadm --help &>/dev/null')
     except local.LocalExecutionFailed:
         msg = ("iscsiadm is not available on the local host. Please "
                "install iscsiadm tool on the node you running on or "
                "choose other cinder backend for migration. iscsiadm is "
                "mandatory for migrations with EMC VMAX cinder backend")
         LOG.error(msg)
         raise exception.AbortMigrationError(msg)
 def _iscsiadm_is_installed_locally(self):
     LOG.info("Checking if iscsiadm tool is installed")
     try:
         local.run('iscsiadm --help &>/dev/null')
     except local.LocalExecutionFailed:
         msg = ("iscsiadm is not available on the local host. Please "
                "install iscsiadm tool on the node you running on or "
                "choose other cinder backend for migration. iscsiadm is "
                "mandatory for migrations with EMC VMAX cinder backend")
         LOG.error(msg)
         raise exception.AbortMigrationError(msg)
Example #3
0
    def copy_bbcp(self, host, position):
        """
        Check that the bbcp is installed on the host otherwise copy bbcp to
        the host.

        :param host: Host to which the bbcp will be copied
        :param position: src or dst
        """
        runner = self.runner(host, position)

        LOG.debug("Checking if bbcp is installed on '%s' host", host)
        cmd = "bbcp --help &>/dev/null"
        try:
            runner.run(cmd)
        except remote_runner.RemoteExecutionError:
            pass
        else:
            return

        tmp_path = '/tmp/bbcp'
        if position == 'src':
            bbcp = CONF.bbcp.src_path
            user = CONF.src.ssh_user
        else:
            bbcp = CONF.bbcp.dst_path
            user = CONF.dst.ssh_user

        LOG.debug("Copying %s to %s:/usr/local/bin/bbcp", bbcp, host)
        cmd = "scp {cipher} -o {opts} {bbcp} {user}@{host}:{tmp}"
        local.run(cmd.format(opts='StrictHostKeyChecking=no',
                             bbcp=bbcp,
                             user=user,
                             host=host,
                             tmp=tmp_path,
                             cipher=ssh_util.get_cipher_option()),
                  capture_output=False)
        cmd = "mv {tmp} {path} && chmod 755 {path}"
        runner.run(cmd, tmp=tmp_path, path=BBCP_PATH)
Example #4
0
def remove_iscsi_device(dev_name):
    path = "/sys/block/%s/device/delete" % dev_name.replace("/dev/", "")

    if os.path.exists(path):
        flush_device_io(dev_name)
        local.run("echo 1 | sudo tee -a {path}".format(path=path))
Example #5
0
def remove_iscsi_device(dev_name):
    path = "/sys/block/%s/device/delete" % dev_name.replace("/dev/", "")

    if os.path.exists(path):
        flush_device_io(dev_name)
        local.run("echo 1 | sudo tee -a {path}".format(path=path))