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

drop volumes full paths #45

Closed
wants to merge 1 commit into from

Conversation

enxebre
Copy link
Member

@enxebre enxebre commented Oct 8, 2018

Drop full paths in favour of pool and name based look up for volumes
See openshift/machine-api-operator#70

@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Oct 8, 2018
@enxebre
Copy link
Member Author

enxebre commented Oct 8, 2018

}
defer volPool.Free()
//defer volume.Free()
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to remove this and instead free the returned volumes in each of the calling sites?

@enxebre enxebre added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 9, 2018
@paulfantom
Copy link
Contributor

/approve cancel

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: enxebre

If they are not already assigned, you can assign the PR to them by writing /assign @enxebre in a comment when ready.

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 10, 2018
@openshift-bot
Copy link
Contributor

@enxebre: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 11, 2018
@@ -115,7 +115,7 @@ func createVolumeAndDomain(machine *clusterv1.Machine, offset int) error {
}

// Create domain
if err = libvirtutils.CreateDomain(name, ignKey, name, name, networkInterfaceName, networkInterfaceAddress, autostart, memory, vcpu, offset, client); err != nil {
if err = libvirtutils.CreateDomain(name, ignKey, pool, name, name, networkInterfaceName, networkInterfaceAddress, autostart, memory, vcpu, offset, client); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Although you've added pool here, why do we pass name, twice?

Copy link
Member

Choose a reason for hiding this comment

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

Although you've added pool here, why do we pass name, twice?

We actually pass it three times ;). CreateDomain allows the domain, volume, and host names to be configured seperately, but we opt to use the same value for all three here.

if err := setCoreOSIgnition(&domainDef, ignKey); err != nil {
ignVolume, err := getVolumeFromPool(ignKey, poolName, virConn)
if err != nil {
return fmt.Errorf("error getting ignition volume: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Add which pool:

error getting ignition from pool %q ...

It will help any subsequent debugging if we know which pool (by name).

Copy link
Member

Choose a reason for hiding this comment

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

Add which pool...

I'd rather handle that in getVolumeFromPool, where all callers can benefit. And at least one of the errors there already includes the pool name.

@@ -171,6 +158,17 @@ func CreateVolume(volumeName, poolName, baseVolumeID, source, volumeFormat strin
}

// create the volume
pool, err := virConn.LookupStoragePoolByName(poolName)
defer pool.Free()
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you actually call pool.Free() in the face of an error? Won't pool be nil in those cases?

// Refresh the pool of the volume so that libvirt knows it is
// not longer in use.
waitForSuccess("error refreshing pool for volume", func() error {
return pool.Refresh(0)
Copy link
Contributor

Choose a reason for hiding this comment

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

How does this exit? Will it run forever if the pool fails to refresh successfully?

return pool.Refresh(0)
})
if err != nil {
return fmt.Errorf("can't find storage pool '%s'", poolName)
Copy link
Contributor

Choose a reason for hiding this comment

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

Use %q for quoting strings.


// Refresh the pool of the volume so that libvirt knows it is
// not longer in use.
volPool, err := volume.LookupPoolByVolume()
waitForSuccess("error refreshing pool for volume", func() error {
return pool.Refresh(0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this run forever?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm new to Go/Installer so maybe I'm missing something but pool.Refresh call is blocking and since it does I/O, theoretically it can take a long time before returning. If the call returns an error, it's very unlikely to succeed if called again. So I'm not sure looking over it until it succeeds is the way to go here.


// DeleteVolume removes the volume identified by `key` from libvirt
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment needs updating; key isn't listed as a parameter.

// TODO: add locking support
//poolName, err := volPool.GetName()
//poolName, err := pool.GetName()
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove dead code.

volumeName = name
diskVolume, err := getVolumeFromPool(volumeName, poolName, virConn)
if err != nil {
return fmt.Errorf("can't retrieve volume %s for pool %s: %v", volumeName, poolName, err)
Copy link
Member

Choose a reason for hiding this comment

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

@jcantrill
Copy link

👍 I need this as had to move my default location due to limitations in the root partition

@openshift-ci-robot
Copy link
Contributor

@enxebre: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/prow/rhel-images 00b16f1 link /test rhel-images

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@nhosoi
Copy link

nhosoi commented Jan 14, 2019

I need this as had to move my default location due to limitations in the root partition

+100

@praveenkumar
Copy link
Contributor

@enxebre ping, Any plan to update it with suggested changes and rebase with current master.

@enxebre
Copy link
Member Author

enxebre commented Mar 8, 2019

hey @praveenkumar sorry for the delay, we still plan on doing this but libvirt development moves slow due to our priorities pipeline. Any contributions are always welcome :)

@praveenkumar
Copy link
Contributor

@zeenix can you take a look to this PR and try to update?

@zeenix
Copy link
Contributor

zeenix commented Mar 12, 2019

@zeenix can you take a look to this PR and try to update?

Sure. Thanks for pointing it out.

@zeenix
Copy link
Contributor

zeenix commented Mar 28, 2019

I finally started looking into this. It's not a straight-forward rebase on current master but it's not too difficult either.

@zeenix zeenix mentioned this pull request Apr 16, 2019
@zeenix
Copy link
Contributor

zeenix commented Apr 16, 2019

People with access rights to do so, please close this in favour of #144

@ingvagabund
Copy link
Member

Closing per #45 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet