Saturday, September 2, 2017

Parallel rsync

Following steps did the job for me:
  1. Run the rsync --dry-run first in order to get the list of files those would be affected.
rsync -avzm --stats --safe-links --ignore-existing --dry-run --human-readable /data/projects REMOTE-HOST:/data/ > /tmp/transfer.log
  1. I fed the output of cat transfer.log to parallel in order to run 5 rsyncs in parallel, as follows:
cat /tmp/transfer.log | parallel --will-cite -j 5 rsync -avzm --relative --stats --safe-links --ignore-existing --human-readable {} REMOTE-HOST:/data/ > result.log
Here, --relative option (link) ensured that the directory structure for the affected files, at the source and destination, remains the same (inside /data/ directory), so the command must be run in the source folder (in example, /data/projects).
Foreman Smart-Proxy installation

This is the layman's installation for smart-proxy.

I've installed smart-proxy on both CentOS(6/7) and Ubuntu 14.04. This article will outline how to install Smart-Proxy with Integration to FreeIPA, DHCP, TFTP. The Foreman documentation can be a bit cryptic about certain steps, so I will attempt to lay it out in a sensible format, and explain along the way.

Download and install Smart-Proxy.
http://theforeman.org/manuals/1.9/index.html#2.1Installation

I selected Ubuntu 14.04. Using sudo or as the root user, install the following packages:

# grab the latest puppet
cd /tmp
apt-get -y install ca-certificates
wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb
dpkg -i puppetlabs-release-trusty.deb

# install foreman sources (mind the version number)
echo "deb http://deb.theforeman.org/ trusty 1.9" > /etc/apt/sources.list.d/foreman.list
echo "deb http://deb.theforeman.org/ plugins 1.9" >> /etc/apt/sources.list.d/foreman.list
wget -q http://deb.theforeman.org/pubkey.gpg -O- | apt-key add -

# download the installer
apt-get update && apt-get -y install foreman-installer

Depending on how you installed your Ubuntu system, you may need to set the hostname and IP information for your server.

# edit my_fqdn
my_fqdn=smart-proxy1.flamed.us

# using eth0
my_ip=`ifconfig eth0 | awk '{ print $2}' | grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}"`

# truncate host from fqdn
host=$(cut -f 1 -d . $my_hostname)

# set hostname in /etc/hosts
echo "$my_ip $my_fqdn $host" >> /etc/hosts

# set hostname variable to my_fqdn
hostname $my_fqdn


Download and install IPA client and join the system.
# install client
apt-get install freeipa-client

# join realm
ipa-client-install



Friday, October 16, 2015

oVirt: upload ISO

download file:

wget http://centos.den.host-engine.com/6.7/isos/x86_64/CentOS-6.7-x86_64-minimal.iso

upload/import ISO
engine-iso-uploader -i ISOs upload CentOS-6.7-x86_64-minimal.iso

Thursday, September 10, 2015

Fedora 22 libvirt/qemu migration to oVirt or RHEV

I use qemu and virt-manager to develop labs for customers, and I often need to push my environment to production by copying the vms to oVirt.

 
Where do I get my XML files from?
/etc/libvirt/qemu
shared.ovirt.nfs.server.flamed.us is a Linux host connected/added to oVirt as an Export domain.
 
/nfs_export is the export. You can get the available exported file-systems by running "showmount -e shared.ovirt.nfs.server.flamed.us"

[bmusson@cpu1 /etc/libvirt/qemu]$ virt-v2v -i libvirtxml -o rhev -os shared.ovirt.nfs.server.flamed.us:/nfs_export --network ovirtmgmt foreman-master1.lab.flamed.us.xml 

This process will copy the .qcow file specified in the Virtual_Machines directory over to the NFS server. After, log on to the oVirt Manager, browse for the Export storage domain and import the VM using the "import button".

That easy.

Here is the output of the command.

 [   0.0] Opening the source -i libvirtxml foreman-master1.lab.flamed.us.xml
[   0.0] Creating an overlay to protect the source from being modified
[   0.6] Opening the overlay
[  66.9] Initializing the target -o rhev -os shared.ovirt.nfs.server.flamed.us:/nfs_export
[  67.7] Inspecting the overlay
[  78.1] Checking for sufficient free disk space in the guest
[  78.1] Estimating space required on target for each disk
[  78.1] Converting CentOS Linux release 7.1.1503 (Core)  to run on KVM
virt-v2v: This guest has virtio drivers installed.
[ 111.0] Mapping filesystem data to avoid copying unused and blank areas
[ 140.9] Closing the overlay
[ 141.2] Checking if the guest needs BIOS or UEFI to boot
[ 141.2] Assigning disks to buses
[ 141.2] Copying disk 1/1 to /tmp/v2v.UeRZcD/f5774ae2-2a4d-407e-b604-b501bc7c2127/images/29c1ae67-32f8-4963-96a6-22869d227a1f/bbff6f5d-35c3-4d57-a0f3-2cb12db0f415 (qcow2)
    (100.00/100%)
[3049.8] Creating output metadata
[3049.9] Finishing off

Thursday, July 9, 2015

SELinux and OSAd

SELinux can sometimes prevent OSA from connecting to the upstream jabber server. Below is a fix:

[root@server ~]# service osad status
osad (pid  5539) is running...
[root@server ~]# service osad restart
Shutting down osad:                                        [  OK  ]
Starting osad: cTraceback (most recent call last):
  File "/usr/share/rhn/osad/jabber_lib.py", line 252, in setup_connection
    c = self._get_jabber_client(js)
  File "/usr/share/rhn/osad/jabber_lib.py", line 309, in _get_jabber_client
    c.connect()
  File "/usr/share/rhn/osad/jabber_lib.py", line 567, in connect
    jabber.Client.connect(self)
  File "/usr/lib/python2.6/site-packages/jabber/xmlstream.py", line 488, in connect
    raise socket.error("Unable to connect to the host and port specified")
error: Unable to connect to the host and port specified

                                                           [  OK  ]
[root@server ~]# semanage permissive -a osad_t
[root@server ~]# service osad restart
Shutting down osad:                                        [  OK  ]
Starting osad:                                             [  OK  ]
[root@server ~]# rhn_check -vvv

Parallel rsync

Following steps did the job for me: Run the  rsync --dry-run  first in order to get the list of files those would be affected. rsync -...