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

Add storage and image management support #3864

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

zhencliu
Copy link
Contributor

@zhencliu zhencliu commented Mar 8, 2024

No description provided.

@zhencliu zhencliu force-pushed the cluster branch 3 times, most recently from 9779000 to d262029 Compare April 2, 2024 09:37
@YongxueHong YongxueHong self-assigned this Apr 8, 2024
@zhencliu zhencliu force-pushed the cluster branch 4 times, most recently from 5b92551 to 6b3310e Compare June 13, 2024 10:00
@zhencliu zhencliu force-pushed the cluster branch 3 times, most recently from 8fcab3f to 342d7e8 Compare July 23, 2024 06:40
@zhencliu zhencliu force-pushed the cluster branch 2 times, most recently from d0a1ebe to 5b7c04b Compare August 5, 2024 03:12
@zhencliu zhencliu force-pushed the cluster branch 2 times, most recently from 1c9b232 to e8d1295 Compare August 20, 2024 08:44
@zhencliu zhencliu force-pushed the cluster branch 6 times, most recently from 648e892 to 79c172d Compare August 30, 2024 13:54
@zhencliu zhencliu force-pushed the cluster branch 5 times, most recently from a21eb6d to 11452bb Compare September 9, 2024 06:55
@zhencliu zhencliu force-pushed the cluster branch 4 times, most recently from e90dc16 to a4cc6ce Compare September 27, 2024 08:36
@zhencliu zhencliu force-pushed the cluster branch 3 times, most recently from 9b28459 to fe6f5c2 Compare October 12, 2024 07:39
Comment on lines 52 to 53
teardown_resmgr()
vt_imgr.teardown()
Copy link
Contributor

Choose a reason for hiding this comment

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

move out of the blocker for

"uuid": "uuid-sn"
"name": "sn",
"type": "qemu",
"topology": {"chain": ["base", "sn"]}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"topology": {"chain": ["base", "sn"]}
"topology": {"$type: chain; flat", ["$tag: ", "sn"]}

return volume_opts_getter(volume_config)


def get_image_opts(virt_image_config):
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename the argument virt_image_config

config = super()._define_config_legacy(resource_name, resource_params)
config["meta"].update({
"type": cls._RESOURCE_TYPE,
"volume-type": cls.volume_type,
Copy link
Contributor

Choose a reason for hiding this comment

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

[stdlog] 2024-07-25 11:25:37,177 avocado.virttest.vt_vmm.objects.instance_spec_qemu instance_spec_qe L1196 DEBUG| --> disk source: {'meta': {'uuid': 'fec24fc199ff4b54b9f334403b13036a', 'name': 'image1', 'type': 'qemu', 'topology': {'none': ['image1']}}, 'spec': {'virt-images': {'image1': {'meta': {'name': 'image1'}, 'spec': {'format': 'qcow2', 'volume': {'meta': {'name': 'image1', 'uuid': 'bbe8f7b1409e402d9344099bc6908c9f', 'type': 'volume', 'pool': {'meta': {'name': 'dir_pool1', 'uuid': 'ebbbefc61517466baee18cd07ee9fbf7', 'type': 'filesystem', 'access': {'nodes': ['host1']}}, 'spec': {'path': '/home/'}}, 'allocated': False, 'bindings': {'host1': '5b1b03d28aea4f6584b9e675085f4094'}, 'volume-type': <bound method _Volume.volume_type of <class 'virttest.vt_resmgr.resources.storage.dir.dir_resources._DirFileVolume'>>, 'raw': False}, 'spec': {'size': '21474836480', 'allocation': 0, 'uri': '/home/images/rhel950-64-virtio-scsi-ovmf.qcow2', 'filename': 'images/rhel950-64-virtio-scsi-ovmf.qcow2'}}, 'backing': None, 'cluster-size': None, 'lazy-refcounts': None, 'compat': None, 'preallocation': None, 'extent_size_hint': None, 'compression_type': None}}}}}

Copy link
Contributor

Choose a reason for hiding this comment

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

{
	'meta': 
		{
			'uuid': 'fec24fc199ff4b54b9f334403b13036a', 
			'name': 'image1', 
			'type': 'qemu', 
			'topology': {'none': ['image1']}
		}, 
	'spec': 
		{
			'virt-images': 
				{
					'image1': 
						{
							'meta': {'name': 'image1'}, 
							'spec': 
								{
									'format': 'qcow2', 
									'volume': 
										{
											'meta': 
												{
													'name': 'image1', 
													'uuid': 'bbe8f7b1409e402d9344099bc6908c9f', 
													'type': 'volume', 
													'pool': 
														{
															'meta': 
																{
																	'name': 'dir_pool1', 
																	'uuid': 'ebbbefc61517466baee18cd07ee9fbf7', 
																	'type': 'filesystem', 
																	'access': {'nodes': ['host1']}
																}, 
															'spec': {'path': '/home/'}
														}, 
													'allocated': False, 
													'bindings': {'host1': '5b1b03d28aea4f6584b9e675085f4094'}, 
													'volume-type': <bound method _Volume.volume_type of <class 'virttest.vt_resmgr.resources.storage.dir.dir_resources._DirFileVolume'>>, 
													'raw': False
												}, 
											'spec': 
												{
													'size': '21474836480', 
													'allocation': 0, 
													'uri': '/home/images/rhel950-64-virtio-scsi-ovmf.qcow2', 
													'filename': 
													'images/rhel950-64-virtio-scsi-ovmf.qcow2'
												}
										}, 
									'backing': None, 
									'cluster-size': None, 
									'lazy-refcounts': None, 
									'compat': None, 
									'preallocation': None, 
									'extent_size_hint': None, 
									'compression_type': None
								}
						}
				}
		}
}

config = super()._define_config_legacy(resource_name, resource_params)
config["meta"].update({
"type": cls._RESOURCE_TYPE,
"volume-type": cls.volume_type,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"volume-type": cls.volume_type,
"volume-type": cls.volume_type(),

@classmethod
def define_config(cls, pool_name, pool_params):
config = super().define_config(pool_name, pool_params)
path = pool_params.get("path") or os.path.join(get_data_dir(), "images")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should consider the situation with the remote node if we do not specify the pool path in the cluser.json

pool_conn = self._pool_connections[backing.source_pool_id]
cmd, arguments = new_config.popitem()
handler = backing.get_update_handler(cmd)
ret = handler(pool_conn, arguments)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
ret = handler(pool_conn, arguments)
if cmd == "sync":
ret = handler(pool_conn)
else:
ret = handler(pool_conn, arguments)

image_name, image_params
)

config = super()._define_config_legacy(image_name, params)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
config = super()._define_config_legacy(image_name, params)
config = super()._define_config_legacy(image_name, params)
image_params = params.object_params(image_name)
config["meta"]["user"] = image_params.get(f"image_owner_{image_name}")

self._pools = dict()
self._default_pools = list()
if os.path.isfile(RESMGR_ENV_FILENAME):
self._load()
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
self._load()
self._load()
else:
self._dump_data = {"pools": dict()}


def cleanup(self):
LOG.info(f"Cleanup the resource manager")

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
self._dump_data = {"pools": dict()}

@zhencliu zhencliu force-pushed the cluster branch 2 times, most recently from 3c3ca0a to 1309ce1 Compare November 14, 2024 07:34
@zhencliu zhencliu force-pushed the cluster branch 10 times, most recently from c2d6044 to 1fef734 Compare November 28, 2024 14:37
@zhencliu zhencliu force-pushed the cluster branch 7 times, most recently from 854d1cc to 71a8661 Compare December 10, 2024 08:00
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