Skip to content

drop volumes full paths - #45

Closed
enxebre wants to merge 1 commit into
openshift:masterfrom
enxebre:drop-volumes-paths
Closed

enxebre wants to merge 1 commit into
openshift:masterfrom
enxebre:drop-volumes-paths

Conversation

@enxebre

@enxebre enxebre commented Oct 8, 2018 •

Copy link
Copy Markdown
Member

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

enxebre commented Oct 8, 2018

Copy link
Copy Markdown
Member Author

return nil, fmt.Errorf("can't retrieve volume %q: %v", volumeName, err)
}
defer volPool.Free()
//defer volume.Free()

Copy link
Copy Markdown
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
Copy Markdown
Contributor

/approve cancel

@openshift-ci-robot

Copy link
Copy Markdown
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

Details 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
Copy Markdown
Contributor

@enxebre: PR needs rebase.

Details

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

// 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.


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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

// not longer in use.
volPool, err := volume.LookupPoolByVolume()
waitForSuccess("error refreshing pool for volume", func() error {
return pool.Refresh(0)

Copy link
Copy Markdown
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
Copy Markdown
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.

return volume, nil
}

// DeleteVolume removes the volume identified by `key` from libvirt

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

Choose a reason for hiding this comment

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

@jcantrill

Copy link
Copy Markdown

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

@openshift-ci-robot

Copy link
Copy Markdown
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.

Details

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

nhosoi commented Jan 14, 2019

Copy link
Copy Markdown

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

+100

@praveenkumar

Copy link
Copy Markdown
Contributor

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

@enxebre

enxebre commented Mar 8, 2019

Copy link
Copy Markdown
Member Author

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
Copy Markdown
Contributor

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

@zeenix

zeenix commented Mar 12, 2019

Copy link
Copy Markdown
Contributor

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

Sure. Thanks for pointing it out.

@zeenix zeenix mentioned this pull request Mar 25, 2019
2 tasks done
@zeenix

zeenix commented Mar 28, 2019

Copy link
Copy Markdown
Contributor

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

zeenix commented Apr 16, 2019

Copy link
Copy Markdown
Contributor

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

@ingvagabund

Copy link
Copy Markdown
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.