Custom Search

Monday, March 20, 2017

python error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Fix:
$sudo apt-get install python-dev
$sudo apt-get install python3-dev

====Error====

fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1



Sunday, March 19, 2017

How to Install Openstack on Ubuntu 16.04 LTS Vagrant VirtualBox

How to Install Openstack on Ubuntu 16.04 LTS Vagrant VirtualBox
stable/ocata
stable/newton
stable/mitaka
stable/liberty

How to fix Can not SSH to vagrant ubuntu 16.04 xenial64 SSH timeout





====Error======

Running 'pre-boot' VM customizations...
Booting VM...
Waiting for machine to boot. This may take a few minutes...
SSH address: 127.0.0.1:2200
SSH username: vagrant
SSH auth method: password
Warning: Connection timeout. Retrying...
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.

How to install OpenStack Ocata with neutron in Ubuntu Virtualbox

1)
$git clone https://github.com/openstack-dev/devstack -b stable/ocata

2)
$cd devstack

3)
$vim local.conf

[[local|localrc]]

#to pull changes from upstream on next run on stack.sh
RECLONE=True

HOST_IP=192.168.56.5
SERVICE_HOST=192.168.56.5
MYSQL_HOST=192.168.56.5
RABBIT_HOST=192.168.56.5
GLANCE_HOSTPORT=192.168.56.5:9292
ADMIN_PASSWORD=secret
DATABASE_PASSWORD=secret
RABBIT_PASSWORD=secret
SERVICE_PASSWORD=secret

# Do not use Nova-Network
disable_service n-net
# Enable Neutron
ENABLED_SERVICES+=,q-svc,q-dhcp,q-meta,q-agt,q-l3

## Neutron options
Q_USE_SECGROUP=True
FLOATING_RANGE="192.168.56.0/24"
FIXED_RANGE="10.0.0.0/24"
Q_FLOATING_ALLOCATION_POOL=start=192.168.56.240,end=192.168.56.254
PUBLIC_NETWORK_GATEWAY="192.168.56.1"
PUBLIC_INTERFACE=eth1

# Open vSwitch provider networking configuration
Q_USE_PROVIDERNET_FOR_PUBLIC=True
OVS_PHYSICAL_BRIDGE=br-ex
PUBLIC_BRIDGE=br-ex
OVS_BRIDGE_MAPPINGS=public:br-ex

4)
$./stack.sh



Tuesday, March 14, 2017

How to save PostgreSQL psql query output to a file

How to save PostgreSQL psql query output to a CSV file

https://www.postgresql.org/docs/current/static/sql-copy.html

=> \copy (select * from audityear) TO '/tmp/test1.csv' (format CSV);
=> \copy (select * from audityear) TO '/tmp/test1.csv' (format CSV, delimiter ',');
=> \copy (select * from audityear) TO '/tmp/test1.csv' (format CSV, delimiter ',', HEADER);

OR

=> \copy (select * from audityear) TO '/tmp/test1.csv' (format TEXT);
=> \copy (select * from audityear) TO '/tmp/test1.csv' (format TEXT, delimiter ',');



OR

=> \copy (select * from audityear) TO '/tmp/test1.csv' WITH CSV
=> \copy (select * from audityear) TO '/tmp/test1.csv' WITH CSV HEADER;


Saturday, March 11, 2017

python error in setup command: Error parsing setup.cfg: Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. Are you sure that git is installed?

Fix
=======
Got to project folder and run git init
$ cd project_dir
$ git init
$ python setup.py install

Error
=======
error in setup command: Error parsing /build/pkgbuild/setup.cfg: Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. Are you sure that git is installed?

dh_auto_install: python setup.py install --force --root=/build/pkgbuild/debian/python-neutron --no-compile -O0 --install-layout=deb returned exit code 1

make: *** [binary] Error 1

python setup.py install Error parsing setup.cfg: OSError: [Errno 2] No such file or directory

Fix
=====
install git
$sudo apt-get install git

Error
=======
error in setup command: Error parsing /build/pkgbuild/setup.cfg: OSError: [Errno 2] No such file or directory
dh_auto_install: python setup.py install --force --root=/build/pkgbuild/debian/python-neutron --no-compile -O0 --install-layout=deb returned exit code 1

Friday, March 10, 2017

How to git github rename local and remote branch

$git clone your_project
$git checkout old_branch_name
$git branch -m new_branch_name
$git push origin : old_branch_name new_branch_name


Thursday, March 9, 2017

git checkout old commit and create new branch

1)
$git checkout 40d449d20264925b89b84e6f1425de83babccc5a -b v3_5_0_2
Switched to a new branch 'v3_5_0_2'
$

2)
$git branch
  master
* v3_5_0_2
$

3)

Sunday, March 5, 2017

How to clear OpenStack Nova instance table

delete from instance_faults;
delete from instance_extra;
delete from instance_info_caches;
delete from instance_system_metadata;
delete from block_device_mapping;
delete from instances;

apparmor="DENIED" operation="exec" profile="/usr/sbin/libvirtd" name="/usr/local/bin/qemu-system-alpha" pid=2392 comm="libvirtd" requested_mask="x" denied_mask="x" fsuid=0 ouid=0

Fix:
$service apparmor teardown <=============works

https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/632696

==========Error=========

/var/log/syslog

Mar  3 20:10:39 localhost kernel: [4260864.783747] audit_printk_skb: 294 callbacks suppressed
Mar  3 20:10:39 localhost kernel: [4260864.783752] type=1400 audit(1488571839.231:3944): apparmor="DENIED" operation="exec" profile="/usr/sbin/libvirtd" name="/usr/local/bin/qemu-system-alpha" pid=2392 comm="libvirtd" requested_mask="x" denied_mask="x" fsuid=0 ouid=0
Mar  3 20:10:39 localhost kernel: [4260864.789692] type=1400 audit(1488571839.235:3945): apparmor="DENIED" operation="exec" profile="/usr/sbin/libvirtd" name="/usr/local/bin/qemu-system-alpha" pid=2393 comm="libvirtd" requested_mask="x" denied_mask="x" fsuid=0 ouid=0
Mar  3 20:10:39 localhost kernel: [4260864.797468] type=1400 audit(1488571839.243:3946): apparmor="DENIED" operation="exec" profile="/usr/sbin/libvirtd" name="/usr/local/bin/qemu-system-arm" pid=2394 comm="libvirtd" requested_mask="x" denied_mask="x" fsuid=0 ouid=0
Mar  3 20:10:39 localhost kernel: [4260864.800058] type=1400 audit(1488571839.243:3947): apparmor="DENIED" operation="exec" profile="/usr/sbin/libvirtd" name="/usr/local/bin/qemu-system-arm" pid=2395 comm="libvirtd" requested_mask="x" denied_mask="x" fsuid=0 ouid=0
Mar  3 20:10:39 localhost kernel: [4260864.800058] type=1400 audit(1488571839.243:3948): apparmor="DENIED" operation="exec" profile="/usr/sbin/libvirtd" name="/usr/local/bin/qemu-system-aarch64" pid=2396 comm="libvirtd" requested_mask="x" denied_mask="x" fsuid=0 ouid=0
Mar  3 20:10:39 localhost kernel: [4260864.800058] type=1400 audit(1488571839.243:3949): apparmor="DENIED" operation="exec" profile="/usr/sbin/libvirtd" name="/usr/local/bin/qemu-system-aarch64" pid=2397 comm="libvirtd" requested_mask="x" denied_mask="x" fsuid=0 ouid=0
Mar  3 20:10:39 localhost kernel: [4260864.800058] type=1400 audit(1488571839.243:3950): apparmor="DENIED" operation="exec" profile="/usr/sbin/libvirtd" name="/usr/local/bin/qemu-system-cris" pid=2398 comm="libvirtd" requested_mask="x" denied_mask="x" fsuid=0 ouid=0
Mar  3 20:10:39 localhost kernel: [4260864.800058] type=1400 audit(1488571839.243:3951): apparmor="DENIED" operation="exec" profile="/usr/sbin/libvirtd" name="/usr/local/bin/qemu-system-cris" pid=2399 comm="libvirtd" requested_mask="x" denied_mask="x" fsuid=0 ouid=0
Mar  3 20:10:39 localhost kernel: [4260864.800058] type=1400 audit(1488571839.243:3952): apparmor="DENIED" operation="exec" profile="/usr/sbin/libvirtd" name="/usr/local/bin/qemu-system-i386" pid=2400 comm="libvirtd" requested_mask="x" denied_mask="x" fsuid=0 ouid=0
Mar  3 20:10:39 localhost kernel: [4260864.800058] type=1400 audit(1488571839.243:3953): apparmor="DENIED" operation="exec" profile="/usr/sbin/libvirtd" name="/usr/local/bin/qemu-system-i386" pid=2401 comm="libvirtd" requested_mask="x" denied_mask="x" fsuid=0 ouid=0

How to fix libvirtError: internal error: Cannot find suitable emulator for x86_64

Fix:
$service apparmor teardown <=============works

https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/632696

==========Error==========
2017-03-03 19:58:56.513 ERROR oslo_service.service [-] Error starting thread.
2017-03-03 19:58:56.513 TRACE oslo_service.service Traceback (most recent call last):
2017-03-03 19:58:56.513 TRACE oslo_service.service   File "/usr/local/lib/python2.7/dist-packages/oslo_service/service.py", line 722, in run_service
2017-03-03 19:58:56.513 TRACE oslo_service.service     service.start()
2017-03-03 19:58:56.513 TRACE oslo_service.service   File "/opt/stack/nova/nova/service.py", line 144, in start
2017-03-03 19:58:56.513 TRACE oslo_service.service     self.manager.init_host()
2017-03-03 19:58:56.513 TRACE oslo_service.service   File "/opt/stack/nova/nova/compute/manager.py", line 1138, in init_host
2017-03-03 19:58:56.513 TRACE oslo_service.service     self.driver.init_host(host=self.host)
2017-03-03 19:58:56.513 TRACE oslo_service.service   File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 471, in init_host
2017-03-03 19:58:56.513 TRACE oslo_service.service     self._parse_migration_flags()
2017-03-03 19:58:56.513 TRACE oslo_service.service   File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 629, in _parse_migration_flags
2017-03-03 19:58:56.513 TRACE oslo_service.service     live_migration_flags)
2017-03-03 19:58:56.513 TRACE oslo_service.service   File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 605, in _handle_live_migration_auto_converge
2017-03-03 19:58:56.513 TRACE oslo_service.service     if (self._is_post_copy_available() and
2017-03-03 19:58:56.513 TRACE oslo_service.service   File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 587, in _is_post_copy_available
2017-03-03 19:58:56.513 TRACE oslo_service.service     hv_ver=MIN_QEMU_POSTCOPY_VERSION):
2017-03-03 19:58:56.513 TRACE oslo_service.service   File "/opt/stack/nova/nova/virt/libvirt/host.py", line 522, in has_min_version
2017-03-03 19:58:56.513 TRACE oslo_service.service     lv_ver=lv_ver, hv_ver=hv_ver, hv_type=hv_type, op=operator.lt)
2017-03-03 19:58:56.513 TRACE oslo_service.service   File "/opt/stack/nova/nova/virt/libvirt/host.py", line 495, in _version_check
2017-03-03 19:58:56.513 TRACE oslo_service.service     conn = self.get_connection()
2017-03-03 19:58:56.513 TRACE oslo_service.service libvirtError: internal error: Cannot find suitable emulator for x86_64
2017-03-03 19:58:56.513 TRACE oslo_service.service

How to fix libvirtError: authentication failed: no agent is available to authenticate

Fix:

$ sudo vim  /etc/libvirt/libvirtd.conf

# If the unix_sock_rw_perms are changed you may wish to enable
# an authentication mechanism here
auth_unix_rw = "none"

==========Error==========

