четверг, 3 марта 2022 г.

Ukraine: Why it's happening

I'm not a politician or an analyst, but I wanted to share my point of view. I read BBC news and see nothing related to reality. However, FoxNews gave some adequate explanations, but I'm not sure they were heard. So, briefly, what's happening and why it's happening. Perhaps, at least my EU or US friends will read this. And as Russian citizen I'm not pretending to be objective.

  • Politics has always been dirty and cinic. Peace is only possible when there is a balance of forces in the region or when one state suppresses all other. In later case peace is usually not stable (we can recollect Iraq or Serbia here - tragedies there were only possible because one state considered itself (and was) a super-power). Moreover, peace in Europe for 70 yeears was possible only because major competitors in the Cold War had nuclear weapons and so had to tolerate each other.
  • A war is always terrible. Especially when it's a war with brother nation. And a lot of Russian people do have relatives and friends in Ukraine, so war with Ukraine is very painful for all sane Russians.
  • But this is not a war against Ukraine, although Ukraine suffers most from this war. It's a conflict with USA, NATO and EU.
  • This conflict has begun not on 24th or 21st of February, and even not in 2014. It began in 2008, when NATO targeted at incorporating Georgia and Ukraine.
  • Ukraine has chosen a side in this conflict not in 2022, but in 2013, when legal pro-Russian government was deposed. Pro-western government was established. Likely this government was popular that days. A course for EU integration and collaboration with NATO was chosen.
  • Russia, seeing this as a threat, secured Sebastopol Naval base by annexing Crimea (and local people appreciated this). The second action was to support separatists in Donbass. They were Russians, and we protected them, and this weakened now pro-western Ukraine. If you want to know more about how Ukraine treated them, you can look at the document linked below.
  • During last 6-7 years Russia has made attempts to arrange an agreement with US (and NATO) on the Ukranian crisis. Minsk agreements were signed in 2015, but were not respected by Ukraine or its partners.
  • Escalation of this crisis has begun in 2021. Not sure why. Likely during this period NATO started to ship war drones to Ukraine (besides other weapon). This made our government concerned. And instead of negotiations, we got several provocations - like UK warship in our waters. What would happened if our border guards flooded it? Don't want to consider. But the one sending it there was likely mad.
  • Presence of NATO forces in Georgia and Ukraine is considered an existencial threat for Russia. And our government has shown that it's ready to military actions if this possibility becomes more real in 2008 during crisis in Georgia.
  • NATO declares that Ukraine is not considered as a possible NATO member. But current world-wide support contradicts this. Ukraine de-facto is treated as NATO member.
  • It's clear that both sides (USA and Russia) have been preparing for this conflict for long (it seems to me, since last December).
  • The last straw (it appears) was the declaration of Ukraine president that his country will leave Budapest Memorandum. Besides all, Budapest Memorandum forbids Ukraine to have nuclear weapon.

Everyone can see what happened next. But don't consider that this war has begun in February. Everything is much deeper and harder. Absence of good will from NATO (and first of all, from USA) and irresponsible behavior of Ukranian government has lead to situation which could be avoided. In Russia we like to blame Stalin that he didn't prepare for the WWII. So, for Russian people this is the 21st June. A strike back just a day (or, likely, a decade) before NATO strike. This is not a liberation of Ukraine, but a war for safety of our borders. So in this situation we will not listen for calls for peace until Ukraine will not be a threat for Russia. Again, by no means, this is not a war against Ukranian people. This is a war agains their anti-russian elite and government. This is a war for peace near our borders. And as most Russian people see current Ukranian government an immediate threat to Russia, this war will continue until it reaches its objectives - destruction of nationalists in Ukraine. Once again, we didn't want to bring war to Ukranian civilians. It's a tragedy that they are suffering. It's a tragedy to see Ukranian cities damaged. I'm sure we'll win soon. But the sooner West stops supporting the current Ukraine government, the sooner peace will come to that land. And I hope, when everything ends, we'll help Ukranians to reconstruct their cities. But this will not ressurect dead.

