Refactor required service code

Change-Id: I9015216d477bf0fe838db12edacbc9b8e1b865d4
Reviewed-by: Gabor Gombas <Gabor.Gombas@morganstanley.com>
Add justification to all prod personality modification commands

Addresses-Issue: Jira/AQUILON-1871
Change-Id: I1a7a76a2c7533652b3e96a78e2d5e0b14571ea4d
Reviewed-by: Gabor Gombas <Gabor.Gombas@morganstanley.com>
Justification is required on all root commands

Addresses-Issue: Jira/AQUILON-1930
Change-Id: Ifebbeef5f1cd7f18cb7abb317c6d62e43b369659
Reviewed-by: Gabor Gombas <Gabor.Gombas@morganstanley.com>
Locking fixes

SELECT ... FOR UPDARE in Oracle won't return rows that were created
after the query started. So when using that construct to protect from
concurrent allocations within the same table, we need to execute two
queries - first one for taking the lock, the second for getting a
consistent result.

This problem does not exist if we can use a row in a different table as
a lock.

Addresses-Issue: Jira/AQUILON-1957
Change-Id: Ice1392592d1af5d61519e7c4a4c30bef86a478b3
Reviewed-by: Priya Joshi <Priya.Joshi@morganstanley.com>
Add helper for locking multiple objects in the DB

Change-Id: Ib2f58517b9efe1fc60e610c9abcfb662cb606bf4
Reviewed-by: Priya Joshi <Priya.Joshi@morganstanley.com>
Lock ordering fixes

Commands dealing with IP address allocation/deallocation should lock the
DNS domain first, and then the network, to avoid AB-BA deadlocks. To
achieve that, move some checks done by del_address into the
delete_dns_record() helper.

Change-Id: Iabad53aa8d38b7fdf47065fdfd9f0c6555ec446b
Reviewed-by: Priya Joshi <Priya.Joshi@morganstanley.com>
Add more DB-side locking

Add more locking to frequently used commands to prevent users running
into database constraint violations, which are not that nice to
understand.

Change-Id: I2495673c42b855178551c6af9814eba3a3f41272
Reviewed-by: Priya Joshi <Priya.Joshi@morganstanley.com>
Clean up add_interface_machine

Change-Id: Id190bc849d181b6a6e4e1d2cbb873873fecb99d6
Reviewed-by: Priya Joshi <Priya.Joshi@morganstanley.com>
Add emergency option to the commands.

Add "emergency" option while specifying --justification on commands.
The --reason string option needs to be specified when the emergency option is used.

Change-Id: I41fd656b05335da84860d774c8fa1d4a7fe2c136
Reviewed-by: Gabor Gombas <Gabor.Gombas@morganstanley.com>
Merge remote-tracking branches 'origin/for_next/add_justification' and 'origin/for_next/lock_fix'
Update copyright messages

Change-Id: I322127aa915814308ee2b9cfc4d762f6a82d2326
Fix a bunch of pep8 warnings

Change-Id: I1ac257d68aa1d2e7fa1a2acc0c59c1c3688e4d00
Fix a bunch of pylint issues

Change-Id: I95406120c3df4b7457a2768f5e76aa9e447f6ba4
Update copyright messages

Change-Id: I265e40b43ad540c0054add58144a5b617c3594ff