2017-03-03 15:54:38.088 DEBUG nova.virt.libvirt.host [-] Connecting to libvirt: qemu:///system from (pid=6113) _get_new_connection /opt/stack/nova/no
va/virt/libvirt/host.py:368
2017-03-03 15:54:38.114 ERROR nova.virt.libvirt.host [-] Connection to libvirt failed: authentication failed: no agent is available to authenticate
2017-03-03 15:54:38.114 TRACE nova.virt.libvirt.host Traceback (most recent call last):
2017-03-03 15:54:38.114 TRACE nova.virt.libvirt.host   File "/opt/stack/nova/nova/virt/libvirt/host.py", line 454, in get_connection
2017-03-03 15:54:38.114 TRACE nova.virt.libvirt.host     conn = self._get_connection()
2017-03-03 15:54:38.114 TRACE nova.virt.libvirt.host   File "/opt/stack/nova/nova/virt/libvirt/host.py", line 437, in _get_connection
2017-03-03 15:54:38.114 TRACE nova.virt.libvirt.host     {'msg': ex})
2017-03-03 15:54:38.114 TRACE nova.virt.libvirt.host   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
2017-03-03 15:54:38.114 TRACE nova.virt.libvirt.host     self.force_reraise()
2017-03-03 15:54:38.114 TRACE nova.virt.libvirt.host   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
2017-03-03 15:54:38.114 TRACE nova.virt.libvirt.host     six.reraise(self.type_, self.value, self.tb)
2017-03-03 15:54:38.114 TRACE nova.virt.libvirt.host   File "/opt/stack/nova/nova/virt/libvirt/host.py", line 426, in _get_connection
2017-03-03 15:54:38.114 TRACE nova.virt.libvirt.host     self._wrapped_conn = self._get_new_connection()
2017-03-03 15:54:38.114 TRACE nova.virt.libvirt.host   File "/opt/stack/nova/nova/virt/libvirt/host.py", line 371, in _get_new_connection
2017-03-03 15:54:38.114 TRACE nova.virt.libvirt.host     wrapped_conn = self._connect(self._uri, self._read_only)
2017-03-03 15:54:38.114 TRACE nova.virt.libvirt.host   File "/opt/stack/nova/nova/virt/libvirt/host.py", line 227, in _connect
2017-03-03 15:54:38.114 TRACE nova.virt.libvirt.host     libvirt.openAuth, uri, auth, flags)
2017-03-03 15:54:38.114 TRACE nova.virt.libvirt.host   File "/usr/local/lib/python2.7/dist-packages/eventlet/tpool.py", line 144, in proxy_call
2017-03-03 15:54:38.114 TRACE nova.virt.libvirt.host     rv = execute(f, *args, **kwargs)
2017-03-03 15:54:38.114 TRACE nova.virt.libvirt.host   File "/usr/local/lib/python2.7/dist-packages/eventlet/tpool.py", line 125, in execute
2017-03-03 15:54:38.114 TRACE nova.virt.libvirt.host     six.reraise(c, e, tb)
2017-03-03 15:54:38.114 TRACE nova.virt.libvirt.host   File "/usr/local/lib/python2.7/dist-packages/eventlet/tpool.py", line 83, in tworker
2017-03-03 15:54:38.114 TRACE nova.virt.libvirt.host     rv = meth(*args, **kwargs)
2017-03-03 15:54:38.114 TRACE nova.virt.libvirt.host   File "/usr/local/lib/python2.7/dist-packages/libvirt.py", line 105, in openAuth
2017-03-03 15:54:38.114 TRACE nova.virt.libvirt.host     if ret is None:raise libvirtError('virConnectOpenAuth() failed')
2017-03-03 15:54:38.114 TRACE nova.virt.libvirt.host libvirtError: authentication failed: no agent is available to authenticate
2017-03-03 15:54:38.114 TRACE nova.virt.libvirt.host
2017-03-03 15:54:38.143 INFO nova.virt.libvirt.driver [-] Connection event '0' reason 'Failed to connect to libvirt: authentication failed: no agent is available to authenticate'
2017-03-03 15:54:38.145 DEBUG oslo_messa

=====================

