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

pool/volume create/import/destroy for uzfs #43

Merged
merged 21 commits into from
May 9, 2018

Conversation

vishnuitta
Copy link

@vishnuitta vishnuitta commented May 2, 2018

In uZFS, pool and volume creation/destroy and import paths are not complete and patchy.
Below are changes:

  • Bring up the uZFS engine without importing any pools, and, by reading any cache file if provided
  • Create uZFS and ZINFO related structures during pool import, volume creation
  • Hold the dataset during handshake of replica volume with target
  • clear dataset during destroy of pool or volume, and during export of pool
  • uZFS pool initialization done along with creation of txg threads
  • uZFS pool destroy done along with destroy of txg threads
  • Avoided above steps for snapshots
  • Removed test_export gtest code as those test cases are covered in script and other test cases. Otherwise, fixes are required here also due to change in the way target IP is made mandatory.
    Along with stabilization of current testcases and travis, added:
  • IOs on volumes which are imported by pool import
  • CLI tests for creating volumes with targetIP option

Without target IP option for 'zfs create' command, volume will be created, but, uZFS and ZINFO related data structures won't be created.

Copy link

@jkryl jkryl left a comment

Choose a reason for hiding this comment

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

Nice changes! thanks Vitta

@@ -654,14 +654,17 @@ open_pool(spa_t **spa)
}

void
open_ds(spa_t *spa, zvol_state_t **zv)
open_ds(spa_t *spa, char *ds, zvol_state_t **zv)
Copy link

Choose a reason for hiding this comment

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

it is a mystery to me that the previous code was compilable without ds being declared as local var or passed as parameter. Could you explain?

Copy link
Author

Choose a reason for hiding this comment

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

there seems to be a global variable with same name.. :)

int err;
err = uzfs_open_dataset(spa, ds, zv);
if (err != 0) {
printf("ds open errored.. %d\n", err);
exit(1);
}
(void) snprintf(name, sizeof (name), "%s/%s", spa_name(spa), ds);
Copy link

Choose a reason for hiding this comment

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

I don't see name[] used anywhere.

Copy link
Author

Choose a reason for hiding this comment

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

true.. will remove it

}

/*
* Send command to read data and read reply header. Reading payload is
* left to the caller.
*/
void read_data_start(size_t offset, int len, zvol_io_hdr_t *hdr_inp)
void read_data_start(int m_data_fd, int &m_ioseq, size_t offset, int len,
Copy link

Choose a reason for hiding this comment

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

Just if we can rename m_data_fd -> data_fd and m_ioseq -> ioseq (and the same change for write_data_start, write_data_and_verify_resp, write_two_chunks_and_verify_resp, read_data_and_verify_resp). The reason is that the "m_" prefix implies a class member variable, while in this case it is ordinary method parameter.

Thinking more about it. Let's move these methods completely out of the class and make functions from them. There was a value to have them as methods when they were accessing class member fields m_data_fd and m_io_seq, but since now we pass all context information to them through parameters, there is not a good reason why these methods should not be converted to utility functions outside of the class.

Copy link
Author

Choose a reason for hiding this comment

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

sure.. will remove "m_" prefix.. will also check if these can be moved out of class


do_handshake(m_zvol_name1, m_host1, m_port1, m_control_fd1,
ZVOL_OP_STATUS_OK);
m_zrepl->kill();
Copy link

Choose a reason for hiding this comment

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

I'm wondering why do we restart zrepl in setup hook. The purpose of this function is to set up test environment and not to test anything here. Besides that, we already have a test case for creating a zvol before and after restart if I remember correctly. So I would prefer the simplest code here, which is to create both zvols at once without restart.

Copy link
Author

@vishnuitta vishnuitta May 7, 2018

Choose a reason for hiding this comment

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

other test case where zrepl is killed won't send IOs @jkryl .. I noticed a code issue while fixing some other issue and checked why this code was not catching it. Hence, added this test case.

}
// } catch (std::runtime_error re) {
// ;
// }
Copy link

Choose a reason for hiding this comment

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

I'm not sure if this is a good idea. But let's try it :-) In theory this command should never fail, but we know that even zpool destroy sometimes fails with EBUSY.

Copy link
Author

Choose a reason for hiding this comment

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

this being test code, idea is - lets see if this errors out and fix the reason for it

fprintf(stderr, "Unknown zvol: %s\n", zvol_name);
if (((zinfo = uzfs_zinfo_lookup(zvol_name)) == NULL) ||
(zinfo->mgmt_conn != conn)) {
ZREPL_ERRLOG("Unknown zvol: %s\n", zvol_name);
Copy link

Choose a reason for hiding this comment

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

let's avoid using ZREPL_ERRLOG in mgmt_conn.c file. syslog logging is going to be removed from zrepl in the future and I already cleaned mgmt_conn.c file from them. All messages here should be either error messages to stderr or debug messages using DBGCONN (which end up on stderr as well). This particular message should be fprintf(stderr, ...) since it is not a debug message.

Copy link
Author

Choose a reason for hiding this comment

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

ok.. I will change it.. one reason I changed this is - I'm not seeing the logs coming to /var/log/syslog.. where will these logs goes?

* Try to obtain controller address from zfs property.
*/
static int
get_controller_ip(objset_t *os, char *buf, int len)
Copy link

Choose a reason for hiding this comment

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

I remember I had to pull a few zfs header files because of this function to mgmt_conn.c. Most likely dmu* and dsl* header files are not needed anymore. Would be good if we can clean them up from this file as part of this change.

Copy link
Author

Choose a reason for hiding this comment

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

makes sense.. will do that

printf("zrepl command args ... \nwhere 'command' is one of:\n\n");
printf("\t import <pool_name> [-t ip address)]\n");
printf("\t start [-t ip address)]\n");
}
Copy link

Choose a reason for hiding this comment

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

Now when we removed start and import subcommands and zrepl starts without any parameters, I have a question what is the expected way of importing a pool holding replicas by sidecar. Is it:

cmd/zrepl/zrepl
# after zrepl is up and running (probably execute in loop with sleep 1):
cmd/zpool/zpool import <name>

?

Copy link
Author

Choose a reason for hiding this comment

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

yes @jkryl

@@ -22,6 +22,8 @@ before_install:
# packages for tests
- sudo apt-get install --yes -qq parted lsscsi ksh attr acl nfs-kernel-server fio
- sudo apt-get install --yes -qq libgtest-dev cmake
# packages for debugging
- sudo apt-get install gdb
Copy link

Choose a reason for hiding this comment

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

nice, I assume that this is to help us debug problems using gdb on travis directly, correct?

Copy link
Author

@vishnuitta vishnuitta May 7, 2018

Choose a reason for hiding this comment

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

right @jkryl .. after this, idea is to have a script that loads and prints stacktrace of a coredump

@vishnuitta
Copy link
Author

updated the review comments @jkryl .. let me know if this looks good

Copy link

@jkryl jkryl left a comment

Choose a reason for hiding this comment

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

Looks good to me. thanks!

Copy link
Collaborator

@satbirchhikara satbirchhikara left a comment

Choose a reason for hiding this comment

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

Looks good to me sir.

@vishnuitta vishnuitta merged commit 19a1f73 into mayadata-io:zfs-0.7-release May 9, 2018
jkryl pushed a commit that referenced this pull request Jun 26, 2018
* pool/volume create/import/destroy/export for uzfs
* testcase to do IOs on imported pools
* CLI tests for target IP address
* owning dataset in uZFS during handshake with target

Signed-off-by: Vishnu Itta <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants