Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal database must be set with dbdisk option in ap and in cli #277

Merged
merged 4 commits into from
Oct 13, 2017

Conversation

ailisp
Copy link
Member

@ailisp ailisp commented Sep 29, 2017

ISSUE:
When setting internal database in appliance console cli, the user can set without given a --dbdisk option, which is not supported.
BZ:
https://bugzilla.redhat.com/show_bug.cgi?id=1431815
https://bugzilla.redhat.com/show_bug.cgi?id=1425153

\cc @yrudman @gtanzillo

@miq-bot add-label wip,bug

@ailisp ailisp force-pushed the cli-internal-db-disk branch 2 times, most recently from ce2c751 to 949164c Compare September 30, 2017 00:22
@ailisp
Copy link
Member Author

ailisp commented Sep 30, 2017

@miq-bot remove-label wip

@miq-bot miq-bot changed the title [WIP] internal database must be set with dbdisk option in cli internal database must be set with dbdisk option in cli Sep 30, 2017
@miq-bot miq-bot removed the wip label Sep 30, 2017
@yrudman
Copy link
Contributor

yrudman commented Oct 2, 2017

@ailisp there is another check requested in the same BZ- do not allow blank password

@carbonin
Copy link
Member

carbonin commented Oct 2, 2017

I believe this will break ManageIQ appliance builds.

See https://github.com/ManageIQ/manageiq-appliance-build/blob/master/kickstarts/partials/post/db_init.ks.erb#L7

I think we should come up with a way to allow this behavior through the CLI.

For example if someone configures a logical volume and wants to put the database there (as we do on the ManageIQ appliance), we should allow them to do that.

As I see it, the real issue is that we want the database on a separate filesystem not necessarily a separate disk. Unfortunately, we don't do any validation against filesystems so checking that case would be much more difficult.

@carbonin
Copy link
Member

carbonin commented Oct 2, 2017

there is another check requested in the same BZ- do not allow blank password

@yrudman I think it would be better to do this one in a separate PR.

@yrudman
Copy link
Contributor

yrudman commented Oct 2, 2017

@carbonin yes, it is better to do password present validation in different PR

@ailisp
Copy link
Member Author

ailisp commented Oct 4, 2017

As I see it, the real issue is that we want the database on a separate filesystem not necessarily a separate disk. Unfortunately, we don't do any validation against filesystems so checking that case would be much more difficult.

@carbonin do you mean the device number of filesystem? In this question:
https://unix.stackexchange.com/questions/44249/how-to-check-if-two-directories-or-files-belong-to-same-filesystem
I did some try:

[boyao@localhost ~]$ df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 5.8G     0  5.8G   0% /dev
tmpfs                    5.8G  988K  5.8G   1% /dev/shm
tmpfs                    5.8G  1.6M  5.8G   1% /run
tmpfs                    5.8G     0  5.8G   0% /sys/fs/cgroup
/dev/mapper/fedora-root   50G  6.8G   40G  15% /
tmpfs                    5.8G   88K  5.8G   1% /tmp
/dev/sda1                477M  149M  299M  34% /boot
/dev/mapper/fedora-home  180G   26G  145G  16% /home
tmpfs                    1.2G   24K  1.2G   1% /run/user/42
tmpfs                    1.2G   32K  1.2G   1% /run/user/1000
[boyao@localhost ~]$ stat -c "%d" /
64769
[boyao@localhost ~]$ stat -c "%d" /var
64769
[boyao@localhost ~]$ stat -c "%d" /dev
6

@ailisp
Copy link
Member Author

ailisp commented Oct 4, 2017

@yrudman Thanks for the note. Seems I should wait this PR merged then open another PR for checking password. otherwise some conflict will happen in prompts.rb

@carbonin
Copy link
Member

carbonin commented Oct 4, 2017

@ailisp Generally, yes, but I don't think the place for that is in the cli class.

If we want a more complete fix, we could edit the InternalDatabaseConfiguration class so that we have an option to verify that the data directory is on a separate filesystem, alternatively you can check that APPLIANCE_PG_MOUNT_POINT is indeed a mount point.

@yrudman
Copy link
Contributor

yrudman commented Oct 4, 2017

@ailisp you can create tracking branch:
git checkout -b feature_2 --track feature_1

@ailisp ailisp closed this Oct 4, 2017
@ailisp ailisp force-pushed the cli-internal-db-disk branch from 949164c to 795d14e Compare October 4, 2017 15:28
@ailisp ailisp reopened this Oct 4, 2017
@ailisp
Copy link
Member Author

ailisp commented Oct 4, 2017

@miq-bot add-label wip

@miq-bot miq-bot changed the title internal database must be set with dbdisk option in cli [WIP] internal database must be set with dbdisk option in cli Oct 4, 2017
@miq-bot miq-bot added the wip label Oct 4, 2017
@ailisp
Copy link
Member Author

ailisp commented Oct 4, 2017

@carbonin Yuri and I think this #276 can be closed now, because your suggestion to check APPLIANCE_PG_MOUNT_POINT should solve both BZs. What do you think?
Also, should we check database_replication_standby's mount point in the same way?

@@ -121,6 +123,11 @@ def copy_template(src, src_dir = self.class.postgresql_template, dest_dir = Post
end
end

def check_pg_mount_point
is_mount_point = Class.new.include(LinuxAdmin::Mountable).mount_point_exists?(mount_point)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you not just use LinuxAdmin::LogicalVolume here?

@@ -82,6 +83,7 @@ def initialize_postgresql_disk

def initialize_postgresql
log_and_feedback(__method__) do
check_pg_mount_point
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would make more sense as a check in activate or even in ask_questions.

Right after choose disk we could print some error message unless disk || have_pg_mount_point?

@carbonin
Copy link
Member

carbonin commented Oct 4, 2017

@ailisp I think we can close the other PR. I would like to do the checking earlier though.

@ailisp ailisp changed the title [WIP] internal database must be set with dbdisk option in cli [WIP] internal database must be set with dbdisk option in ap and in cli Oct 5, 2017
@ailisp ailisp force-pushed the cli-internal-db-disk branch 3 times, most recently from eb88bda to 84b62a7 Compare October 6, 2017 13:28
@ailisp ailisp force-pushed the cli-internal-db-disk branch from b0f98c9 to 5c590a8 Compare October 6, 2017 15:35
@ailisp ailisp force-pushed the cli-internal-db-disk branch from ee52e5a to 99937e2 Compare October 6, 2017 18:57
@miq-bot
Copy link
Member

miq-bot commented Oct 6, 2017

Checked commits ailisp/manageiq-gems-pending@7ae42c0~...99937e2 with ruby 2.3.3, rubocop 0.47.1, and haml-lint 0.20.0
4 files checked, 2 offenses detected

lib/gems/pending/appliance_console/cli.rb

@ailisp
Copy link
Member Author

ailisp commented Oct 6, 2017

@miq-bot remove-label wip

@miq-bot miq-bot changed the title [WIP] internal database must be set with dbdisk option in ap and in cli internal database must be set with dbdisk option in ap and in cli Oct 6, 2017
@miq-bot miq-bot removed the wip label Oct 6, 2017
@ailisp
Copy link
Member Author

ailisp commented Oct 6, 2017

@yrudman @carbonin
works fine in both appliance console and cli now

@carbonin carbonin self-assigned this Oct 13, 2017
@carbonin carbonin merged commit 367b50d into ManageIQ:master Oct 13, 2017
@carbonin carbonin added this to the Sprint 71 Ending Oct 16, 2017 milestone Oct 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants