Hello everyone,I am a newcomer.
I am learning OpenStack and kvm, but now I met a difficult problem:
I have a qcow2 image A,
a qcow2 delta image B whose backing file is A,
and a qcow2 image C whose backing file is B.
Now I want to merge B and C into a new qcow2 image D whose backing file is A.
I have tried to use qemu-img to solve it, but still didn't get positive solutions.
I hope you can help me, really appreciate.
With the vm in question currently running use a virsh blockpull.
virsh blockpull --domain vmname --path /var/lib/libvirt/images/c.qcow2
this assumes vmname is the vm using c.qcow2 which is backed by b.qcow2 which is backed by a.qcow2.
If you'd like a file other than c.qcow2 to be the final new complete backless file, then use the vm and create a d.qcow2 first and name it in the virsh command. This will leave a,b,c intact and pull a+b+c into d.
And yes, the domain is to be up and running while you do it.
cp C D
qemu-img rebase -b A D
This creates a copy of C called D and then rebases D on A.
Yes, it does work! Read here
Situation:
A <- B <- C
Task:
A <- D(B2&C2)
Solution:
A <- D <- B <- C
What you need to do, is:
Create a new - and therefore empty - snapshot for A.
Make copies of B and C as B2 and C2.
Rebase B2 to D.
Rebase C2 to B2.
Commit C2 to B2 and delete C2.
Commit B2 to D and delete B2.
What remains is D, containing B and C, with A as base. Done. This is possible because inserting an EMPTY snapshot into an existing chain of snapshots is possible.
Related
I have a bare Git repository. Let's say I have some content in branch master and the head is pointing at commit "C1".
test.txt at C1 contains
line-1
Now, I create a new branch ref R1 and add a new commit C11 with its parent commit being C1 (head of R1).
test.txt at C11 contains
line-1
line-2
line-3
I pulled master and see that a new commit C2 is added.
It contains test.txt as
line-1
line-2
Now, I want to merge C2 with C11 and create a new commit.
The issue I am facing is while merging.
I think this should auto-merge without any conflicts.
To merge:
Merger merger = MergeStrategy.RECURSIVE.newMerger(git.getRepository(), true);
merger.merge('C2', 'C11');
Here, the merge result is conflicted. But ideally, it should have been a non-conflicting auto-merge.
The JGit API for merging org.eclipse.jgit.merge.MergeAlgorithm#merge has the following input:
base
line-1
ours
line-1
line-2
theirs
line-1
line-2
line-3
What could be missing here / Anything special needs to be done while merging for bare repositories?
Thanks.
I'm trying to create directories to store image sequences based on a 'find' command.
Let's say there are 2 image sequences in different locations within the 'test' directory
test_123.####.dpx
test_abc.####.dpx
I would run something like:
testDir=$(find /Users/Tim/test/ -type f -name "test*.dpx")
and it would return all of the files as listed above.
What I would like to do is create two directories named test_123 and test_abc.
mkdir /Users/Tim/test/scan/${testDir:t:r:r}
If I run this then it will only create one directory, presumably based on the first result.
How would I be able to make this work to create directories that share the same base name for an unlimited number of results? (not just two as in the case of this example).
if it's not important that it's done in zsh, you could just do it in python like this:
#!/usr/bin/python3
import os
x = 0
y = 0
if input(f"{os.getcwd()} is current working dir. press y to continue \n") == "y":
for file in os.listdir(): # get files in current folder
split = file.split(".") # split by .
if len(split) > 1: # only files with more than one . are considered
if split[0] not in os.listdir(): # if the folder it fits doesn't exist
os.mkdir(split[0]) # make the folder
print(f"made new folder {split[0]}")
y = y + 1
os.rename(file, os.path.join(split[0],file)) # then move it there - OS agnostic path generated!
x = x + 1
print(f"moved {x} files to {y} folders!")
I added a check before it runs, just to prevent random people who find this from wreaking havoc. The if len(split) > 1: should also prevent some accidents by making sure it's only files with at least 2 dots that are moved, as that's an unusual naming scheme.
There is command in the oiiotool to swap the channels of a image by using the --ch command like so:
oiiotool rgba.tif --ch R=B,G,B=R,A -o bgra.tif
What Im asking is if there is an option to load two images to the stack and add lets say the Red channel from Image A to the green channel of image B.
In case somebody needs the answer here it is:
oiiotool A.exr --ch R B.exr --ch B --chappend A.exr --ch G --chappend --chnames R,G,B -o mix.exr
To break down what that means,
* read A, take just its R channel
* read B, take just its G channel
* Append channels of the the top two images, yielding A.r,B.g on the top of the stack
* read A again, take just its B channel
* Append the channels of the top two images, now you have A.r,B.g,A.b
* Force new channel names R,G,B just in case they carry their old names or got confused
* Output to mix.exr
I have 3 tasks, A, B and C. I want to run task A only once, and then run task B monthly until end_date, then run task C only once to clean up.
This is similar to this question, but not applicable. How to handle different task intervals on a single Dag in airflow?
Thanks for your help
For task A that is supposed to run only once, you can take inspiration from here
As far as tasks B & C are concerned, they can be tied up with A using a ShortCircuitOperator (as already told in the link you cited)
-> B
/
A -> ShortCircuit
\
-> C
Alternatively, you could skip B and C internally using an AirflowSkipException
My requirement is to read a file and fetch some data from each line.
for eg:suppose my file conatain this data:
a b c d
e f g h
I want to read a b c, after reading a b c ,i want to directly move to second line to read e.
Is there is any function to get cursor to starting of next line from current line(imagine cursor position is at middle of the current line and i need to jump directly to initial of next line "to e here").
Please let me know!!
UTL_FILE.GET_LINE reads data from the file one line at a time. So the first time called it would read the line 'a b c d', the second time 'e f g h'. I don't know what you mean by saying your "cursor position is at the middle of the current line". Can you post your code so far?
after reading a line with get_line, use instr and substr to get only a b c and then go to next line.