-
Notifications
You must be signed in to change notification settings - Fork 56
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
Conversation
} | ||
defer volPool.Free() | ||
//defer volume.Free() |
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.
Do we need to remove this and instead free the returned volumes in each of the calling sites?
/approve cancel |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: If they are not already assigned, you can assign the PR to them by writing 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 |
@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. |
@@ -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 { |
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.
Although you've added pool
here, why do we pass name
, twice?
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.
Although you've added
pool
here, why do we passname
, 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) |
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.
Add which pool:
error getting ignition from pool %q ...
It will help any subsequent debugging if we know which pool (by 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.
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() |
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.
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) |
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.
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) |
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 %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) |
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.
Can this run forever?
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'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 |
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.
Comment needs updating; key
isn't listed as a parameter.
// TODO: add locking support | ||
//poolName, err := volPool.GetName() | ||
//poolName, err := pool.GetName() |
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.
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) |
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 getVolumeFromPool
becomes consistent about listing the volume and pool in its error messages, we can drop them here.
👍 I need this as had to move my default location due to limitations in the root partition |
@enxebre: The following test failed, say
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. |
+100 |
@enxebre ping, Any plan to update it with suggested changes and rebase with current master. |
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 :) |
@zeenix can you take a look to this PR and try to update? |
Sure. Thanks for pointing it out. |
I finally started looking into this. It's not a straight-forward rebase on current master but it's not too difficult either. |
People with access rights to do so, please close this in favour of #144 |
Closing per #45 (comment) |
Drop full paths in favour of pool and name based look up for volumes
See openshift/machine-api-operator#70