2017-03-03 15:35:31.040 ERROR oslo_service.service [req-d687bfd4-f9d8-4031-a2bb-b6df6a9abc12 None None] Error starting thread.
2017-03-03 15:35:31.040 TRACE oslo_service.service Traceback (most recent call last):
2017-03-03 15:35:31.040 TRACE oslo_service.service   File "/usr/local/lib/python2.7/dist-packages/oslo_service/service.py", line 722, in run_service
2017-03-03 15:35:31.040 TRACE oslo_service.service     service.start()
2017-03-03 15:35:31.040 TRACE oslo_service.service   File "/opt/stack/nova/nova/service.py", line 144, in start
2017-03-03 15:35:31.040 TRACE oslo_service.service     self.manager.init_host()
2017-03-03 15:35:31.040 TRACE oslo_service.service   File "/opt/stack/nova/nova/compute/manager.py", line 1138, in init_host
2017-03-03 15:35:31.040 TRACE oslo_service.service     self.driver.init_host(host=self.host)
2017-03-03 15:35:31.040 TRACE oslo_service.service   File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 469, in init_host
2017-03-03 15:35:31.040 TRACE oslo_service.service     self._do_quality_warnings()
2017-03-03 15:35:31.040 TRACE oslo_service.service   File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 446, in _do_quality_warnings
2017-03-03 15:35:31.040 TRACE oslo_service.service     caps = self._host.get_capabilities()
2017-03-03 15:35:31.040 TRACE oslo_service.service   File "/opt/stack/nova/nova/virt/libvirt/host.py", line 639, in get_capabilities
2017-03-03 15:35:31.040 TRACE oslo_service.service     xmlstr = self.get_connection().getCapabilities()
2017-03-03 15:35:31.040 TRACE oslo_service.service   File "/opt/stack/nova/nova/virt/libvirt/host.py", line 463, in get_connection
2017-03-03 15:35:31.040 TRACE oslo_service.service     raise exception.HypervisorUnavailable(host=CONF.host)
2017-03-03 15:35:31.040 TRACE oslo_service.service HypervisorUnavailable: Connection to the hypervisor is broken on host: masterneutron
2017-03-03 15:35:31.040 TRACE oslo_service.service
2017-03-03 15:35:31.051 DEBUG oslo_concurrency.lockutils [req-b130d18f-6c7f-4c3c-b4e4-18e057e647b0 None None] Acquired semaphore "singleton_lock" from (pid=5403) lock /usr/local/lib/python2.7/dist-packages/oslo

Saturday, March 4, 2017

Howto VirtualBox VBoxManage increase number of cpus

$ vboxmanage list vms

$ Poweroff the VM

$ VBoxManage modifyvm my-vm-name --cpuhotplug on

$ VBoxManage controlvm my-vm-name plugcpu 0
$ VBoxManage controlvm my-vm-name plugcpu 1
$ VBoxManage controlvm my-vm-name plugcpu 2
$ VBoxManage controlvm my-vm-name plugcpu 3
$ VBoxManage controlvm my-vm-name plugcpu 4
$ VBoxManage controlvm my-vm-name plugcpu 5

$Poweron the VM

$ cat /proc/cpuinfo | grep processor | wc -l
6

Friday, March 3, 2017

How to compile and install QEMU version 2.1.0 or greater

$qemu-system-x86_64 --version

$sudo apt-get install build-essential zlib1g-dev

$sudo apt-get --no-install-recommends -y build-dep qemu

$wget http://wiki.qemu-project.org/download/qemu-2.1.0.tar.bz2

$tar -xvf qemu-2.1.0.tar.bz2

$cd qemu-2.1.0/

$./configure

$make

$sudo make install


InternalError: Nova requires libvirt version 1.2.9 or greater.

$wget https://libvirt.org/sources/libvirt-1.2.9.tar.gz

$sudo apt-get build-dep libvirt

$sudo tar xvzf libvirt-1.2.9.tar.gz -C /usr/src

$cd /usr/src/libvirt-1.2.9




$sudo ./configure --prefix=/usr/

$sudo make

$sudo make install