Esempio n. 1
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)

        bbcp_installed = (_bbcp_installed(runner, 'bbcp') or
                          _bbcp_installed(runner, BBCP_PATH))

        if bbcp_installed:
            return

        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:%s", bbcp, host, BBCP_PATH)
        scp_bbcp = "scp {ssh_opts} {bbcp} {user}@{host}:{tmp}"
        local.run(scp_bbcp.format(ssh_opts=ssh_util.default_ssh_options(),
                                  bbcp=bbcp,
                                  user=user,
                                  host=host,
                                  tmp=BBCP_PATH),
                  capture_output=False)
        chmod_bbcp = "chmod 777 {path}"
        runner.run(chmod_bbcp, path=BBCP_PATH)
Esempio n. 2
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)

        bbcp_installed = (_bbcp_installed(runner, 'bbcp')
                          or _bbcp_installed(runner, BBCP_PATH))

        if bbcp_installed:
            return

        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:%s", bbcp, host, BBCP_PATH)
        scp_bbcp = "scp {ssh_opts} {bbcp} {user}@{host}:{tmp}"
        local.run(scp_bbcp.format(ssh_opts=ssh_util.default_ssh_options(),
                                  bbcp=bbcp,
                                  user=user,
                                  host=host,
                                  tmp=BBCP_PATH),
                  capture_output=False)
        chmod_bbcp = "chmod 777 {path}"
        runner.run(chmod_bbcp, path=BBCP_PATH)
 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)
Esempio n. 5
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

        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:%s", bbcp, host, BBCP_PATH)
        cmd = "scp {ssh_opts} {bbcp} {user}@{host}:{tmp}"
        local.run(cmd.format(ssh_opts=ssh_util.default_ssh_options(),
                             bbcp=bbcp,
                             user=user,
                             host=host,
                             tmp=BBCP_PATH),
                  capture_output=False)
        cmd = "chmod 755 {path}"
        runner.run(cmd, path=BBCP_PATH)
Esempio n. 6
0
 def mkdir(self):
     cmd = "mktemp -dt {prefix}"
     self.dirname = local.run(cmd.format(prefix=self.prefix))
Esempio n. 7
0
 def mkdir(self):
     cmd = "mkdir -p {dirname}"
     local.run(cmd.format(dirname=self.dirname))
Esempio n. 8
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))
Esempio n. 9
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))
Esempio n. 10
0
 def mkdir(self):
     cmd = "mktemp -dt {prefix}"
     self.dirname = local.run(cmd.format(prefix=self.prefix))
Esempio n. 11
0
 def mkdir(self):
     cmd = "mkdir -p {dirname}"
     local.run(cmd.format(dirname=self.dirname))