For people, who want more context, I'm attaching a Russian Foreign ministry brochure - what was happening for 8 years in Ukraine and what Western countries didn't want to listen about.

вторник, 21 мая 2019 г.

One big Oracle ASM adventure

Well, this has happened long ago, but as I'm going to decomission http://dbseminar.r61.net, I think this information should be moved here...

Originally posted on on Tue, 04/07/2009


I had very unpleasant experience with RAC and ASM. I'd like to share it. Yesterday after VMware ESX Server upgrade (and maybe unsuccessfull live motion operations on one of two RAC nodes) I had the following records in asm instance alert log:
SQL> ALTER DISKGROUP ALL MOUNT
Mon Apr  6 15:48:52 2009
NOTE: cache registered group DATA number=1 incarn=0x3ad84292
NOTE: cache registered group FRA number=2 incarn=0x3b084293
NOTE: cache registered group LOGS number=3 incarn=0x3b084294
Mon Apr  6 15:48:52 2009
ERROR: no PST quorum in group 1: required 2, found 0
Mon Apr  6 15:48:52 2009
NOTE: cache dismounting group 1/0x3AD84292 (DATA)
NOTE: dbwr not being msg'd to dismount
ERROR: diskgroup DATA was not mounted
Mon Apr  6 15:48:52 2009
ERROR: no PST quorum in group 2: required 2, found 0
Mon Apr  6 15:48:52 2009
NOTE: cache dismounting group 2/0x3B084293 (FRA)
NOTE: dbwr not being msg'd to dismount
ERROR: diskgroup FRA was not mounted
Mon Apr  6 15:48:52 2009
ERROR: no PST quorum in group 3: required 2, found 0
Mon Apr  6 15:48:52 2009
NOTE: cache dismounting group 3/0x3B084294 (LOGS)
NOTE: dbwr not being msg'd to dismount
ERROR: diskgroup LOGS was not mounted

...
Diskgroups disappeared, and asm didn't want to see them. However, I could see /dev/sd* disks, where diskgroups were placed, and permissions were right: disks were owned by oracle user. select * from v$asm_diskgroup ; gave nothing and select path,header_status from v$asm_disk ; said that all disks were in provisioned state. It was awful, but in the end I've found sollution. I've noticed that kfed sees diskgroup and other attribute on the affected disks, but parameter kfdhdb.acdb.ub2spare is not 0 (as I found in Internet, it was its usual state). So I've dumped header info:
$ kfed read /dev/sdf > /tmp/sdf.noop.mod
$ vi /tmp/sdf.noop.mod  #Changed kfdhdb.acdb.ub2spare to 0
$ kfed op=write dev=/dev/sdf text=/tmp/sdf.noop.mod CHKSUM=YES
After this I could do "alter diskgroup fra mount" in asm instance, repeated this procedure for DATA asm diskgroup, after that I could mount diskgroups and recover my database. In conclusion I wish say that we are going to move our fra to OCFS2 fs the next weekend.

суббота, 20 октября 2018 г.

What is my sftp server doing?

Well, I'm not familiar with DTrace, but sometimes want to find, what some application is doing. In this case I wanted to monitor my sftp server. Luckily, most illumos distributions provide dtrace patch (coming from Oracle Solaris) to find this out. Unluckily, I haven't found any documentation on it, just source code. After reading Translators chapter of DTrace Guide and looking at /usr/lib/dtrace/sftp.d I've come to this:
dtrace -n 'sftp*:::transfer-done { printf ("%d: %s %s %s %d", pid, xlate <sftpinfo_t *>((sftpproto_t*)arg0)->sfi_pathname, xlate <sftpinfo_t *>((sftpproto_t*)arg0)->sfi_user, xlate <sftpinfo_t *>((sftpproto_t*)arg0)->sfi_operation, xlate <sftpinfo_t *>((sftpproto_t*)arg0)->sfi_nbytes  ); }'

