-
Notifications
You must be signed in to change notification settings - Fork 168
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
Add blockcopy xml test cases #2912
Add blockcopy xml test cases #2912
Conversation
89b564b
to
9501324
Compare
PASS 1-type_specific.io-github-autotest-libvirt.virsh.blockcopy_xml.positive_test.block_test.pivot PASS 1-type_specific.io-github-autotest-libvirt.virsh.blockcopy_xml.positive_test.nbd_test.pivot PASS 1-type_specific.io-github-autotest-libvirt.virsh.blockcopy_xml.positive_test.file_test.pivot PASS 1-type_specific.io-github-autotest-libvirt.virsh.blockcopy_xml.positive_test.iscsi_test.pivot PASS 1-type_specific.io-github-autotest-libvirt.virsh.blockcopy_xml.positive_test.ceph_test.pivot |
9501324
to
e343026
Compare
3db8d07
to
e35da6e
Compare
virt_disk_device_target = "vdb" | ||
virt_disk_device_format = "raw" | ||
virt_disk_device_bus = "virtio" | ||
variants blockcopy_option: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo? Please correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, see usage from https://avocado-vt.readthedocs.io/en/latest/CartesianConfig.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the reference.
virsh_dargs = {'debug': True, 'ignore_status': True} | ||
ignore_check = False | ||
|
||
def check_blockcopy_xml(vm_name, source_image, ignore_check=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'ignore_check' seems unnecessary. If we do not check, we need not to call this function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is tip to make code follow consistent workflow, rather than see too many if ... else
if backend_storage_type == "file": | ||
image_filename = params.get("image_filename", "raw.img") | ||
disk_path = os.path.join(data_dir.get_tmp_dir(), image_filename) | ||
if blockcopy_option in ['reuse_external']: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If only one item, is it better to use blockcopy_option == 'reuse_external' simply?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reserved for further extension
"hosts": [{"name": gluster_host_ip, | ||
"port": "24007"}]} | ||
checkout_device_source = gluster_img_name | ||
test.cancel("gluster permission denied issue,see https://bugzilla.redhat.com/show_bug.cgi?id=1447694") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure the reason to raise an exception here directly. Don't we need to run some commands and filter the output to decide if cancel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be some problem here, even have bug, we still need to give test.fail and let CI judge it is skip or not. And the bug info can shown in test.fail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we now know Bugzilla 1447694 is currently-existed known issue, using test.cancel directly can save prepare effort, which is nothing useful when case is cancelled eventually.
tp-libvirt is standalone upstream project, does it make sense that additional CI is necessarily used to judge skip or not. How can we assume that any team ,which want to use tp-libvirt, need setup CI as pre-request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dealing with the skip case in CI will keep the code consistent even the bug fixed, so we prefer not deal with the bug in code. Else, you may forget to update it even the bug fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upstream first!
As tp-libvirt is standalone upstream project, if issue can be handled in upstream, we CAN NOT leave it to be handled by downstream , such as CI, which you mentioned here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure that this bug is RHEL bug but not upstream bug, it is not suitable to show non upstream bug number here. The case fail with bug is acceptable for upstream testing as it have fail/bug indeed. Also we set in CI not change the failure result of tp-libvirt test, it just SHOW SKIP in jenkins, but still failure in test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And also, a test.cancel here without any situation is not a reasonable logic. Please think and check again, thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete this part test logic (gluster)to avoid PR stuck due to some controversy.
Once condition is met, this logic can be brought back.
logging.debug("disk auth dict is: %s" % disk_auth_dict) | ||
disk_source.auth = disk_xml.new_auth(**disk_auth_dict) | ||
disk_xml.source = disk_source | ||
logging.debug("new disk xml is: %s", disk_xml) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you move L252-L265 to L285 where it is referenced for better readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all code lines before 251 prepare disk source with different backing end, just after that, one disk_xml is provisioned to consume disk source. Therefore, the workflow sounds very natural.
try: | ||
nbd.cleanup() | ||
except Exception as ndbEx: | ||
logging.info("Clean Up nbd failed: %s" % str(ndbEx)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logging.error is better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe forget to update?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, updated now
virt_disk_device_type = "network" | ||
nbd_server_port = "10001" | ||
variants: | ||
- positive_test: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nothing more for it? If you want to reserve a interface here, maybe you also need a parameter to show how to judge it is positive or negative
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is reserved for extension. Once it happen, one variant will be added for that.
for line in blklist: | ||
if line.strip().startswith(('hd', 'vd', 'sd', 'xvd')): | ||
source_imge_list.append(line.split()[-1]) | ||
logging.debug('vm list is :') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what you want to debug here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe forget to update?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated now
"hosts": [{"name": gluster_host_ip, | ||
"port": "24007"}]} | ||
checkout_device_source = gluster_img_name | ||
test.cancel("gluster permission denied issue,see https://bugzilla.redhat.com/show_bug.cgi?id=1447694") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be some problem here, even have bug, we still need to give test.fail and let CI judge it is skip or not. And the bug info can shown in test.fail
size=size, disk_format="raw") | ||
s_attach = virsh.attach_disk(vm_name, tmp_device_source, device_target, | ||
"--config", debug=True) | ||
libvirt.check_exit_status(s_attach) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use ignore_status in virsh, thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is common usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, acceptable as discussed
result = virsh.blockcopy(vm_name, device_target, "--xml %s" % disk_xml.xml, | ||
options=options, | ||
debug=True) | ||
libvirt.check_exit_status(result) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is common usage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, acceptable as discussed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please check the comments and give update, thanks
e35da6e
to
62eea85
Compare
"hosts": [{"name": gluster_host_ip, | ||
"port": "24007"}]} | ||
checkout_device_source = gluster_img_name | ||
test.cancel("gluster permission denied issue,see https://bugzilla.redhat.com/show_bug.cgi?id=1447694") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two points I'd like to say:
-
As the team discussed before, we use CI blacklist to filter the expected error message to decide if the failure should be ignored or not. This method has been used for long time within the team. For this bug, if we use blacklist way, we need raise test.fail(xxx) if checking fails and blacklist will check 'xxx' to decide 'skip' or 'fail'. And when the bug is fixed, the case will PASS without any other updates by us.
But if you would not like this way, shall we discuss if this way's good for us? Would you like to launch the discussion? -
Using your current way, would you like to track the status of this bug and update the case when the bug is fixed in future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I mention previously, upstream first is our senior principle and Red Hat's value proposition.
Please keep mind that what upstream does and what downstream does.
If CI blacklist can have better handling for bugzilla status, we can consider move those logic into tp-libvirt.
For example, we can check whether the bugzilla is valid before we can test.cancel.
Moreover, even checking current CI blacklist ,you will find that there are nearly 3000 lines there,and all mess up and become more and more hard to maintain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please check comments, thanks
62eea85
to
1ecc69f
Compare
1ecc69f
to
eb472fe
Compare
checkout_device_source = ceph_disk_name | ||
elif backend_storage_type == "nbd": | ||
# Get server hostname. | ||
hostname = process.run('hostname', ignore_status=False, shell=True, verbose=True).stdout_text.strip() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to use python built-in function to get host name according to we discussed before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
# Create an local image and make FS on it. | ||
disk_cmd = ("qemu-img create -f %s %s %s" % | ||
(device_format, img_file, storage_size)) | ||
process.run(disk_cmd, ignore_status=False, shell=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libvirt.create_local_disk() can easily work for L187-189.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
"name": "%s/%s" % (iscsi_target, lun_num)}, | ||
"hosts": [{"name": iscsi_host, "port": iscsi_port}]} | ||
checkout_device_source = 'emulated-iscsi' | ||
elif backend_storage_type == "ceph": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I strongly recommend we create some ceph utility functions because it seems many work can be reuse, for example, convert the image to remote storage, clear disks in advance, prepare config file/package and so on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create one issue to track the progress:#3055
|
||
logging.debug("device source is: %s", device_source) | ||
# Add disk xml. | ||
vmxml = vm_xml.VMXML.new_from_dumpxml(vm_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libvirt.create_disk_xml() should work for Line 230 - 242.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if check the implementation libvirt.create_disk_xml(), it use nearly hardcoded source_params to create disk_source,which will not satisfy current situation covering different backend storage.
source_params = {"attrs": source_attrs, "seclabels": source_seclabel,
"hosts": source_host}
src_config_file = params.get("source_config_file")
if src_config_file:
source_params.update({"config_file": src_config_file})
# If we use config file, "hosts" isn't needed
if "hosts" in source_params:
source_params.pop("hosts")
snapshot_name = params.get('source_snap_name')
if snapshot_name:
source_params.update({"snapshot_name": snapshot_name})
disk_source = diskxml.new_disk_source(**source_params)
libvirt.setup_or_cleanup_iscsi(is_setup=False) | ||
elif backend_storage_type == "ceph": | ||
# Remove ceph configure file if created. | ||
if ceph_cfg: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For ceph client clean up, it is better to create a reusable function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use one issue to track the progress:#3055
Cover different backend storage such as file,block,iscsi,rbd,nbd,ceph and gluster Signed-off-by: chunfuwen <[email protected]>
eb472fe
to
e64131e
Compare
@dzhengfy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have issues tracking for some discussion points.
Cover different backend storage such as file,block,iscsi,rbd,nbd,ceph and gluster
Signed-off-by: chunfuwen [email protected]