dtrace: description 'sftp*:::transfer-done ' matched 8 probes
CPU     ID                    FUNCTION:NAME
  1  80412      process_read:transfer-done 7409: /export/home/user/1.pp user read 1808
  1  80412      process_read:transfer-done 7409: /export/home/user/1.pp user read 0
  1  80411     process_write:transfer-done 7409: /export/home/user/1.pp user write 1808
  1  80412      process_read:transfer-done 7409: /export/home/user/dtrace/poll.d user read 53
  1  80412      process_read:transfer-done 7409: /export/home/user/dtrace/poll.d user read 53

Seems rather interesting to me.

четверг, 30 августа 2018 г.

Quest: creating one hundred zones

Well, I need to create about one hundred zones once again. You could probably use ansible for this, but an old-fashioned man will do everything in shell. So: we have one "golden image" and have to create 100 zones like it. We could clone it, but with clones you receive wonderful issue - beadm activate fails in zone. So we create zones and do send/receive manually. This looks like this:
#!/bin/bash
set -e

for i in $(seq 1 100); do 

    #Creating interface for the zone
    dladm create-vnic -l e1000g1 hnet$i

    #Creating initial config   

    TEMPFILE=$(mktemp /tmp/XXXXXXXXXXXXXXXXXX)
    cat > $TEMPFILE <<EOF
create -b
set zonepath=/zones/h$i
set autoboot=true
set ip-type=exclusive
add net
set physical=hnet$i
end
add capped-memory
set physical=2G
end
add rctl
set name=zone.max-swap
add value (priv=privileged,limit=2147483648,action=deny)
end
add rctl
set name=zone.max-locked-memory
add value (priv=privileged,limit=536870912,action=deny)
end
EOF

    zonecfg -z h$i -f $TEMPFILE
    zfs send -R data/zones/h0@initial | zfs recv -F data/zones/h$i
 
    # Zone tools should know that zone is in installed state, not configured
    # Also during installation zoneadm assigns uuid to zone (last field). We do this manually.
    uuid=$(uuidgen)
    gsed -i  -e "/^h${i}:/ s/\$/${uuid}/" -e "/^h${i}:/ s/configured/installed/" /etc/zones/index
    zoneadm -z h$i mount

    # We known that golden image ip address  ends in 254 and change it
    addr=$((1+$i))
    sed -i -e "s:hnet0:hnet$i:g" -e "s:\.254:.$addr:g" /zones/h$i/root/etc/ipadm/ipadm.conf
    zoneadm -z h$i unmount
    zfs destroy data/zones/h$i@initial
    rm $TEMPFILE
    zoneadm -z h$i boot
done

суббота, 10 февраля 2018 г.

пятница, 13 октября 2017 г.

Does ip belong to network?

It's so easy to check if IP belong to network... Until you start doing this in shell. I've tried and finally got this. This version works in bash, dash and ksh... Good enough for me, but perhaps it could be optimized a bit to avoid cut usage. Our function gets two parameters - ip address and network in address/netmask format. In fact we compare IPaddress & netmask and IPnetwork & netmask.
#!/bin/sh

belongs_network ()
{
   addr=$1
   network=$2

   netaddr=`echo $network | cut -d / -f 1`
   netcdr=`echo $network | cut -d / -f 2`

   a1=$(echo "$addr" | cut -d . -f 1)
   a2=$(echo "$addr" | cut -d . -f 2)
   a3=$(echo "$addr" | cut -d . -f 3)
   a4=$(echo "$addr" | cut -d . -f 4)

   n1=$(echo "$netaddr" | cut -d . -f 1)
   n2=$(echo "$netaddr" | cut -d . -f 2)
   n3=$(echo "$netaddr" | cut -d . -f 3)
   n4=$(echo "$netaddr" | cut -d . -f 4)

   ares=$((($a1*256*256*256+$a2*256*256+$a3*256+$a4)>>(32-$netcdr)))
   nres=$((($n1*256*256*256+$n2*256*256+$n3*256+$n4)>>(32-$netcdr)))

   if [ $ares -eq $nres ] ; then
     return 0
   else
     return 1
   fi
}

if belongs_network 10.208.103.255 10.208.128.0/17; then
  echo "belongs"
else 
  echo "does not belong"
fi